Home
last modified time | relevance | path

Searched refs:len (Results 1 – 25 of 192) sorted by relevance

12345678

/systemd-251/src/boot/efi/
Dtest-bcd.c13 size_t len; in load_bcd() local
17 …ssert_se(read_full_file_full(AT_FDCWD, fn, UINT64_MAX, SIZE_MAX, 0, NULL, &compressed, &len) >= 0); in load_bcd()
18 assert_se(decompress_blob_zstd(compressed, len, ret_bcd, ret_bcd_len, SIZE_MAX) >= 0); in load_bcd()
26 size_t len; in test_get_bcd_title_one() local
31 load_bcd(path, &bcd, &len); in test_get_bcd_title_one()
33 char16_t *title = get_bcd_title(bcd, len); in test_get_bcd_title_one()
55 size_t len; in TEST() local
60 load_bcd("test-bcd/win10.bcd.zst", (void **) &bcd, &len); in TEST()
64 assert_se(get_bcd_title(bcd_base, len)); in TEST()
71 assert_se(!get_bcd_title(bcd_base, len)); in TEST()
[all …]
/systemd-251/src/basic/
Dutf8.c84 size_t len; in utf8_encoded_to_unichar() local
88 len = utf8_encoded_expected_len(str[0]); in utf8_encoded_to_unichar()
90 switch (len) { in utf8_encoded_to_unichar()
113 for (size_t i = 1; i < len; i++) { in utf8_encoded_to_unichar()
158 int len; in utf8_is_valid_n() local
163 len = utf8_encoded_valid_unichar(p, in utf8_is_valid_n()
165 if (_unlikely_(len < 0)) in utf8_is_valid_n()
168 p += len; in utf8_is_valid_n()
184 int len; in utf8_escape_invalid() local
186 len = utf8_encoded_valid_unichar(str, SIZE_MAX); in utf8_escape_invalid()
[all …]
Dstrbuf.c38 .len = 1, in strbuf_new()
108 ssize_t strbuf_add_string(struct strbuf *str, const char *s, size_t len) { in strbuf_add_string() argument
121 if (len == 0) { in strbuf_add_string()
125 str->in_len += len; in strbuf_add_string()
128 for (size_t depth = 0; depth <= len; depth++) { in strbuf_add_string()
132 off = node->value_off + node->value_len - len; in strbuf_add_string()
133 … if (depth == len || (node->value_len >= len && memcmp(str->buf + off, s, len) == 0)) { in strbuf_add_string()
134 str->dedup_len += len; in strbuf_add_string()
139 c = s[len - 1 - depth]; in strbuf_add_string()
150 buf_new = realloc(str->buf, str->len + len+1); in strbuf_add_string()
[all …]
Dhexdecoct.c195 size_t len; in base32hexmem() local
201 len = 8 * (l + 4) / 5; in base32hexmem()
204 len = 8 * l / 5; in base32hexmem()
208 len += 7; in base32hexmem()
211 len += 5; in base32hexmem()
214 len += 4; in base32hexmem()
217 len += 2; in base32hexmem()
222 z = r = malloc(len + 1); in base32hexmem()
305 size_t len; in unbase32hexmem() local
329 len = (l / 8) * 5; in unbase32hexmem()
[all …]
Dhexdecoct.h21 int unhexmem_full(const char *p, size_t l, bool secure, void **mem, size_t *len);
22 static inline int unhexmem(const char *p, size_t l, void **mem, size_t *len) { in unhexmem() argument
23 return unhexmem_full(p, l, false, mem, len); in unhexmem()
34 int unbase32hexmem(const char *p, size_t l, bool padding, void **mem, size_t *len);
44 int unbase64mem_full(const char *p, size_t l, bool secure, void **mem, size_t *len);
45 static inline int unbase64mem(const char *p, size_t l, void **mem, size_t *len) { in unbase64mem() argument
46 return unbase64mem_full(p, l, false, mem, len); in unbase64mem()
Dstrxcpyx.c21 size_t strnpcpy_full(char **dest, size_t size, const char *src, size_t len, bool *ret_truncated) { in strnpcpy_full() argument
29 *ret_truncated = len > 0; in strnpcpy_full()
33 if (len >= size) { in strnpcpy_full()
38 } else if (len > 0) { in strnpcpy_full()
39 *dest = mempcpy(*dest, src, len); in strnpcpy_full()
40 size -= len; in strnpcpy_full()
105 size_t strnscpy_full(char *dest, size_t size, const char *src, size_t len, bool *ret_truncated) { in strnscpy_full() argument
112 return strnpcpy_full(&s, size, src, len, ret_truncated); in strnscpy_full()
Dether-addr-util.c106 static int parse_hw_addr_one_field(const char **s, char sep, size_t len, uint8_t *buf) { in parse_hw_addr_one_field() argument
113 assert(IN_SET(len, 1, 2)); in parse_hw_addr_one_field()
118 for (size_t i = 0; i < len * 2; i++) { in parse_hw_addr_one_field()
147 switch (len) { in parse_hw_addr_one_field()
165 size_t field_size, max_len, len = 0; in parse_hw_addr_full() local
229 len = (i + 1) * field_size; in parse_hw_addr_full()
234 if (len == 0) in parse_hw_addr_full()
238 if (!IN_SET(len, 4, 16, ETH_ALEN, INFINIBAND_ALEN)) in parse_hw_addr_full()
241 if (len != expected_len) in parse_hw_addr_full()
245 ret->length = len; in parse_hw_addr_full()
Dgcrypt-util.h21 int string_hashsum(const char *s, size_t len, int md_algorithm, char **out);
24 static inline int string_hashsum_sha224(const char *s, size_t len, char **out) { in string_hashsum_sha224() argument
26 return string_hashsum(s, len, GCRY_MD_SHA224, out); in string_hashsum_sha224()
32 static inline int string_hashsum_sha256(const char *s, size_t len, char **out) { in string_hashsum_sha256() argument
34 return string_hashsum(s, len, GCRY_MD_SHA256, out); in string_hashsum_sha256()
/systemd-251/src/libsystemd-network/
Ddhcp-packet.c64 uint16_t dhcp_packet_checksum(uint8_t *buf, size_t len) { in dhcp_packet_checksum() argument
66 uint64_t *end_64 = buf_64 + (len / sizeof(uint64_t)); in dhcp_packet_checksum()
80 if (len % sizeof(uint64_t)) { in dhcp_packet_checksum()
85 memcpy(&buf_tail, buf_64, len % sizeof(uint64_t)); in dhcp_packet_checksum()
101 uint16_t destination_port, uint16_t len, int ip_service_type) { in dhcp_packet_append_ip_headers() argument
104 packet->ip.tot_len = htobe16(len); in dhcp_packet_append_ip_headers()
118 packet->udp.len = htobe16(len - DHCP_IP_SIZE); in dhcp_packet_append_ip_headers()
120 packet->ip.check = packet->udp.len; in dhcp_packet_append_ip_headers()
121 packet->udp.check = dhcp_packet_checksum((uint8_t*)&packet->ip.ttl, len - 8); in dhcp_packet_append_ip_headers()
128 int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum, uint16_t port) { in dhcp_packet_verify_headers() argument
[all …]
Dsd-dhcp-lease.c339 static int lease_parse_u32(const uint8_t *option, size_t len, uint32_t *ret, uint32_t min) { in lease_parse_u32() argument
343 if (len != 4) in lease_parse_u32()
353 static int lease_parse_u16(const uint8_t *option, size_t len, uint16_t *ret, uint16_t min) { in lease_parse_u16() argument
357 if (len != 2) in lease_parse_u16()
367 static int lease_parse_be32(const uint8_t *option, size_t len, be32_t *ret) { in lease_parse_be32() argument
371 if (len != 4) in lease_parse_be32()
378 static int lease_parse_string(const uint8_t *option, size_t len, char **ret) { in lease_parse_string() argument
382 if (len <= 0) in lease_parse_string()
391 if (memchr(option, 0, len - 1)) in lease_parse_string()
394 string = memdup_suffix0((const char *) option, len); in lease_parse_string()
[all …]
Ddhcp6-option.c223 unaligned_write_be16(*buf + offsetof(DHCP6Option, len), optlen); in option_append_hdr()
335 uint16_t len; in dhcp6_option_append_ia() local
348 len = sizeof(struct ia_header); in dhcp6_option_append_ia()
355 len = sizeof(header.id); /* IA_TA does not have lifetime. */ in dhcp6_option_append_ia()
365 if (*buflen < offsetof(DHCP6Option, data) + len) in dhcp6_option_append_ia()
375 *buf = mempcpy(*buf, &header, len); in dhcp6_option_append_ia()
376 *buflen -= len; in dhcp6_option_append_ia()
386 len += r; in dhcp6_option_append_ia()
389 return option_append_hdr(&ia_hdr, &ia_buflen, ia->type, len); in dhcp6_option_append_ia()
429 size_t len = strlen(*s); in dhcp6_option_append_user_class() local
[all …]
Dtest-dhcp-option.c21 int len; member
86 size_t len = sizeof(DHCPMessage) + optlen; in test_message_init() local
89 message = malloc0(len); in test_message_init()
105 assert_se(dhcp_option_parse(message, len, NULL, NULL, NULL) >= 0); in test_message_init()
112 size_t len = sizeof(DHCPMessage) + optlen; in create_message() local
114 message = malloc0(len); in create_message()
144 static int test_options_cb(uint8_t code, uint8_t len, const void *option, void *userdata) { in test_options_cb() argument
151 assert_se((!desc && !code && !len) || desc); in test_options_cb()
165 desclen = &desc->len; in test_options_cb()
197 len, optlen); in test_options_cb()
[all …]
Ddhcp-option.c66 size_t len = strlen(*s); in option_append() local
68 if (len > 255 || len == 0) in option_append()
71 total += 1 + len; in option_append()
82 size_t len = strlen(*s); in option_append() local
84 options[*offset] = len; in option_append()
85 memcpy(&options[*offset + 1], *s, len); in option_append()
86 *offset += 1 + len; in option_append()
279 uint8_t code, len; in parse_options() local
297 len = options[offset ++]; in parse_options()
299 if (buflen < offset + len) in parse_options()
[all …]
Dtest-dhcp6-client.c330 assert_se(sizeof(option1) == sizeof(DHCP6Option) + be16toh(option->len)); in TEST()
332 …r = dhcp6_option_parse_ia(NULL, 0, be16toh(option->code), be16toh(option->len), option->data, &ia); in TEST()
335 …r = dhcp6_option_parse_ia(NULL, iaid, be16toh(option->code), be16toh(option->len), option->data, &… in TEST()
338 option->len = htobe16(17); in TEST()
339 …r = dhcp6_option_parse_ia(NULL, iaid, be16toh(option->code), be16toh(option->len), option->data, &… in TEST()
342 option->len = htobe16(sizeof(DHCP6Option)); in TEST()
343 …r = dhcp6_option_parse_ia(NULL, iaid, be16toh(option->code), be16toh(option->len), option->data, &… in TEST()
347 assert_se(sizeof(option2) == sizeof(DHCP6Option) + be16toh(option->len)); in TEST()
348 …r = dhcp6_option_parse_ia(NULL, iaid, be16toh(option->code), be16toh(option->len), option->data, &… in TEST()
352 assert_se(sizeof(option3) == sizeof(DHCP6Option) + be16toh(option->len)); in TEST()
[all …]
Ddhcp-internal.h41 const void *packet, size_t len);
43 const void *packet, size_t len);
50 typedef int (*dhcp_option_callback_t)(uint8_t code, uint8_t len,
53 int dhcp_option_parse(DHCPMessage *message, size_t len, dhcp_option_callback_t cb, void *userdata, …
59 uint16_t dhcp_packet_checksum(uint8_t *buf, size_t len);
63 uint16_t destination, uint16_t len, int ip_service_type);
65 int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum, uint16_t port);
/systemd-251/src/basic/linux/
Dnetlink.h90 #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) argument
92 #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN) argument
93 #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) argument
95 #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ argument
98 #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ argument
100 (nlh)->nlmsg_len <= (len))
101 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) argument
234 #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) argument
Drtnetlink.h210 #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) argument
211 #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \ argument
213 (rta)->rta_len <= (len))
216 #define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len)) argument
217 #define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len)) argument
423 #define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) argument
424 #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \ argument
425 ((int)(rtnh)->rtnh_len) <= (len))
427 #define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len)) argument
428 #define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) argument
/systemd-251/src/udev/scsi_id/
Dscsi_serial.c361 unsigned char *buffer, unsigned len) { in do_scsi_page0_inquiry() argument
364 memzero(buffer, len); in do_scsi_page0_inquiry()
365 retval = scsi_inquiry(dev_scsi, fd, 1, 0x0, buffer, len); in do_scsi_page0_inquiry()
373 if (buffer[3] > len) { in do_scsi_page0_inquiry()
428 int i, j, s, len; in check_fill_0x83_id() local
459 len = page_83[3]; in check_fill_0x83_id()
464 len *= 2; in check_fill_0x83_id()
469 len += 2; in check_fill_0x83_id()
471 len += VENDOR_LENGTH + MODEL_LENGTH; in check_fill_0x83_id()
473 if (max_len < len) { in check_fill_0x83_id()
[all …]
/systemd-251/src/udev/cdrom_id/
Dcdrom_id.c360 size_t len; in cd_profiles_old_mmc() local
373len = be16toh(discinfo.disc_information_length) + sizeof(discinfo.disc_information_length); in cd_profiles_old_mmc()
374 if (len > sizeof(discinfo)) in cd_profiles_old_mmc()
375 len = sizeof(discinfo); in cd_profiles_old_mmc()
379 scsi_cmd_set(&sc, 8, len); in cd_profiles_old_mmc()
381 … r = scsi_cmd_run_and_log(&sc, c->fd, (unsigned char *)&discinfo, len, "read disc information"); in cd_profiles_old_mmc()
411 size_t len; in cd_profiles() local
443 len = unaligned_read_be32(features); in cd_profiles()
444 log_debug("GET CONFIGURATION: size of features buffer %zu", len); in cd_profiles()
446 if (len > sizeof(features)) { in cd_profiles()
[all …]
/systemd-251/src/shared/
Dcpu-set-util.c25 size_t len = 0; in cpu_set_to_string() local
32 if (!GREEDY_REALLOC(str, len + 1 + DECIMAL_STR_MAX(int))) in cpu_set_to_string()
35 r = sprintf(str + len, len > 0 ? " %d" : "%d", i); in cpu_set_to_string()
37 len += r; in cpu_set_to_string()
47 size_t len = 0; in cpu_set_to_range_string() local
61 if (!GREEDY_REALLOC(str, len + 2 + 2 * DECIMAL_STR_MAX(unsigned))) in cpu_set_to_range_string()
65 … r = sprintf(str + len, len > 0 ? " %d-%d" : "%d-%d", range_start, range_end); in cpu_set_to_range_string()
67 r = sprintf(str + len, len > 0 ? " %d" : "%d", range_start); in cpu_set_to_range_string()
69 len += r; in cpu_set_to_range_string()
73 if (!GREEDY_REALLOC(str, len + 2 + 2 * DECIMAL_STR_MAX(int))) in cpu_set_to_range_string()
[all …]
Dbarrier.c173 ssize_t len; in barrier_write() local
181 len = write(b->me, &buf, sizeof(buf)); in barrier_write()
182 } while (len < 0 && ERRNO_IS_TRANSIENT(errno)); in barrier_write()
184 if (len != sizeof(buf)) in barrier_write()
230 ssize_t len; in barrier_read() local
233 len = read(b->them, &buf, sizeof(buf)); in barrier_read()
234 if (len < 0 && ERRNO_IS_TRANSIENT(errno)) in barrier_read()
237 if (len != sizeof(buf)) in barrier_read()
/systemd-251/src/fundamental/
Dsha256.c130 void sha256_process_bytes(const void *buffer, size_t len, struct sha256_ctx *ctx) { in sha256_process_bytes() argument
139 size_t add = 128 - left_over > len ? len : 128 - left_over; in sha256_process_bytes()
154 len -= add; in sha256_process_bytes()
158 if (len >= 64) { in sha256_process_bytes()
171 while (len > 64) { in sha256_process_bytes()
175 len -= 64; in sha256_process_bytes()
180 sha256_process_block(buffer, len & ~63, ctx); in sha256_process_bytes()
181 buffer = (const char *) buffer + (len & ~63); in sha256_process_bytes()
182 len &= 63; in sha256_process_bytes()
187 if (len > 0) { in sha256_process_bytes()
[all …]
/systemd-251/src/libsystemd/sd-netlink/
Dnetlink-socket.c32 socklen_t len = 0, old_len; in broadcast_groups_get() local
38 if (getsockopt(nl->fd, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, NULL, &len) < 0) { in broadcast_groups_get()
46 if (len == 0) in broadcast_groups_get()
49 groups = new0(uint32_t, len); in broadcast_groups_get()
53 old_len = len; in broadcast_groups_get()
55 if (getsockopt(nl->fd, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, groups, &len) < 0) in broadcast_groups_get()
58 if (old_len != len) in broadcast_groups_get()
61 for (unsigned i = 0; i < len; i++) in broadcast_groups_get()
281 size_t len, allocated; in socket_read_message() local
295 len = (size_t) r; in socket_read_message()
[all …]
/systemd-251/src/libsystemd/sd-hwdb/
Dsd-hwdb.c28 size_t len; member
33 buf->len = 0; in linebuf_init()
37 if (buf->len + 1 >= sizeof(buf->bytes)) in linebuf_get()
39 buf->bytes[buf->len] = '\0'; in linebuf_get()
43 static bool linebuf_add(struct linebuf *buf, const char *s, size_t len) { in linebuf_add() argument
44 if (buf->len + len >= sizeof(buf->bytes)) in linebuf_add()
46 memcpy(buf->bytes + buf->len, s, len); in linebuf_add()
47 buf->len += len; in linebuf_add()
52 if (buf->len + 1 >= sizeof(buf->bytes)) in linebuf_add_char()
54 buf->bytes[buf->len++] = c; in linebuf_add_char()
[all …]
/systemd-251/src/libsystemd/sd-bus/
Dbus-dump.c502 static uint16_t pcapng_optlen(size_t len) { in pcapng_optlen() argument
503 return ALIGN4(len + sizeof(struct pcapng_option)); in pcapng_optlen()
506 static void pcapng_putopt(FILE *f, uint16_t code, const void *data, size_t len) { in pcapng_putopt() argument
509 .length = len, in pcapng_putopt()
513 assert((uint16_t) len == len); in pcapng_putopt()
514 assert(data || len == 0); in pcapng_putopt()
517 if (len > 0) { in pcapng_putopt()
518 size_t pad = ALIGN4(len) - len; in pcapng_putopt()
520 fwrite(data, 1, len, f); in pcapng_putopt()
529 uint32_t len; in pcapng_section_header() local
[all …]

12345678