diff options
author | cheloha <cheloha@cvs.openbsd.org> | 2021-06-19 02:05:34 +0000 |
---|---|---|
committer | cheloha <cheloha@cvs.openbsd.org> | 2021-06-19 02:05:34 +0000 |
commit | 98e53288af3f8d26f92eb4e1e59f82352fa7e37c (patch) | |
tree | 28fbe4b2cb7191f86aa76398329f796b756c705f | |
parent | dda31a02861de22db9002697f4dbe04910f33763 (diff) |
timeout(9): change argument order for timeout_set_kclock()
Move the kclock argument before the flags argument. XORing a bunch of
flags together may "sprawl", and I'd rather have any sprawl at the end
of the parameter list.
timeout_set_kclock() is undocumented and there is only one caller, so
no big refactor required.
Best to do this argument order shuffle before any bigger refactors of
e.g. timeout_set(9).
-rw-r--r-- | sys/kern/kern_fork.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_timeout.c | 18 | ||||
-rw-r--r-- | sys/sys/timeout.h | 22 |
3 files changed, 23 insertions, 23 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 9ae645f2ac2..1e51f71301a 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.235 2021/03/23 10:30:40 mpi Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.236 2021/06/19 02:05:33 cheloha Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -201,8 +201,8 @@ process_initialize(struct process *pr, struct proc *p) rw_init(&pr->ps_lock, "pslock"); mtx_init(&pr->ps_mtx, IPL_MPFLOOR); - timeout_set_kclock(&pr->ps_realit_to, realitexpire, pr, 0, - KCLOCK_UPTIME); + timeout_set_kclock(&pr->ps_realit_to, realitexpire, pr, + KCLOCK_UPTIME, 0); timeout_set(&pr->ps_rucheck_to, rucheck, pr); } diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 882560f6cda..199dd3357a9 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_timeout.c,v 1.84 2021/05/11 13:29:25 cheloha Exp $ */ +/* $OpenBSD: kern_timeout.c,v 1.85 2021/06/19 02:05:33 cheloha Exp $ */ /* * Copyright (c) 2001 Thomas Nordin <nordin@openbsd.org> * Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org> @@ -253,38 +253,38 @@ timeout_proc_init(void) } static inline void -_timeout_set(struct timeout *to, void (*fn)(void *), void *arg, int flags, - int kclock) +_timeout_set(struct timeout *to, void (*fn)(void *), void *arg, int kclock, + int flags) { to->to_func = fn; to->to_arg = arg; - to->to_flags = flags | TIMEOUT_INITIALIZED; to->to_kclock = kclock; + to->to_flags = flags | TIMEOUT_INITIALIZED; } void timeout_set(struct timeout *new, void (*fn)(void *), void *arg) { - _timeout_set(new, fn, arg, 0, KCLOCK_NONE); + _timeout_set(new, fn, arg, KCLOCK_NONE, 0); } void timeout_set_flags(struct timeout *to, void (*fn)(void *), void *arg, int flags) { - _timeout_set(to, fn, arg, flags, KCLOCK_NONE); + _timeout_set(to, fn, arg, KCLOCK_NONE, flags); } void timeout_set_proc(struct timeout *new, void (*fn)(void *), void *arg) { - _timeout_set(new, fn, arg, TIMEOUT_PROC, KCLOCK_NONE); + _timeout_set(new, fn, arg, KCLOCK_NONE, TIMEOUT_PROC); } void timeout_set_kclock(struct timeout *to, void (*fn)(void *), void *arg, - int flags, int kclock) + int kclock, int flags) { - _timeout_set(to, fn, arg, flags | TIMEOUT_KCLOCK, kclock); + _timeout_set(to, fn, arg, kclock, flags | TIMEOUT_KCLOCK); } int diff --git a/sys/sys/timeout.h b/sys/sys/timeout.h index 1a4fa81b952..d5dea082e7a 100644 --- a/sys/sys/timeout.h +++ b/sys/sys/timeout.h @@ -1,4 +1,4 @@ -/* $OpenBSD: timeout.h,v 1.41 2021/05/29 01:32:49 cheloha Exp $ */ +/* $OpenBSD: timeout.h,v 1.42 2021/06/19 02:05:33 cheloha Exp $ */ /* * Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org> * All rights reserved. @@ -88,24 +88,24 @@ int timeout_sysctl(void *, size_t *, void *, size_t); #define KCLOCK_UPTIME 0 /* uptime clock; time since boot */ #define KCLOCK_MAX 1 -#define __TIMEOUT_INITIALIZER(fn, arg, flags, kclock) { \ +#define __TIMEOUT_INITIALIZER(_fn, _arg, _kclock, _flags) { \ .to_list = { NULL, NULL }, \ .to_abstime = { .tv_sec = 0, .tv_nsec = 0 }, \ - .to_func = (fn), \ - .to_arg = (arg), \ + .to_func = (_fn), \ + .to_arg = (_arg), \ .to_time = 0, \ - .to_flags = (flags) | TIMEOUT_INITIALIZED, \ - .to_kclock = (kclock) \ + .to_flags = (_flags) | TIMEOUT_INITIALIZED, \ + .to_kclock = (_kclock) \ } -#define TIMEOUT_INITIALIZER_KCLOCK(fn, arg, flags, kclock) \ - __TIMEOUT_INITIALIZER((fn), (args), (flags) | TIMEOUT_KCLOCK, (kclock)) +#define TIMEOUT_INITIALIZER_KCLOCK(_fn, _arg, _kclock, _flags) \ + __TIMEOUT_INITIALIZER((_fn), (_args), (_kclock), (_flags) | TIMEOUT_KCLOCK) -#define TIMEOUT_INITIALIZER_FLAGS(fn, arg, flags) \ - __TIMEOUT_INITIALIZER((fn), (args), (flags), KCLOCK_NONE) +#define TIMEOUT_INITIALIZER_FLAGS(_fn, _arg, _flags) \ + __TIMEOUT_INITIALIZER((_fn), (_args), KCLOCK_NONE, (_flags)) #define TIMEOUT_INITIALIZER(_f, _a) \ - __TIMEOUT_INITIALIZER((_f), (_a), 0, KCLOCK_NONE) + __TIMEOUT_INITIALIZER((_f), (_a), KCLOCK_NONE, 0) void timeout_set(struct timeout *, void (*)(void *), void *); void timeout_set_flags(struct timeout *, void (*)(void *), void *, int); |