diff options
author | peter <peter@FreeBSD.org> | 1998-10-23 11:49:47 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1998-10-23 11:49:47 +0000 |
commit | b08b3e4285c8911f1965f4dfcf6384f2813cf658 (patch) | |
tree | 638821894edc10a841a60902523a3901d6f932ea /sys/dev | |
parent | 2e36499ddf774a6f3844861b378a8f0d188543a2 (diff) | |
download | FreeBSD-src-b08b3e4285c8911f1965f4dfcf6384f2813cf658.zip FreeBSD-src-b08b3e4285c8911f1965f4dfcf6384f2813cf658.tar.gz |
Move the kld stuff to here.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/vinum/vinum.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/sys/dev/vinum/vinum.c b/sys/dev/vinum/vinum.c index bffdf6d..4e726a2 100644 --- a/sys/dev/vinum/vinum.c +++ b/sys/dev/vinum/vinum.c @@ -33,7 +33,7 @@ * otherwise) arising in any way out of the use of this software, even if * advised of the possibility of such damage. * - * $Id: vinum.c,v 1.19 1998/08/13 05:24:02 grog Exp grog $ + * $Id: vinum.c,v 1.1.1.1 1998/09/16 05:56:21 grog Exp $ */ #define STATIC /* nothing while we're testing XXX */ @@ -76,6 +76,10 @@ void vinum_scandisk(void); int vinum_inactive(void); void free_vinum(int); +#ifndef ACTUALLY_LKM_NOT_KERNEL +STATIC int vinum_modevent(module_t mod, modeventtype_t type, void *unused); +#endif + #if __FreeBSD__ >= 3 /* Why aren't these declared anywhere? XXX */ int setjmp(jmp_buf); @@ -161,8 +165,6 @@ vinumattach(void *dummy) } -#ifdef ACTUALLY_LKM_NOT_KERNEL /* stuff for LKMs */ - /* Check if we have anything open. If so, return 0 (not inactive), * otherwise 1 (inactive) */ int @@ -228,6 +230,7 @@ free_vinum(int cleardrive) bzero(&vinum_conf, sizeof(vinum_conf)); } +#ifdef ACTUALLY_LKM_NOT_KERNEL /* stuff for LKMs */ MOD_MISC(vinum); /* @@ -289,7 +292,38 @@ vinum_mod(struct lkm_table *lkmtp, int cmd, int ver) } #else /* not LKM */ -#error "This driver must be compiled as a loadable kernel module" + +STATIC int +vinum_modevent(module_t mod, modeventtype_t type, void *unused) +{ + struct sync_args dummyarg = {0}; + + BROKEN_GDB; + switch (type) { + case MOD_LOAD: + /* Debugger ("vinum_load"); */ + vinumattach(NULL); + return 0; /* OK */ + case MOD_UNLOAD: + if (!vinum_inactive()) /* is anything open? */ + return EBUSY; + sync(curproc, &dummyarg); /* write out buffers */ + free_vinum(0); /* no: clean up */ + cdevsw[CDEV_MAJOR] = NULL; /* and cdevsw */ + return 0; + default: + break; + } + return 0; +} + +moduledata_t vinum_mod = { + "vinum", + vinum_modevent, + 0 +}; +DECLARE_MODULE(vinum, vinum_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); + #endif /* LKM */ /* ARGSUSED */ |