From 845ccef4b807b99237f2f955f84aff432ab2389b Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Mon, 8 Nov 1999 06:53:30 +0000 Subject: [PATCH] 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. --- sys/kern/kern_module.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c index c4e28a5842f1..e451b970f119 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);