summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_module.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-11-08 06:53:30 +0000
committerpeter <peter@FreeBSD.org>1999-11-08 06:53:30 +0000
commit056ef56b0740e31efd012e3c6893d40bedfbb26d (patch)
treed59495ee3152ea51e8ce8a62d2bc8c0b22fece4f /sys/kern/kern_module.c
parent8074856056118e60d276251ecf2619b6a03e4d47 (diff)
downloadFreeBSD-src-056ef56b0740e31efd012e3c6893d40bedfbb26d.zip
FreeBSD-src-056ef56b0740e31efd012e3c6893d40bedfbb26d.tar.gz
A hack basically.. We have a bunch of code that used to call
devsw_module_handler() indirectly and not use the chain arguments. To eliminate this indirection via that function (which does nothing now) without duplicating a modevent handler into all the routines that don't presently have one, supply a NOP (do nothing, return OK) routine which is functionally equivalent to what's there now. This is a hack and is still wrong, because there doesn't appear to be anything to reclaim resources on an unload of a module with one of these in it. I'm not sure whether to make the NOP handler refuse a MOD_UNLOAD event or what.
Diffstat (limited to 'sys/kern/kern_module.c')
-rw-r--r--sys/kern/kern_module.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c
index c4e28a5..e451b97 100644
--- a/sys/kern/kern_module.c
+++ b/sys/kern/kern_module.c
@@ -59,6 +59,13 @@ static int nextid = 1;
static void module_shutdown(void*, int);
+static int
+modevent_nop(module_t mod, int what, void* arg)
+{
+ return 0;
+}
+
+
static void
module_init(void* arg)
{
@@ -129,7 +136,7 @@ module_register(const moduledata_t *data, linker_file_t container)
newmod->id = nextid++;
newmod->name = (char *) (newmod + 1);
strcpy(newmod->name, data->name);
- newmod->handler = data->evhand;
+ newmod->handler = data->evhand ? data->evhand : modevent_nop;
newmod->arg = data->priv;
bzero(&newmod->data, sizeof(newmod->data));
TAILQ_INSERT_TAIL(&modules, newmod, link);
OpenPOWER on IntegriCloud