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.
This commit is contained in:
Peter Wemm 1999-11-08 06:53:30 +00:00
parent 75bd443641
commit 845ccef4b8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=52991

View File

@ -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);