summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2000-09-07 19:07:01 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2000-09-07 19:07:01 +0000
commit7ce06972c458e872f1399dbb47aa1412aa8497f2 (patch)
treed58106b316088a7ff9d1a26aeb6e235b07e6592d /sys
parent5ebd98436ed890ed5e2a60af5b9cafb79a7a82ac (diff)
Put powerhooks on a CIRCLEQ instead of LIST.
Use FOREACH macros instead of walking the list manually.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_subr.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index d9f735b6109..a26346a3ef2 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_subr.c,v 1.14 2000/09/07 18:39:13 art Exp $ */
+/* $OpenBSD: kern_subr.c,v 1.15 2000/09/07 19:07:00 art Exp $ */
/* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */
/*
@@ -262,12 +262,13 @@ doshutdownhooks()
*/
struct powerhook_desc {
- LIST_ENTRY(powerhook_desc) sfd_list;
+ CIRCLEQ_ENTRY(powerhook_desc) sfd_list;
void (*sfd_fn) __P((int, void *));
void *sfd_arg;
};
-LIST_HEAD(, powerhook_desc) powerhook_list;
+CIRCLEQ_HEAD(, powerhook_desc) powerhook_list =
+ CIRCLEQ_HEAD_INITIALIZER(powerhook_list);
void *
powerhook_establish(fn, arg)
@@ -283,7 +284,7 @@ powerhook_establish(fn, arg)
ndp->sfd_fn = fn;
ndp->sfd_arg = arg;
- LIST_INSERT_HEAD(&powerhook_list, ndp, sfd_list);
+ CIRCLEQ_INSERT_HEAD(&powerhook_list, ndp, sfd_list);
return (ndp);
}
@@ -295,15 +296,15 @@ powerhook_disestablish(vhook)
#ifdef DIAGNOSTIC
struct powerhook_desc *dp;
- for (dp = powerhook_list.lh_first; dp != NULL;
- dp = dp->sfd_list.le_next)
+ CIRCLEQ_FOREACH(dp, &powerhook_list, sfd_list)
if (dp == vhook)
break;
if (dp == NULL)
panic("powerhook_disestablish: hook not established");
#endif
- LIST_REMOVE((struct powerhook_desc *)vhook, sfd_list);
+ CIRCLEQ_REMOVE(&powerhook_list, (struct powerhook_desc *)vhook,
+ sfd_list);
free(vhook, M_DEVBUF);
}
@@ -318,9 +319,7 @@ dopowerhooks(why)
int s;
s = splhigh();
- for (dp = LIST_FIRST(&powerhook_list);
- dp != NULL;
- dp = LIST_NEXT(dp, sfd_list)) {
+ CIRCLEQ_FOREACH(dp, &powerhook_list, sfd_list) {
(*dp->sfd_fn)(why, dp->sfd_arg);
}
splx(s);