From 8a8b133b87d4e121194159e70672d4159b74fd27 Mon Sep 17 00:00:00 2001 From: cheloha Date: Wed, 6 Sep 2023 02:33:18 +0000 Subject: [PATCH] clockintr: replace u_int with standard types The clockintr code already uses uint64_t everywhere, so we may as well be consistent: replace u_int with uint32_t everywhere it is trivial to do so; leave the sysctl(2) hook and ddb(4) code alone for now. Suggested by mpi@. ok mpi@ --- sys/kern/kern_clockintr.c | 13 +++++++------ sys/sys/clockintr.h | 14 +++++++------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c index 40a0c5a0412..70abd291f06 100644 --- a/sys/kern/kern_clockintr.c +++ b/sys/kern/kern_clockintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clockintr.c,v 1.37 2023/09/06 02:09:58 cheloha Exp $ */ +/* $OpenBSD: kern_clockintr.c,v 1.38 2023/09/06 02:33:18 cheloha Exp $ */ /* * Copyright (c) 2003 Dale Rahn * Copyright (c) 2020 Mark Kettenis @@ -36,7 +36,7 @@ * * I Immutable after initialization. */ -u_int clockintr_flags; /* [I] global state + behavior flags */ +uint32_t clockintr_flags; /* [I] global state + behavior flags */ uint32_t hardclock_period; /* [I] hardclock period (ns) */ uint32_t statclock_avg; /* [I] average statclock period (ns) */ uint32_t statclock_min; /* [I] minimum statclock period (ns) */ @@ -58,7 +58,7 @@ uint64_t nsec_advance(uint64_t *, uint64_t, uint64_t); * Initialize global state. Set flags and compute intervals. */ void -clockintr_init(u_int flags) +clockintr_init(uint32_t flags) { uint32_t half_avg, var; @@ -219,7 +219,7 @@ clockintr_dispatch(void *frame) struct cpu_info *ci = curcpu(); struct clockintr *cl; struct clockintr_queue *cq = &ci->ci_queue; - u_int ogen; + uint32_t ogen; if (cq->cq_dispatch != 0) panic("%s: recursive dispatch", __func__); @@ -469,7 +469,8 @@ clockintr_schedule_locked(struct clockintr *cl, uint64_t expiration) } void -clockintr_stagger(struct clockintr *cl, uint64_t period, u_int n, u_int count) +clockintr_stagger(struct clockintr *cl, uint64_t period, uint32_t n, + uint32_t count) { struct clockintr_queue *cq = cl->cl_queue; @@ -589,7 +590,7 @@ sysctl_clockintr(int *name, u_int namelen, void *oldp, size_t *oldlenp, struct clockintr_queue *cq; struct cpu_info *ci; CPU_INFO_ITERATOR cii; - u_int gen; + uint32_t gen; if (namelen != 1) return ENOTDIR; diff --git a/sys/sys/clockintr.h b/sys/sys/clockintr.h index b886eff2621..ea7c2ea0624 100644 --- a/sys/sys/clockintr.h +++ b/sys/sys/clockintr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: clockintr.h,v 1.11 2023/09/06 02:09:58 cheloha Exp $ */ +/* $OpenBSD: clockintr.h,v 1.12 2023/09/06 02:33:18 cheloha Exp $ */ /* * Copyright (c) 2020-2022 Scott Cheloha * @@ -72,7 +72,7 @@ struct clockintr { TAILQ_ENTRY(clockintr) cl_plink; /* [m] cq_pend glue */ void (*cl_func)(struct clockintr *, void *); /* [I] callback */ struct clockintr_queue *cl_queue; /* [I] parent queue */ - u_int cl_flags; /* [m] CLST_* flags */ + uint32_t cl_flags; /* [m] CLST_* flags */ }; #define CLST_PENDING 0x00000001 /* scheduled to run */ @@ -100,9 +100,9 @@ struct clockintr_queue { struct clockintr *cq_statclock; /* [o] statclock handle */ struct intrclock cq_intrclock; /* [I] local interrupt clock */ struct clockintr_stat cq_stat; /* [o] dispatch statistics */ - volatile u_int cq_gen; /* [o] cq_stat update generation */ - volatile u_int cq_dispatch; /* [o] dispatch is running */ - u_int cq_flags; /* [I] CQ_* flags; see below */ + volatile uint32_t cq_gen; /* [o] cq_stat update generation */ + volatile uint32_t cq_dispatch; /* [o] dispatch is running */ + uint32_t cq_flags; /* [I] CQ_* flags; see below */ }; #define CQ_INIT 0x00000001 /* clockintr_cpu_init() done */ @@ -119,7 +119,7 @@ struct clockintr_queue { void clockintr_cpu_init(const struct intrclock *); int clockintr_dispatch(void *); -void clockintr_init(u_int); +void clockintr_init(uint32_t); void clockintr_trigger(void); /* @@ -130,7 +130,7 @@ uint64_t clockintr_advance(struct clockintr *, uint64_t); void clockintr_cancel(struct clockintr *); struct clockintr *clockintr_establish(struct cpu_info *, void (*)(struct clockintr *, void *)); -void clockintr_stagger(struct clockintr *, uint64_t, u_int, u_int); +void clockintr_stagger(struct clockintr *, uint64_t, uint32_t, uint32_t); void clockqueue_init(struct clockintr_queue *); int sysctl_clockintr(int *, u_int, void *, size_t *, void *, size_t); -- 2.20.1