summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-11-28 02:11:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-11-28 02:11:34 +0000
commitcd70248c083c98e176e2684eff64c7486ab2f022 (patch)
tree51a7aa272898ad571ae2e523f3ee57aa56eb3e35
parent8a574ceecdddb14c9d84a0b506f2c7413ec744b2 (diff)
mountroothooks are called after the root filesystem is mounted.
-rw-r--r--sys/kern/init_main.c4
-rw-r--r--sys/kern/kern_subr.c4
-rw-r--r--sys/sys/systm.h11
3 files changed, 15 insertions, 4 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 119bcecce17..7b13c6c32c0 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.120 2004/11/23 19:08:55 miod Exp $ */
+/* $OpenBSD: init_main.c,v 1.121 2004/11/28 02:11:33 deraadt Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -514,6 +514,8 @@ main(framep)
cpu_boot_secondary_processors();
#endif
+ domountroothooks();
+
/*
* Okay, now we can let init(8) exec! It's off to userland!
*/
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index 32e659af713..b16f5f0671d 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_subr.c,v 1.28 2004/06/13 21:49:26 niklas Exp $ */
+/* $OpenBSD: kern_subr.c,v 1.29 2004/11/28 02:11:33 deraadt Exp $ */
/* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */
/*
@@ -194,6 +194,8 @@ struct hook_desc_head startuphook_list =
TAILQ_HEAD_INITIALIZER(startuphook_list);
struct hook_desc_head shutdownhook_list =
TAILQ_HEAD_INITIALIZER(shutdownhook_list);
+struct hook_desc_head mountroothook_list =
+ TAILQ_HEAD_INITIALIZER(mountroothook_list);
void *
hook_establish(head, tail, fn, arg)
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 9342d6f126c..5d3dd639497 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: systm.h,v 1.64 2004/09/16 07:07:17 grange Exp $ */
+/* $OpenBSD: systm.h,v 1.65 2004/11/28 02:11:33 deraadt Exp $ */
/* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */
/*-
@@ -243,7 +243,8 @@ struct hook_desc {
};
TAILQ_HEAD(hook_desc_head, hook_desc);
-extern struct hook_desc_head shutdownhook_list, startuphook_list;
+extern struct hook_desc_head shutdownhook_list, startuphook_list,
+ mountroothook_list;
void *hook_establish(struct hook_desc_head *, int, void (*)(void *), void *);
void hook_disestablish(struct hook_desc_head *, void *);
@@ -264,6 +265,12 @@ void dohooks(struct hook_desc_head *, int);
hook_disestablish(&shutdownhook_list, (vhook))
#define doshutdownhooks() dohooks(&shutdownhook_list, HOOK_REMOVE)
+#define mountroothook_establish(fn, arg) \
+ hook_establish(&mountroothook_list, 0, (fn), (arg))
+#define mountroothook_disestablish(vhook) \
+ hook_disestablish(&mountroothook_list, (vhook))
+#define domountroothooks() dohooks(&mountroothook_list, HOOK_REMOVE|HOOK_FREE)
+
/*
* Power management hooks.
*/