summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2009-06-02 22:05:55 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2009-06-02 22:05:55 +0000
commit6e04978c7e3739302d4ccea71b6ea1f7b31259ae (patch)
tree7a01883f2be33c5c9f6500a6abf03e094afc250b /sys
parent1fba9f48387d03cee6ca93ba2eae4d56f81c0721 (diff)
Constipate the second argument to timeout_add_*(). Also, use
nitems() in two places instead of coding the array size and fix a spot of whitespace. ok miod@ blambert@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_timeout.c12
-rw-r--r--sys/sys/timeout.h11
2 files changed, 12 insertions, 11 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index 4e385102d97..be87d0fc789 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_timeout.c,v 1.30 2009/03/03 19:09:13 miod Exp $ */
+/* $OpenBSD: kern_timeout.c,v 1.31 2009/06/02 22:05:54 guenther Exp $ */
/*
* Copyright (c) 2001 Thomas Nordin <nordin@openbsd.org>
* Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org>
@@ -138,7 +138,7 @@ timeout_startup(void)
int b;
CIRCQ_INIT(&timeout_todo);
- for (b = 0; b < BUCKETS; b++)
+ for (b = 0; b < nitems(timeout_wheel); b++)
CIRCQ_INIT(&timeout_wheel[b]);
}
@@ -187,7 +187,7 @@ timeout_add(struct timeout *new, int to_ticks)
}
void
-timeout_add_tv(struct timeout *to, struct timeval *tv)
+timeout_add_tv(struct timeout *to, const struct timeval *tv)
{
long long to_ticks;
@@ -199,7 +199,7 @@ timeout_add_tv(struct timeout *to, struct timeval *tv)
}
void
-timeout_add_ts(struct timeout *to, struct timespec *ts)
+timeout_add_ts(struct timeout *to, const struct timespec *ts)
{
long long to_ticks;
@@ -211,7 +211,7 @@ timeout_add_ts(struct timeout *to, struct timespec *ts)
}
void
-timeout_add_bt(struct timeout *to, struct bintime *bt)
+timeout_add_bt(struct timeout *to, const struct bintime *bt)
{
long long to_ticks;
@@ -370,7 +370,7 @@ db_show_callout(db_expr_t addr, int haddr, db_expr_t count, char *modif)
db_printf(" ticks wheel arg func\n");
db_show_callout_bucket(&timeout_todo);
- for (b = 0; b < BUCKETS; b++)
+ for (b = 0; b < nitems(timeout_wheel); b++)
db_show_callout_bucket(&timeout_wheel[b]);
}
#endif
diff --git a/sys/sys/timeout.h b/sys/sys/timeout.h
index 8350029fcdb..b0d4d4ad3cc 100644
--- a/sys/sys/timeout.h
+++ b/sys/sys/timeout.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: timeout.h,v 1.18 2008/10/22 08:38:06 blambert Exp $ */
+/* $OpenBSD: timeout.h,v 1.19 2009/06/02 22:05:54 guenther Exp $ */
/*
* Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -69,7 +69,8 @@ struct timeout {
*/
#define TIMEOUT_ONQUEUE 2 /* timeout is on the todo queue */
#define TIMEOUT_INITIALIZED 4 /* timeout is initialized */
-#define TIMEOUT_TRIGGERED 8 /* timeout is running or ran */
+#define TIMEOUT_TRIGGERED 8 /* timeout is running or ran */
+
/*
* special macros
*
@@ -83,9 +84,9 @@ struct timeout {
#ifdef _KERNEL
void timeout_set(struct timeout *, void (*)(void *), void *);
void timeout_add(struct timeout *, int);
-void timeout_add_tv(struct timeout *, struct timeval *);
-void timeout_add_ts(struct timeout *, struct timespec *);
-void timeout_add_bt(struct timeout *, struct bintime *);
+void timeout_add_tv(struct timeout *, const struct timeval *);
+void timeout_add_ts(struct timeout *, const struct timespec *);
+void timeout_add_bt(struct timeout *, const struct bintime *);
void timeout_add_sec(struct timeout *, int);
void timeout_add_msec(struct timeout *, int);
void timeout_add_usec(struct timeout *, int);