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-01 15:33:20 -06:00
committed by Luca Boccassi
parent 221332ee13
commit da89046643
83 changed files with 221 additions and 224 deletions

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

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;

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

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)];
};

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

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);

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));

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 \

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 */

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)

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;

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))

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);