sys/kern: Use C99 fixed-width integer types.

No functional change.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D33630
This commit is contained in:
John Baldwin 2021-12-28 09:41:08 -08:00
parent 4287aa5619
commit 2cee586189
7 changed files with 34 additions and 34 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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: