git: 2cee5861898d - main - sys/kern: Use C99 fixed-width integer types.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 28 Dec 2021 17:51:05 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2cee5861898daea5bbc2427d0e67d15559564683 commit 2cee5861898daea5bbc2427d0e67d15559564683 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2021-12-28 17:41:08 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2021-12-28 17:41:08 +0000 sys/kern: Use C99 fixed-width integer types. No functional change. Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D33630 --- sys/kern/kern_syscalls.c | 6 +++--- sys/kern/md4c.c | 4 ++-- sys/kern/md5c.c | 28 ++++++++++++++-------------- sys/kern/subr_atomic64.c | 22 +++++++++++----------- sys/kern/subr_busdma_bufalloc.c | 2 +- sys/kern/vfs_lookup.c | 2 +- sys/kern/vfs_syscalls.c | 4 ++-- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/sys/kern/kern_syscalls.c b/sys/kern/kern_syscalls.c index b4fec879708a..4b191eabbe04 100644 --- a/sys/kern/kern_syscalls.c +++ b/sys/kern/kern_syscalls.c @@ -66,7 +66,7 @@ lkmressys(struct thread *td, struct nosys_args *args) static void syscall_thread_drain(struct sysent *se) { - u_int32_t cnt, oldcnt; + uint32_t cnt, oldcnt; do { oldcnt = se->sy_thrcnt; @@ -82,7 +82,7 @@ syscall_thread_drain(struct sysent *se) int syscall_thread_enter(struct thread *td, struct sysent *se) { - u_int32_t cnt, oldcnt; + uint32_t cnt, oldcnt; KASSERT((se->sy_thrcnt & SY_THR_STATIC) == 0, ("%s: not a static syscall", __func__)); @@ -99,7 +99,7 @@ syscall_thread_enter(struct thread *td, struct sysent *se) void syscall_thread_exit(struct thread *td, struct sysent *se) { - u_int32_t cnt, oldcnt; + uint32_t cnt, oldcnt; KASSERT((se->sy_thrcnt & SY_THR_STATIC) == 0, ("%s: not a static syscall", __func__)); diff --git a/sys/kern/md4c.c b/sys/kern/md4c.c index 68d19485b433..86d6a5a2c7f7 100644 --- a/sys/kern/md4c.c +++ b/sys/kern/md4c.c @@ -33,8 +33,8 @@ __FBSDID("$FreeBSD$"); #include <sys/md4.h> typedef unsigned char *POINTER; -typedef u_int16_t UINT2; -typedef u_int32_t UINT4; +typedef uint16_t UINT2; +typedef uint32_t UINT4; #define PROTO_LIST(list) list diff --git a/sys/kern/md5c.c b/sys/kern/md5c.c index 3e0165a45337..175bd38aeee1 100644 --- a/sys/kern/md5c.c +++ b/sys/kern/md5c.c @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include <sys/endian.h> #include <sys/md5.h> -static void MD5Transform(u_int32_t [4], const unsigned char [64]); +static void MD5Transform(uint32_t [4], const unsigned char [64]); #if (BYTE_ORDER == LITTLE_ENDIAN) #define Encode memcpy @@ -52,12 +52,12 @@ static void MD5Transform(u_int32_t [4], const unsigned char [64]); #else /* - * Encodes input (u_int32_t) into output (unsigned char). Assumes len is + * Encodes input (uint32_t) into output (unsigned char). Assumes len is * a multiple of 4. */ static void -Encode (unsigned char *output, u_int32_t *input, unsigned int len) +Encode (unsigned char *output, uint32_t *input, unsigned int len) { unsigned int i; uint32_t ip; @@ -72,12 +72,12 @@ Encode (unsigned char *output, u_int32_t *input, unsigned int len) } /* - * Decodes input (unsigned char) into output (u_int32_t). Assumes len is + * Decodes input (unsigned char) into output (uint32_t). Assumes len is * a multiple of 4. */ static void -Decode (u_int32_t *output, const unsigned char *input, unsigned int len) +Decode (uint32_t *output, const unsigned char *input, unsigned int len) { unsigned int i; @@ -108,22 +108,22 @@ static unsigned char PADDING[64] = { * Rotation is separate from addition to prevent recomputation. */ #define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } @@ -163,10 +163,10 @@ MD5Update (context, in, inputLen) index = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ - if ((context->count[0] += ((u_int32_t)inputLen << 3)) - < ((u_int32_t)inputLen << 3)) + if ((context->count[0] += ((uint32_t)inputLen << 3)) + < ((uint32_t)inputLen << 3)) context->count[1]++; - context->count[1] += ((u_int32_t)inputLen >> 29); + context->count[1] += ((uint32_t)inputLen >> 29); partLen = 64 - index; @@ -233,10 +233,10 @@ MD5Final(unsigned char digest[static MD5_DIGEST_LENGTH], MD5_CTX *context) static void MD5Transform (state, block) - u_int32_t state[4]; + uint32_t state[4]; const unsigned char block[64]; { - u_int32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); diff --git a/sys/kern/subr_atomic64.c b/sys/kern/subr_atomic64.c index 5dffb161e8f2..66d2d4924d35 100644 --- a/sys/kern/subr_atomic64.c +++ b/sys/kern/subr_atomic64.c @@ -80,8 +80,8 @@ static struct mtx a64_mtx_pool[A64_POOL_SIZE]; #define ATOMIC64_EMU_UN(op, rt, block, ret) \ rt \ - atomic_##op##_64(volatile u_int64_t *p) { \ - u_int64_t tmp __unused; \ + atomic_##op##_64(volatile uint64_t *p) { \ + uint64_t tmp __unused; \ LOCK_A64(); \ block; \ UNLOCK_A64(); \ @@ -89,8 +89,8 @@ static struct mtx a64_mtx_pool[A64_POOL_SIZE]; #define ATOMIC64_EMU_BIN(op, rt, block, ret) \ rt \ - atomic_##op##_64(volatile u_int64_t *p, u_int64_t v) { \ - u_int64_t tmp __unused; \ + atomic_##op##_64(volatile uint64_t *p, uint64_t v) { \ + uint64_t tmp __unused; \ LOCK_A64(); \ block; \ UNLOCK_A64(); \ @@ -98,16 +98,16 @@ static struct mtx a64_mtx_pool[A64_POOL_SIZE]; ATOMIC64_EMU_BIN(add, void, (*p = *p + v), return); ATOMIC64_EMU_BIN(clear, void, *p &= ~v, return); -ATOMIC64_EMU_BIN(fetchadd, u_int64_t, (*p = *p + v, v = *p - v), return (v)); -ATOMIC64_EMU_UN(load, u_int64_t, (tmp = *p), return (tmp)); +ATOMIC64_EMU_BIN(fetchadd, uint64_t, (*p = *p + v, v = *p - v), return (v)); +ATOMIC64_EMU_UN(load, uint64_t, (tmp = *p), return (tmp)); ATOMIC64_EMU_BIN(set, void, *p |= v, return); ATOMIC64_EMU_BIN(subtract, void, (*p = *p - v), return); ATOMIC64_EMU_BIN(store, void, *p = v, return); -ATOMIC64_EMU_BIN(swap, u_int64_t, tmp = *p; *p = v; v = tmp, return(v)); +ATOMIC64_EMU_BIN(swap, uint64_t, tmp = *p; *p = v; v = tmp, return(v)); -int atomic_cmpset_64(volatile u_int64_t *p, u_int64_t old, u_int64_t new) +int atomic_cmpset_64(volatile uint64_t *p, uint64_t old, uint64_t new) { - u_int64_t tmp; + uint64_t tmp; LOCK_A64(); tmp = *p; @@ -118,9 +118,9 @@ int atomic_cmpset_64(volatile u_int64_t *p, u_int64_t old, u_int64_t new) return (tmp == old); } -int atomic_fcmpset_64(volatile u_int64_t *p, u_int64_t *old, u_int64_t new) +int atomic_fcmpset_64(volatile uint64_t *p, uint64_t *old, uint64_t new) { - u_int64_t tmp, tmp_old; + uint64_t tmp, tmp_old; LOCK_A64(); tmp = *p; diff --git a/sys/kern/subr_busdma_bufalloc.c b/sys/kern/subr_busdma_bufalloc.c index fea141908399..f201cde51519 100644 --- a/sys/kern/subr_busdma_bufalloc.c +++ b/sys/kern/subr_busdma_bufalloc.c @@ -74,7 +74,7 @@ struct busdma_bufalloc { busdma_bufalloc_t busdma_bufalloc_create(const char *name, bus_size_t minimum_alignment, - uma_alloc alloc_func, uma_free free_func, u_int32_t zcreate_flags) + uma_alloc alloc_func, uma_free free_func, uint32_t zcreate_flags) { struct busdma_bufalloc *ba; struct busdma_bufzone *bz; diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index d05e1658a004..e91a43572cbd 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1618,7 +1618,7 @@ void NDVALIDATE(struct nameidata *ndp) { struct componentname *cnp; - u_int64_t used, orig; + uint64_t used, orig; cnp = &ndp->ni_cnd; orig = cnp->cn_origflags; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 00da4e7c1b07..3e0b96051465 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -114,7 +114,7 @@ static int kern_linkat_vp(struct thread *td, struct vnode *vp, int fd, static uint64_t at2cnpflags(u_int at_flags, u_int mask) { - u_int64_t res; + uint64_t res; MPASS((at_flags & (AT_SYMLINK_FOLLOW | AT_SYMLINK_NOFOLLOW)) != (AT_SYMLINK_FOLLOW | AT_SYMLINK_NOFOLLOW)); @@ -3665,7 +3665,7 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, struct mount *mp = NULL; struct vnode *tvp, *fvp, *tdvp; struct nameidata fromnd, tond; - u_int64_t tondflags; + uint64_t tondflags; int error; again: