tree-wide: "<n>bit" → "<n>-bit"

In some places, "<n> bits" is used when more appropriate.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2023-07-02 11:10:12 +01:00
committed by Luca Boccassi
parent 221332ee13
commit da89046643
83 changed files with 221 additions and 224 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ struct dirent *readdir_no_dot(DIR *dirp);
/* Maximum space one dirent structure might require at most */
#define DIRENT_SIZE_MAX CONST_MAX(sizeof(struct dirent), offsetof(struct dirent, d_name) + NAME_MAX + 1)
/* Only if 64bit off_t is enabled struct dirent + struct dirent64 are actually the same. We require this, and
/* Only if 64-bit off_t is enabled struct dirent + struct dirent64 are actually the same. We require this, and
* we want them to be interchangeable to make getdents64() work, hence verify that. */
assert_cc(_FILE_OFFSET_BITS == 64);
#if HAVE_STRUCT_DIRENT64
+2 -2
View File
@@ -182,7 +182,7 @@ int cunescape_one(const char *p, size_t length, char32_t *ret, bool *eight_bit,
}
case 'u': {
/* C++11 style 16bit unicode */
/* C++11 style 16-bit unicode */
int a[4];
size_t i;
@@ -209,7 +209,7 @@ int cunescape_one(const char *p, size_t length, char32_t *ret, bool *eight_bit,
}
case 'U': {
/* C++11 style 32bit unicode */
/* C++11 style 32-bit unicode */
int a[8];
size_t i;
+3 -3
View File
@@ -93,14 +93,14 @@ extern const struct hash_ops trivial_hash_ops;
extern const struct hash_ops trivial_hash_ops_free;
extern const struct hash_ops trivial_hash_ops_free_free;
/* 32bit values we can always just embed in the pointer itself, but in order to support 32bit archs we need store 64bit
/* 32-bit values we can always just embed in the pointer itself, but in order to support 32-bit archs we need store 64-bit
* values indirectly, since they don't fit in a pointer. */
void uint64_hash_func(const uint64_t *p, struct siphash *state);
int uint64_compare_func(const uint64_t *a, const uint64_t *b) _pure_;
extern const struct hash_ops uint64_hash_ops;
/* On some archs dev_t is 32bit, and on others 64bit. And sometimes it's 64bit on 32bit archs, and sometimes 32bit on
* 64bit archs. Yuck! */
/* On some archs dev_t is 32-bit, and on others 64-bit. And sometimes it's 64-bit on 32-bit archs, and sometimes 32-bit on
* 64-bit archs. Yuck! */
#if SIZEOF_DEV_T != 8
void devt_hash_func(const dev_t *p, struct siphash *state);
#else
+3 -3
View File
@@ -174,9 +174,9 @@ struct _packed_ indirect_storage {
};
struct direct_storage {
/* This gives us 39 bytes on 64bit, or 35 bytes on 32bit.
* That's room for 4 set_entries + 4 DIB bytes + 3 unused bytes on 64bit,
* or 7 set_entries + 7 DIB bytes + 0 unused bytes on 32bit. */
/* This gives us 39 bytes on 64-bit, or 35 bytes on 32-bit.
* That's room for 4 set_entries + 4 DIB bytes + 3 unused bytes on 64-bit,
* or 7 set_entries + 7 DIB bytes + 0 unused bytes on 32-bit. */
uint8_t storage[sizeof(struct indirect_storage)];
};
+2 -2
View File
@@ -18,7 +18,7 @@ uint64_t physical_memory(void) {
long sc;
int r;
/* We return this as uint64_t in case we are running as 32bit process on a 64bit kernel with huge amounts of
/* We return this as uint64_t in case we are running as 32-bit process on a 64-bit kernel with huge amounts of
* memory.
*
* In order to support containers nicely that have a configured memory limit we'll take the minimum of the
@@ -126,7 +126,7 @@ uint64_t system_tasks_max(void) {
*
* This limits the numeric range PIDs can take, and thus indirectly also limits the number of
* concurrent threads. It's primarily a compatibility concept: some crappy old code used a signed
* 16bit type for PIDs, hence the kernel provides a way to ensure the PIDs never go beyond
* 16-bit type for PIDs, hence the kernel provides a way to ensure the PIDs never go beyond
* INT16_MAX by default.
*
* Also note the weird definition: PIDs assigned will be kept below this value, which means
+1 -1
View File
@@ -87,7 +87,7 @@ static int rlimit_parse_u64(const char *val, rlim_t *ret) {
return 0;
}
/* setrlimit(2) suggests rlim_t is always 64bit on Linux. */
/* setrlimit(2) suggests rlim_t is always 64-bit on Linux. */
assert_cc(sizeof(rlim_t) == sizeof(uint64_t));
r = safe_atou64(val, &u);
+1 -1
View File
@@ -1179,7 +1179,7 @@ void* cmsg_find_and_copy_data(struct msghdr *mh, int level, int type, void *buf,
assert(buf_len > 0);
/* This is similar to cmsg_find_data(), but copy the found data to buf. This should be typically used
* when reading possibly unaligned data such as timestamp, as time_t is 64bit and size_t is 32bit on
* when reading possibly unaligned data such as timestamp, as time_t is 64-bit and size_t is 32-bit on
* RISCV32. See issue #27241. */
cmsg = cmsg_find(mh, level, type, CMSG_LEN(buf_len));
+3 -3
View File
@@ -179,7 +179,7 @@ int flush_accept(int fd);
* at compile time, that the requested type has a smaller or same alignment as 'struct cmsghdr', and one
* during runtime, that the actual pointer matches the alignment too. This is supposed to catch cases such as
* 'struct timeval' is embedded into 'struct cmsghdr' on architectures where the alignment of the former is 8
* bytes (because of a 64bit time_t), but of the latter is 4 bytes (because size_t is 32bit), such as
* bytes (because of a 64-bit time_t), but of the latter is 4 bytes (because size_t is 32 bits), such as
* riscv32. */
#define CMSG_TYPED_DATA(cmsg, type) \
({ \
@@ -294,7 +294,7 @@ static inline int getsockopt_int(int fd, int level, int optname, int *ret) {
int socket_bind_to_ifname(int fd, const char *ifname);
int socket_bind_to_ifindex(int fd, int ifindex);
/* Define a 64bit version of timeval/timespec in any case, even on 32bit userspace. */
/* Define a 64-bit version of timeval/timespec in any case, even on 32-bit userspace. */
struct timeval_large {
uint64_t tvl_sec, tvl_usec;
};
@@ -302,7 +302,7 @@ struct timespec_large {
uint64_t tvl_sec, tvl_nsec;
};
/* glibc duplicates timespec/timeval on certain 32bit archs, once in 32bit and once in 64bit.
/* glibc duplicates timespec/timeval on certain 32-bit arches, once in 32-bit and once in 64-bit.
* See __convert_scm_timestamps() in glibc source code. Hence, we need additional buffer space for them
* to prevent from recvmsg_safe() returning -EXFULL. */
#define CMSG_SPACE_TIMEVAL \
+4 -4
View File
@@ -1661,13 +1661,13 @@ int time_change_fd(void) {
if (timerfd_settime(fd, TFD_TIMER_ABSTIME|TFD_TIMER_CANCEL_ON_SET, &its, NULL) >= 0)
return TAKE_FD(fd);
/* So apparently there are systems where time_t is 64bit, but the kernel actually doesn't support
* 64bit time_t. In that case configuring a timer to TIME_T_MAX will fail with EOPNOTSUPP or a
/* So apparently there are systems where time_t is 64-bit, but the kernel actually doesn't support
* 64-bit time_t. In that case configuring a timer to TIME_T_MAX will fail with EOPNOTSUPP or a
* similar error. If that's the case let's try with INT32_MAX instead, maybe that works. It's a bit
* of a black magic thing though, but what can we do?
*
* We don't want this code on x86-64, hence let's conditionalize this for systems with 64bit time_t
* but where "long" is shorter than 64bit, i.e. 32bit archs.
* We don't want this code on x86-64, hence let's conditionalize this for systems with 64-bit time_t
* but where "long" is shorter than 64-bit, i.e. 32-bit archs.
*
* See: https://github.com/systemd/systemd/issues/14362 */
+1 -1
View File
@@ -222,7 +222,7 @@ static inline int usleep_safe(usec_t usec) {
/* The last second we can format is 31. Dec 9999, 1s before midnight, because otherwise we'd enter 5 digit
* year territory. However, since we want to stay away from this in all timezones we take one day off. */
#define USEC_TIMESTAMP_FORMATTABLE_MAX_64BIT ((usec_t) 253402214399000000) /* Thu 9999-12-30 23:59:59 UTC */
/* With a 32bit time_t we can't go beyond 2038...
/* With a 32-bit time_t we can't go beyond 2038...
* We parse timestamp with RFC-822/ISO 8601 (e.g. +06, or -03:00) as UTC, hence the upper bound must be off
* by USEC_PER_DAY. See parse_timestamp() for more details. */
#define USEC_TIMESTAMP_FORMATTABLE_MAX_32BIT (((usec_t) INT32_MAX) * USEC_PER_SEC - USEC_PER_DAY)
+3 -3
View File
@@ -37,7 +37,7 @@ bool uid_is_valid(uid_t uid) {
if (uid == (uid_t) UINT32_C(0xFFFFFFFF))
return false;
/* A long time ago UIDs where 16bit, hence explicitly avoid the 16bit -1 too */
/* A long time ago UIDs where 16 bit, hence explicitly avoid the 16-bit -1 too */
if (uid == (uid_t) UINT32_C(0xFFFF))
return false;
@@ -765,14 +765,14 @@ bool valid_user_group_name(const char *u, ValidUserFlags flags) {
if (in_charset(u, "0123456789")) /* Don't allow fully numeric strings, they might be confused
* with UIDs (note that this test is more broad than
* the parse_uid() test above, as it will cover more than
* the 32bit range, and it will detect 65535 (which is in
* the 32-bit range, and it will detect 65535 (which is in
* invalid UID, even though in the unsigned 32 bit range) */
return false;
if (u[0] == '-' && in_charset(u + 1, "0123456789")) /* Don't allow negative fully numeric
* strings either. After all some people
* write 65535 as -1 (even though that's
* not even true on 32bit uid_t
* not even true on 32-bit uid_t
* anyway) */
return false;
+4 -4
View File
@@ -69,13 +69,13 @@ int take_etc_passwd_lock(const char *root);
/* If REMOUNT_IDMAPPING_HOST_ROOT is set for remount_idmap() we'll include a mapping here that maps the host
* root user accessing the idmapped mount to the this user ID on the backing fs. This is the last valid UID in
* the *signed* 32bit range. You might wonder why precisely use this specific UID for this purpose? Well, we
* the *signed* 32-bit range. You might wonder why precisely use this specific UID for this purpose? Well, we
* definitely cannot use the first 0…65536 UIDs for that, since in most cases that's precisely the file range
* we intend to map to some high UID range, and since UID mappings have to be bijective we thus cannot use
* them at all. Furthermore the UID range beyond INT32_MAX (i.e. the range above the signed 32bit range) is
* them at all. Furthermore the UID range beyond INT32_MAX (i.e. the range above the signed 32-bit range) is
* icky, since many APIs cannot use it (example: setfsuid() returns the old UID as signed integer). Following
* our usual logic of assigning a 16bit UID range to each container, so that the upper 16bit of a 32bit UID
* value indicate kind of a "container ID" and the lower 16bit map directly to the intended user you can read
* our usual logic of assigning a 16-bit UID range to each container, so that the upper 16-bit of a 32-bit UID
* value indicate kind of a "container ID" and the lower 16-bit map directly to the intended user you can read
* this specific UID as the "nobody" user of the container with ID 0x7FFF, which is kinda nice. */
#define UID_MAPPED_ROOT ((uid_t) (INT32_MAX-1))
#define GID_MAPPED_ROOT ((gid_t) (INT32_MAX-1))
+1 -1
View File
@@ -38,7 +38,7 @@ size_t utf16_encode_unichar(char16_t *out, char32_t c);
char *utf16_to_utf8(const char16_t *s, size_t length /* bytes! */);
char16_t *utf8_to_utf16(const char *s, size_t length);
size_t char16_strlen(const char16_t *s); /* returns the number of 16bit words in the string (not bytes!) */
size_t char16_strlen(const char16_t *s); /* returns the number of 16-bit words in the string (not bytes!) */
int utf8_encoded_valid_unichar(const char *str, size_t length);
int utf8_encoded_to_unichar(const char *str, char32_t *ret_unichar);
+2 -2
View File
@@ -27,8 +27,8 @@ int sync_everything(void) {
}
const char *get_efi_arch(void) {
/* Detect EFI firmware architecture of the running system. On mixed mode systems, it could be 32bit
* while the kernel is running in 64bit. */
/* Detect EFI firmware architecture of the running system. On mixed mode systems, it could be 32-bit
* while the kernel is running in 64-bit. */
#ifdef __x86_64__
_cleanup_free_ char *platform_size = NULL;
+1 -1
View File
@@ -75,7 +75,7 @@ static EFI_STATUS pack_cpio_one(
*
* See: https://docs.kernel.org/driver-api/early-userspace/buffer-format.html */
if (contents_size > UINT32_MAX) /* cpio cannot deal with > 32bit file sizes */
if (contents_size > UINT32_MAX) /* cpio cannot deal with > 32-bit file sizes */
return EFI_LOAD_ERROR;
if (*inode_counter == UINT32_MAX) /* more than 2^32-1 inodes? yikes. cpio doesn't support that either */
+1 -1
View File
@@ -629,7 +629,7 @@ static bool handle_format_specifier(FormatContext *ctx, SpecifierContext *sp) {
/* Parses one item from the format specifier in ctx and put the info into sp. If we are done with
* this specifier returns true, otherwise this function should be called again. */
/* This implementation assumes 32bit ints. Also note that all types smaller than int are promoted to
/* This implementation assumes 32-bit ints. Also note that all types smaller than int are promoted to
* int in vararg functions, which is why we fetch only ints for any such types. The compiler would
* otherwise warn about fetching smaller types. */
assert_cc(sizeof(int) == 4);
+5 -5
View File
@@ -102,19 +102,19 @@ typedef void (*handover_f)(void *parent, EFI_SYSTEM_TABLE *table, BootParams *pa
static void linux_efi_handover(EFI_HANDLE parent, uintptr_t kernel, BootParams *params) {
assert(params);
kernel += (params->hdr.setup_sects + 1) * KERNEL_SECTOR_SIZE; /* 32bit entry address. */
kernel += (params->hdr.setup_sects + 1) * KERNEL_SECTOR_SIZE; /* 32-bit entry address. */
/* Old kernels needs this set, while newer ones seem to ignore this. */
params->hdr.code32_start = kernel;
#ifdef __x86_64__
kernel += KERNEL_SECTOR_SIZE; /* 64bit entry address. */
kernel += KERNEL_SECTOR_SIZE; /* 64-bit entry address. */
#endif
kernel += params->hdr.handover_offset; /* 32/64bit EFI handover address. */
kernel += params->hdr.handover_offset; /* 32/64-bit EFI handover address. */
/* Note in EFI mixed mode this now points to the correct 32bit handover entry point, allowing a 64bit
* kernel to be booted from a 32bit sd-stub. */
/* Note in EFI mixed mode this now points to the correct 32-bit handover entry point, allowing a 64-bit
* kernel to be booted from a 32-bit sd-stub. */
handover_f handover = (handover_f) kernel;
handover(parent, ST, params);
+1 -1
View File
@@ -171,7 +171,7 @@ static uint32_t get_compatibility_entry_address(const DosFileHeader *dos, const
static const char *sections[] = { ".compat", NULL };
/* The kernel may provide alternative PE entry points for different PE architectures. This allows
* booting a 64bit kernel on 32bit EFI that is otherwise running on a 64bit CPU. The locations of any
* booting a 64-bit kernel on 32-bit EFI that is otherwise running on a 64-bit CPU. The locations of any
* such compat entry points are located in a special PE section. */
locate_sections((const PeSectionHeader *) ((const uint8_t *) dos + section_table_offset(dos, pe)),
+1 -1
View File
@@ -91,7 +91,7 @@ static uint64_t ticks_freq(void) {
uint64_t ticks_end = ticks_read_arch();
if (ticks_end < ticks_start) /* Check for an overflow (which is not that unlikely, given on some
* archs the value is 32bit) */
* archs the value is 32-bit) */
return 0;
cache = (ticks_end - ticks_start) * 1000UL;
+4 -4
View File
@@ -147,16 +147,16 @@ static inline void strv_freep(char16_t ***p) {
EFI_STATUS open_directory(EFI_FILE *root_dir, const char16_t *path, EFI_FILE **ret);
/* Conversion between EFI_PHYSICAL_ADDRESS and pointers is not obvious. The former is always 64bit, even on
* 32bit archs. And gcc complains if we cast a pointer to an integer of a different size. Hence let's do the
/* Conversion between EFI_PHYSICAL_ADDRESS and pointers is not obvious. The former is always 64-bit, even on
* 32-bit archs. And gcc complains if we cast a pointer to an integer of a different size. Hence let's do the
* conversion indirectly: first into uintptr_t and then extended to EFI_PHYSICAL_ADDRESS. */
static inline EFI_PHYSICAL_ADDRESS POINTER_TO_PHYSICAL_ADDRESS(const void *p) {
return (EFI_PHYSICAL_ADDRESS) (uintptr_t) p;
}
static inline void *PHYSICAL_ADDRESS_TO_POINTER(EFI_PHYSICAL_ADDRESS addr) {
/* On 32bit systems the address might not be convertible (as pointers are 32bit but
* EFI_PHYSICAL_ADDRESS 64bit) */
/* On 32-bit systems the address might not be convertible (as pointers are 32-bit but
* EFI_PHYSICAL_ADDRESS 64-bit) */
assert(addr <= UINTPTR_MAX);
return (void *) (uintptr_t) addr;
}
+7 -7
View File
@@ -1483,7 +1483,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
r = safe_atou8(v, &z);
if (r < 0)
return log_error_errno(r, "Failed to parse '%s' as byte (unsigned 8bit integer): %m", v);
return log_error_errno(r, "Failed to parse '%s' as byte (unsigned 8-bit integer): %m", v);
r = sd_bus_message_append_basic(m, t, &z);
break;
@@ -1494,7 +1494,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
r = safe_atoi16(v, &z);
if (r < 0)
return log_error_errno(r, "Failed to parse '%s' as signed 16bit integer: %m", v);
return log_error_errno(r, "Failed to parse '%s' as signed 16-bit integer: %m", v);
r = sd_bus_message_append_basic(m, t, &z);
break;
@@ -1505,7 +1505,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
r = safe_atou16(v, &z);
if (r < 0)
return log_error_errno(r, "Failed to parse '%s' as unsigned 16bit integer: %m", v);
return log_error_errno(r, "Failed to parse '%s' as unsigned 16-bit integer: %m", v);
r = sd_bus_message_append_basic(m, t, &z);
break;
@@ -1516,7 +1516,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
r = safe_atoi32(v, &z);
if (r < 0)
return log_error_errno(r, "Failed to parse '%s' as signed 32bit integer: %m", v);
return log_error_errno(r, "Failed to parse '%s' as signed 32-bit integer: %m", v);
r = sd_bus_message_append_basic(m, t, &z);
break;
@@ -1527,7 +1527,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
r = safe_atou32(v, &z);
if (r < 0)
return log_error_errno(r, "Failed to parse '%s' as unsigned 32bit integer: %m", v);
return log_error_errno(r, "Failed to parse '%s' as unsigned 32-bit integer: %m", v);
r = sd_bus_message_append_basic(m, t, &z);
break;
@@ -1538,7 +1538,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
r = safe_atoi64(v, &z);
if (r < 0)
return log_error_errno(r, "Failed to parse '%s' as signed 64bit integer: %m", v);
return log_error_errno(r, "Failed to parse '%s' as signed 64-bit integer: %m", v);
r = sd_bus_message_append_basic(m, t, &z);
break;
@@ -1549,7 +1549,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
r = safe_atou64(v, &z);
if (r < 0)
return log_error_errno(r, "Failed to parse '%s' as unsigned 64bit integer: %m", v);
return log_error_errno(r, "Failed to parse '%s' as unsigned 64-bit integer: %m", v);
r = sd_bus_message_append_basic(m, t, &z);
break;
+1 -1
View File
@@ -70,7 +70,7 @@ static int add_lookup_instructions(
}
do {
/* Compare IPv4 with one word instruction (32bit) */
/* Compare IPv4 with one word instruction (32-bit) */
struct bpf_insn insn[] = {
/* If skb->protocol != ETH_P_IP, skip this whole block. The offset will be set later. */
BPF_JMP_IMM(BPF_JNE, BPF_REG_7, htobe16(protocol), 0),
+2 -2
View File
@@ -266,7 +266,7 @@ int bus_service_method_dump_file_descriptor_store(sd_bus_message *message, void
continue;
}
/* glibc implies O_LARGEFILE everywhere on 64bit off_t builds, but forgets to hide it away on
/* glibc implies O_LARGEFILE everywhere on 64-bit off_t builds, but forgets to hide it away on
* F_GETFL, but provides no definition to check for that. Let's mask the flag away manually,
* to not confuse clients. */
flags &= ~RAW_O_LARGEFILE;
@@ -307,7 +307,7 @@ static int property_get_size_as_uint32(
size_t *value = ASSERT_PTR(userdata);
uint32_t sz = *value >= UINT32_MAX ? UINT32_MAX : (uint32_t) *value;
/* Returns a size_t as a D-Bus "u" type, i.e. as 32bit value, even if size_t is 64bit. We'll saturate if it doesn't fit. */
/* Returns a size_t as a D-Bus "u" type, i.e. as 32-bit value, even if size_t is 64-bit. We'll saturate if it doesn't fit. */
return sd_bus_message_append_basic(reply, 'u', &sz);
}
+2 -2
View File
@@ -3272,7 +3272,7 @@ int manager_load_unit_from_dbus_path(Manager *m, const char *s, sd_bus_error *e,
if (r < 0)
return r;
/* Permit addressing units by invocation ID: if the passed bus path is suffixed by a 128bit ID then
/* Permit addressing units by invocation ID: if the passed bus path is suffixed by a 128-bit ID then
* we use it as invocation ID. */
r = sd_id128_from_string(n, &invocation_id);
if (r >= 0) {
@@ -4497,7 +4497,7 @@ static void manager_unref_uid_internal(
/* A generic implementation, covering both manager_unref_uid() and manager_unref_gid(), under the
* assumption that uid_t and gid_t are actually defined the same way, with the same validity rules.
*
* We store a hashmap where the key is the UID/GID and the value is a 32bit reference counter, whose
* We store a hashmap where the key is the UID/GID and the value is a 32-bit reference counter, whose
* highest bit is used as flag for marking UIDs/GIDs whose IPC objects to remove when the last
* reference to the UID/GID is dropped. The flag is set to on, once at least one reference from a
* unit where RemoveIPC= is set is added on a UID/GID. It is reset when the UID's/GID's reference
+1 -1
View File
@@ -52,7 +52,7 @@
#include "uid-alloc-range.h"
#include "user-util.h"
/* The maximum size up to which we process coredumps. We use 1G on 32bit systems, and 32G on 64bit systems */
/* The maximum size up to which we process coredumps. We use 1G on 32-bit systems, and 32G on 64-bit systems */
#if __SIZEOF_POINTER__ == 4
#define PROCESS_SIZE_MAX ((uint64_t) (1LLU*1024LLU*1024LLU*1024LLU))
#elif __SIZEOF_POINTER__ == 8
+1 -1
View File
@@ -394,7 +394,7 @@ static int parse_argv(int argc, char *argv[]) {
return log_error_errno(r, "Failed to parse root hash '%s': %m", optarg);
if (l < sizeof(sd_id128_t))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Root hash must be at least 128bit long: %s", optarg);
"Root hash must be at least 128-bit long: %s", optarg);
free_and_replace(arg_verity_settings.root_hash, p);
arg_verity_settings.root_hash_size = l;
+2 -2
View File
@@ -222,7 +222,7 @@ static int fscrypt_setup(
char **list;
int n;
/* Check if this xattr has the format 'trusted.fscrypt_slot<nr>' where '<nr>' is a 32bit unsigned integer */
/* Check if this xattr has the format 'trusted.fscrypt_slot<nr>' where '<nr>' is a 32-bit unsigned integer */
nr = startswith(xa, "trusted.fscrypt_slot");
if (!nr)
continue;
@@ -655,7 +655,7 @@ int home_passwd_fscrypt(
const char *nr;
uint32_t z;
/* Check if this xattr has the format 'trusted.fscrypt_slot<nr>' where '<nr>' is a 32bit unsigned integer */
/* Check if this xattr has the format 'trusted.fscrypt_slot<nr>' where '<nr>' is a 32-bit unsigned integer */
nr = startswith(xa, "trusted.fscrypt_slot");
if (!nr)
continue;
+1 -1
View File
@@ -226,7 +226,7 @@ static int make_home_userns(uid_t stored_uid, uid_t exposed_uid) {
return log_oom();
/* Leave everything else unmapped, starting from UID_NOBODY itself. Specifically, this means the
* whole space outside of 16bit remains unmapped */
* whole space outside of 16-bit remains unmapped */
log_debug("Creating userns with mapping:\n%s", text);
+1 -1
View File
@@ -156,7 +156,7 @@ static int help(void) {
return log_oom();
printf("%s [OPTIONS...] COMMAND\n\n"
"%sGenerate and print 128bit identifiers.%s\n"
"%sGenerate and print 128-bit identifiers.%s\n"
"\nCommands:\n"
" new Generate a new ID\n"
" machine-id Print the ID of current machine\n"
+2 -2
View File
@@ -81,7 +81,7 @@ int ndisc_router_parse(sd_ndisc *nd, sd_ndisc_router *rt) {
return log_ndisc_errno(nd, SYNTHETIC_ERRNO(EBADMSG),
"Too small to be a router advertisement, ignoring.");
/* Router advertisement packets are neatly aligned to 64bit boundaries, hence we can access them directly */
/* Router advertisement packets are neatly aligned to 64-bit boundaries, hence we can access them directly */
a = NDISC_ROUTER_RAW(rt);
if (a->nd_ra_type != ND_ROUTER_ADVERT)
@@ -93,7 +93,7 @@ int ndisc_router_parse(sd_ndisc *nd, sd_ndisc_router *rt) {
"Received ND packet with wrong RA code, ignoring.");
rt->hop_limit = a->nd_ra_curhoplimit;
rt->flags = a->nd_ra_flags_reserved; /* the first 8bit */
rt->flags = a->nd_ra_flags_reserved; /* the first 8 bits */
rt->lifetime = be16toh(a->nd_ra_router_lifetime);
rt->preference = (rt->flags >> 3) & 3;
+2 -2
View File
@@ -661,8 +661,8 @@ static int has_cap(sd_bus_creds *c, size_t offset, int capability) {
if ((unsigned) capability > lc)
return 0;
/* If the last cap is 63, then there are 64 caps defined, and we need 2 entries à 32bit hence. *
* If the last cap is 64, then there are 65 caps defined, and we need 3 entries à 32bit hence. */
/* If the last cap is 63, then there are 64 caps defined, and we need 2 entries à 32-bit hence. *
* If the last cap is 64, then there are 65 caps defined, and we need 3 entries à 32-bit hence. */
sz = DIV_ROUND_UP(lc+1, 32LU);
return !!(c->capability[offset * sz + CAP_TO_INDEX((uint32_t) capability)] & CAP_TO_MASK_CORRECTED((uint32_t) capability));
+7 -7
View File
@@ -225,11 +225,11 @@ static int message_append_field_string(
assert(m);
/* dbus only allows 8bit header field ids */
/* dbus only allows 8-bit header field ids */
if (h > 0xFF)
return -EINVAL;
/* dbus doesn't allow strings over 32bit */
/* dbus doesn't allow strings over 32-bit */
l = strlen(s);
if (l > UINT32_MAX)
return -EINVAL;
@@ -266,11 +266,11 @@ static int message_append_field_signature(
assert(m);
/* dbus only allows 8bit header field ids */
/* dbus only allows 8-bit header field ids */
if (h > 0xFF)
return -EINVAL;
/* dbus doesn't allow signatures over 8bit */
/* dbus doesn't allow signatures over 8-bit */
l = strlen(s);
if (l > SD_BUS_MAXIMUM_SIGNATURE_LENGTH)
return -EINVAL;
@@ -300,7 +300,7 @@ static int message_append_field_uint32(sd_bus_message *m, uint64_t h, uint32_t x
assert(m);
/* dbus only allows 8bit header field ids */
/* dbus only allows 8-bit header field ids */
if (h > 0xFF)
return -EINVAL;
@@ -322,7 +322,7 @@ static int message_append_field_uint32(sd_bus_message *m, uint64_t h, uint32_t x
static int message_append_reply_cookie(sd_bus_message *m, uint64_t cookie) {
assert(m);
/* 64bit cookies are not supported */
/* 64-bit cookies are not supported */
if (cookie > UINT32_MAX)
return -EOPNOTSUPP;
@@ -1203,7 +1203,7 @@ static void *message_extend_body(
padding = start_body - m->body_size;
added = padding + sz;
/* Check for 32bit overflows */
/* Check for 32-bit overflows */
if (end_body < start_body || end_body > UINT32_MAX) {
m->poisoned = true;
return NULL;
+1 -1
View File
@@ -918,7 +918,7 @@ static int bind_description(sd_bus *b, int fd, int family) {
(void) sd_bus_get_description(b, &d);
/* Generate a recognizable source address in the abstract namespace. We'll include:
* - a random 64bit value (to avoid collisions)
* - a random 64-bit value (to avoid collisions)
* - our "comm" process name (suppressed if contains "/" to avoid parsing issues)
* - the description string of the bus connection. */
(void) get_process_comm(0, &comm);
+1 -1
View File
@@ -1902,7 +1902,7 @@ _public_ int sd_bus_get_bus_id(sd_bus *bus, sd_id128_t *id) {
static uint64_t cookie_inc(uint64_t cookie) {
/* Stay within the 32bit range, since classic D-Bus can't deal with more */
/* Stay within the 32-bit range, since classic D-Bus can't deal with more */
if (cookie >= UINT32_MAX)
return COOKIE_CYCLED; /* Don't go back to zero, but use the highest bit for checking
* whether we are looping. */
+2 -2
View File
@@ -21,7 +21,7 @@ bool id128_is_valid(const char *s) {
l = strlen(s);
if (l == SD_ID128_STRING_MAX - 1)
/* Plain formatted 128bit hex string */
/* Plain formatted 128-bit hex string */
return in_charset(s, HEXDIGITS);
if (l == SD_ID128_UUID_STRING_MAX - 1) {
@@ -49,7 +49,7 @@ int id128_read_fd(int fd, Id128Flag f, sd_id128_t *ret) {
assert(fd >= 0);
/* Reads an 128bit ID from a file, which may either be in plain format (32 hex digits), or in UUID format, both
/* Reads an 128-bit ID from a file, which may either be in plain format (32 hex digits), or in UUID format, both
* optionally followed by a newline and nothing else. ID files should really be newline terminated, but if they
* aren't that's OK too, following the rule of "Be conservative in what you send, be liberal in what you
* accept".
+3 -3
View File
@@ -1062,7 +1062,7 @@ int journal_file_move_to_object(JournalFile *f, ObjectType type, uint64_t offset
/* Objects may only be located at multiple of 64 bit */
if (!VALID64(offset))
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
"Attempt to move to %s object at non-64bit boundary: %" PRIu64,
"Attempt to move to %s object at non-64-bit boundary: %" PRIu64,
journal_object_type_to_string(type),
offset);
@@ -1109,7 +1109,7 @@ int journal_file_read_object_header(JournalFile *f, ObjectType type, uint64_t of
/* Objects may only be located at multiple of 64 bit */
if (!VALID64(offset))
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
"Attempt to read %s object at non-64bit boundary: %" PRIu64,
"Attempt to read %s object at non-64-bit boundary: %" PRIu64,
journal_object_type_to_string(type), offset);
/* Object may not be located in the file header */
@@ -1880,7 +1880,7 @@ static int maybe_decompress_payload(
assert(f);
/* We can't read objects larger than 4G on a 32bit machine */
/* We can't read objects larger than 4G on a 32-bit machine */
if ((uint64_t) (size_t) size != size)
return -E2BIG;
+1 -1
View File
@@ -261,7 +261,7 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
/* Already includes a newline? Bummer, then
* let's write the variable name, then a
* newline, then the size (64bit LE), followed
* newline, then the size (64-bit LE), followed
* by the data and a final newline */
w[j++] = IOVEC_MAKE(iov[i].iov_base, c - (char*) iov[i].iov_base);
+1 -1
View File
@@ -1647,7 +1647,7 @@ static bool dirent_is_journal_subdir(const struct dirent *de) {
assert(de);
/* returns true if the specified directory entry looks like a directory that might contain journal
* files we might be interested in, i.e. is either a 128bit ID or a 128bit ID suffixed by a
* files we might be interested in, i.e. is either a 128-bit ID or a 128-bit ID suffixed by a
* namespace. */
if (!IN_SET(de->d_type, DT_DIR, DT_LNK, DT_UNKNOWN))
+2 -2
View File
@@ -211,10 +211,10 @@ static int shorten_ifname(char *ifname) {
if (naming_scheme_has(NAMING_NSPAWN_LONG_HASH)) {
uint64_t h;
/* Calculate 64bit hash value */
/* Calculate 64-bit hash value */
h = siphash24(ifname, strlen(ifname), SHORTEN_IFNAME_HASH_KEY.bytes);
/* Set the final four bytes (i.e. 32bit) to the lower 24bit of the hash, encoded in url-safe base64 */
/* Set the final four bytes (i.e. 32-bit) to the lower 24bit of the hash, encoded in url-safe base64 */
memcpy(new_ifname, ifname, IFNAMSIZ - 5);
new_ifname[IFNAMSIZ - 5] = urlsafe_base64char(h >> 18);
new_ifname[IFNAMSIZ - 4] = urlsafe_base64char(h >> 12);
+3 -3
View File
@@ -408,7 +408,7 @@ static int fd_patch_uid_internal(int fd, bool donate_fd, uid_t shift, uid_t rang
/* Recursively adjusts the UID/GIDs of all files of a directory tree. This is used to automatically fix up an
* OS tree to the used user namespace UID range. Note that this automatic adjustment only works for UID ranges
* following the concept that the upper 16bit of a UID identify the container, and the lower 16bit are the actual
* following the concept that the upper 16-bit of a UID identify the container, and the lower 16-bit are the actual
* UID within the container. */
if ((shift & 0xFFFF) != 0) {
@@ -423,7 +423,7 @@ static int fd_patch_uid_internal(int fd, bool donate_fd, uid_t shift, uid_t rang
}
if (range != 0x10000) {
/* We only support containers with 16bit UID ranges for the patching logic */
/* We only support containers with 16-bit UID ranges for the patching logic */
r = -EOPNOTSUPP;
goto finish;
}
@@ -440,7 +440,7 @@ static int fd_patch_uid_internal(int fd, bool donate_fd, uid_t shift, uid_t rang
}
/* Try to detect if the range is already right. Of course, this a pretty drastic optimization, as we assume
* that if the top-level dir has the right upper 16bit assigned, then everything below will have too... */
* that if the top-level dir has the right upper 16-bit assigned, then everything below will have too... */
if (((uint32_t) (st.st_uid ^ shift) >> 16) == 0)
return 0;
+1 -1
View File
@@ -1393,7 +1393,7 @@ static int parse_argv(int argc, char *argv[]) {
if (r < 0)
return log_error_errno(r, "Failed to parse root hash: %s", optarg);
if (l < sizeof(sd_id128_t))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Root hash must be at least 128bit long: %s", optarg);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Root hash must be at least 128-bit long: %s", optarg);
free_and_replace(arg_verity_settings.root_hash, k);
arg_verity_settings.root_hash_size = l;
+3 -3
View File
@@ -850,7 +850,7 @@ static int context_sum_weights(Context *context, FreeArea *a, uint64_t *ret) {
return 0;
overflow_sum:
return log_error_errno(SYNTHETIC_ERRNO(EOVERFLOW), "Combined weight of partition exceeds unsigned 64bit range, refusing.");
return log_error_errno(SYNTHETIC_ERRNO(EOVERFLOW), "Combined weight of partition exceeds unsigned 64-bit range, refusing.");
}
static uint64_t scale_by_weight(uint64_t value, uint64_t weight, uint64_t weight_sum) {
@@ -1590,7 +1590,7 @@ static int config_parse_uuid(
r = sd_id128_from_string(rvalue, &partition->new_uuid);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 128bit ID/UUID, ignoring: %s", rvalue);
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 128-bit ID/UUID, ignoring: %s", rvalue);
return 0;
}
@@ -5957,7 +5957,7 @@ static int help(void) {
" Enroll signed TPM2 PCR policy against PEM public key\n"
" --tpm2-public-key-pcrs=PCR1+PCR2+PCR3+…\n"
" Enroll signed TPM2 PCR policy for specified TPM2 PCRs\n"
" --seed=UUID 128bit seed UUID to derive all UUIDs from\n"
" --seed=UUID 128-bit seed UUID to derive all UUIDs from\n"
" --size=BYTES Grow loopback file to specified size\n"
" --json=pretty|short|off\n"
" Generate JSON output\n"
+1 -1
View File
@@ -44,7 +44,7 @@ assert_cc(sizeof(struct iphdr) == 20);
assert_cc(sizeof(struct udphdr) == 8);
assert_cc(sizeof(DnsPacketHeader) == 12);
/* The various DNS protocols deviate in how large a packet can grow, but the TCP transport has a 16bit size
/* The various DNS protocols deviate in how large a packet can grow, but the TCP transport has a 16-bit size
* field, hence that appears to be the absolute maximum. */
#define DNS_PACKET_SIZE_MAX 0xFFFFu
+2 -2
View File
@@ -19,7 +19,7 @@ assert_cc(sizeof(int) == sizeof(int32_t));
assert_cc(sizeof(unsigned) == sizeof(uint32_t));
#define bus_property_get_unsigned ((sd_bus_property_get_t) NULL)
/* On 64bit machines we can use the default serializer for size_t and
/* On 64-bit machines we can use the default serializer for size_t and
* friends, otherwise we need to cast this manually */
#if __SIZEOF_SIZE_T__ == 8
#define bus_property_get_size ((sd_bus_property_get_t) NULL)
@@ -36,7 +36,7 @@ int bus_property_get_ulong(sd_bus *bus, const char *path, const char *interface,
#endif
/* uid_t and friends on Linux 32 bit. This means we can just use the
* default serializer for 32bit unsigned, for serializing it, and map
* default serializer for 32-bit unsigned, for serializing it, and map
* it to NULL here */
assert_cc(sizeof(uid_t) == sizeof(uint32_t));
#define bus_property_get_uid ((sd_bus_property_get_t) NULL)
+2 -2
View File
@@ -953,12 +953,12 @@ int config_parse_id128(
r = sd_id128_from_string(rvalue, &t);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 128bit ID/UUID, ignoring: %s", rvalue);
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 128-bit ID/UUID, ignoring: %s", rvalue);
return 0;
}
if (sd_id128_is_null(t)) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "128bit ID/UUID is all 0, ignoring: %s", rvalue);
log_syntax(unit, LOG_WARNING, filename, line, 0, "128-bit ID/UUID is all 0, ignoring: %s", rvalue);
return 0;
}
+2 -2
View File
@@ -711,8 +711,8 @@ static int dissect_image(
sd_id128_t fsuuid, vuuid;
/* If a root hash is supplied, then we use the root partition that has a UUID that match the
* first 128bit of the root hash. And we use the verity partition that has a UUID that match
* the final 128bit. */
* first 128-bit of the root hash. And we use the verity partition that has a UUID that match
* the final 128-bit. */
if (verity->root_hash_size < sizeof(sd_id128_t))
return -EINVAL;
+6 -9
View File
@@ -85,12 +85,9 @@ int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags f
((unsigned) (n[1] - '0') * 10) +
((unsigned) (n[2] - '0'));
/* Don't allow anything that doesn't
* fit in 8bit. Note that we do allow
* control characters, as some servers
* (e.g. cloudflare) are happy to
* generate labels with them
* inside. */
/* Don't allow anything that doesn't fit in 8 bits. Note that we do allow
* control characters, as some servers (e.g. cloudflare) are happy to
* generate labels with them inside. */
if (k > 255)
return -EINVAL;
@@ -297,7 +294,7 @@ int dns_label_escape_new(const char *p, size_t l, char **ret) {
int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max) {
_cleanup_free_ uint32_t *input = NULL;
size_t input_size, l;
bool contains_8bit = false;
bool contains_8_bit = false;
char buffer[DNS_LABEL_MAX+1];
int r;
@@ -315,9 +312,9 @@ int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded
for (const char *p = encoded; p < encoded + encoded_size; p++)
if ((uint8_t) *p > 127)
contains_8bit = true;
contains_8_bit = true;
if (!contains_8bit) {
if (!contains_8_bit) {
if (encoded_size > DNS_LABEL_MAX)
return -EINVAL;
+1 -1
View File
@@ -9,7 +9,7 @@
* interface with this. */
typedef union JsonValue {
/* Encodes a simple value. This structure is generally 8 bytes wide (as double is 64bit). */
/* Encodes a simple value. This structure is generally 8 bytes wide (as double is 64-bit). */
bool boolean;
double real;
int64_t integer;
+1 -1
View File
@@ -21,7 +21,7 @@
In case you wonder why we have our own JSON implementation, here are a couple of reasons why this implementation has
benefits over various other implementations:
- We need support for 64bit signed and unsigned integers, i.e. the full 64,5bit range of -9223372036854775808…18446744073709551615
- We need support for 64-bit signed and unsigned integers, i.e. the full 64,5bit range of -9223372036854775808…18446744073709551615
- All our variants are immutable after creation
- Special values such as true, false, zero, null, empty strings, empty array, empty objects require zero dynamic memory
- Progressive parsing
+1 -1
View File
@@ -3972,7 +3972,7 @@ union bpf_attr {
*
* u64 bpf_jiffies64(void)
* Description
* Obtain the 64bit jiffies
* Obtain the 64-bit jiffies
* Return
* The 64 bit jiffies
*
+1 -1
View File
@@ -1093,7 +1093,7 @@ struct ethtool_rx_flow_spec {
/* How rings are laid out when accessing virtual functions or
* offloaded queues is device specific. To allow users to do flow
* steering and specify these queues the ring cookie is partitioned
* into a 32bit queue index with an 8 bit virtual function id.
* into a 32-bit queue index with an 8 bit virtual function id.
* This also leaves the 3bytes for further specifiers. It is possible
* future devices may support more than 256 virtual functions if
* devices start supporting PCIe w/ARI. However at the moment I
+2 -2
View File
@@ -6,9 +6,9 @@
#include <sys/types.h>
/* Wrapper around the QCMD() macro of linux/quota.h that removes some undefined behaviour. A typical quota
* command such as QCMD(Q_GETQUOTA, USRQUOTA) cannot be resolved on platforms where "int" is 32bit, as it is
* command such as QCMD(Q_GETQUOTA, USRQUOTA) cannot be resolved on platforms where "int" is 32-bit, as it is
* larger than INT_MAX. Yikes, because that are basically all platforms Linux supports. Let's add a wrapper
* that explicitly takes its arguments as unsigned 32bit, and then converts the shift result explicitly to
* that explicitly takes its arguments as unsigned 32-bit, and then converts the shift result explicitly to
* int, acknowledging the undefined behaviour of the kernel headers. This doesn't remove the undefined
* behaviour, but it stops ubsan from complaining about it. */
static inline int QCMD_FIXED(uint32_t cmd, uint32_t type) {
+1 -1
View File
@@ -13,7 +13,7 @@
* to write our own implementation relatively easily. However, the main reasons are these:
*
* • We want to use our own JSON subsystem, with all the benefits that brings (i.e. accurate unsigned+signed
* 64bit integers, full fuzzing, logging during parsing and so on). If we'd want to use that with
* 64-bit integers, full fuzzing, logging during parsing and so on). If we'd want to use that with
* libvarlink we'd have to serialize and deserialize all the time from its own representation which is
* inefficient and nasty.
*
+1 -1
View File
@@ -99,7 +99,7 @@ typedef void (*_sd_destroy_t)(void *userdata);
} \
struct _sd_useless_struct_to_allow_trailing_semicolon_
/* The following macro should be used in all public enums, to force 64bit wideness on them, so that we can
/* The following macro should be used in all public enums, to force 64-bit wideness on them, so that we can
* freely extend them later on, without breaking compatibility. */
#define _SD_ENUM_FORCE_S64(id) \
_SD_##id##_INT64_MIN = INT64_MIN, \
+1 -1
View File
@@ -64,7 +64,7 @@ static int fdisk_partition_get_attrs_as_uint64(
continue;
}
if (u >= sizeof(flags)*8) { /* partition flags on GPT are 64bit. Let's ignore any further
if (u >= sizeof(flags)*8) { /* partition flags on GPT are 64-bit. Let's ignore any further
bits should libfdisk report them */
log_debug("Partition flag above bit 63 (%s), ignoring.", word);
continue;
+3 -3
View File
@@ -229,7 +229,7 @@ static void test_apply_ambient_caps(void) {
assert_se(prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET, CAP_CHOWN, 0, 0) == 0);
}
static void test_ensure_cap_64bit(void) {
static void test_ensure_cap_64_bit(void) {
_cleanup_free_ char *content = NULL;
unsigned long p = 0;
int r;
@@ -241,7 +241,7 @@ static void test_ensure_cap_64bit(void) {
assert_se(safe_atolu(content, &p) >= 0);
/* If caps don't fit into 64bit anymore, we have a problem, fail the test. */
/* If caps don't fit into 64-bit anymore, we have a problem, fail the test. */
assert_se(p <= 63);
/* Also check for the header definition */
@@ -303,7 +303,7 @@ int main(int argc, char *argv[]) {
test_setup_logging(LOG_DEBUG);
test_ensure_cap_64bit();
test_ensure_cap_64_bit();
test_last_cap_file();
test_last_cap_probe();
+1 -1
View File
@@ -25,7 +25,7 @@ TEST(parse_devnum) {
}
TEST(device_major_minor_valid) {
/* on glibc dev_t is 64bit, even though in the kernel it is only 32bit */
/* on glibc dev_t is 64-bit, even though in the kernel it is only 32-bit */
assert_cc(sizeof(dev_t) == sizeof(uint64_t));
assert_se(DEVICE_MAJOR_VALID(0U));
+1 -1
View File
@@ -79,7 +79,7 @@ static double ts_to_d(const struct timespec *ts) {
}
static uint32_t graceful_add_offset_1900_1970(time_t t) {
/* Adds OFFSET_1900_1970 to t and returns it as 32bit value. This is handles overflows
/* Adds OFFSET_1900_1970 to t and returns it as 32-bit value. This is handles overflows
* gracefully in a deterministic and well-defined way by cutting off the top bits. */
uint64_t a = (uint64_t) t + OFFSET_1900_1970;
return (uint32_t) (a & UINT64_C(0xFFFFFFFF));