From 19c1736b607cf07af1e272ef5638ff0d90b4faff Mon Sep 17 00:00:00 2001 From: Scott Soule Cheloha Date: Tue, 17 Oct 2023 00:04:03 +0000 Subject: clockintr: move callback-specific API behaviors to "clockrequest" namespace The API's behavior when invoked from a callback function is impossible to document. Move the special behavior into a distinct namespace, "clockrequest". - Add a 'struct clockrequest'. Basically a stripped-down 'struct clockintr' for exclusive use during clockintr_dispatch(). - In clockintr_queue, replace the "cq_shadow" clockintr with a "cq_request" clockrequest. They serve the same purpose. - CLST_SHADOW_PENDING -> CR_RESCHEDULE; different namespace, same meaning. - CLST_IGNORE_SHADOW -> CLST_IGNORE_REQUEST; same meaning. - Move shadow branch in clockintr_advance() to clockrequest_advance(). - clockintr_request_random() becomes clockrequest_advance_random(). - Delete dead shadow branches in clockintr_cancel(), clockintr_schedule(). - Callback functions now get a clockrequest pointer instead of a special clockintr pointer: update all prototypes, callers. No functional change intended. --- sys/kern/kern_time.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/kern/kern_time.c') diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 1687ee61d14..052c6316fd4 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_time.c,v 1.166 2023/09/10 03:08:05 cheloha Exp $ */ +/* $OpenBSD: kern_time.c,v 1.167 2023/10/17 00:04:02 cheloha Exp $ */ /* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */ /* @@ -755,7 +755,7 @@ itimerdecr(struct itimerspec *itp, const struct timespec *decrement) } void -itimer_update(struct clockintr *cl, void *cf, void *arg) +itimer_update(struct clockrequest *cr, void *cf, void *arg) { struct timespec elapsed; uint64_t nsecs; @@ -770,7 +770,7 @@ itimer_update(struct clockintr *cl, void *cf, void *arg) if (!ISSET(pr->ps_flags, PS_ITIMER)) return; - nsecs = clockintr_advance(cl, hardclock_period) * hardclock_period; + nsecs = clockrequest_advance(cr, hardclock_period) * hardclock_period; NSEC_TO_TIMESPEC(nsecs, &elapsed); mtx_enter(&itimer_mtx); -- cgit v1.2.3