diff --git a/sys/coda/coda_psdev.c b/sys/coda/coda_psdev.c index 0cca38ffa487..bd7a045f45ff 100644 --- a/sys/coda/coda_psdev.c +++ b/sys/coda/coda_psdev.c @@ -1,4 +1,4 @@ -/* $NetBSD: coda_psdev.c,v 1.47 2009/01/11 02:45:46 christos Exp $ */ +/* $NetBSD: coda_psdev.c,v 1.48 2012/04/26 03:04:54 christos Exp $ */ /* * @@ -54,7 +54,7 @@ /* These routines are the device entry points for Venus. */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.47 2009/01/11 02:45:46 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.48 2012/04/26 03:04:54 christos Exp $"); extern int coda_nc_initialized; /* Set if cache has been initialized */ @@ -76,6 +76,7 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */ #include #include #include +#include #include @@ -95,6 +96,8 @@ int coda_pcatch = PCATCH; #else #endif +int coda_kernel_version = CODA_KERNEL_VERSION; + #define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__func__)) void vcodaattach(int n); @@ -123,6 +126,8 @@ struct vmsg { void * vm_sleep; /* Not used by Mach. */ }; +struct coda_mntinfo coda_mnttbl[NVCODA]; + #define VM_READ 1 #define VM_WRITE 2 #define VM_INTR 4 @@ -721,3 +726,43 @@ coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, return(error); } +MODULE(MODULE_CLASS_DRIVER, vcoda, NULL); + +static int +vcoda_modcmd(modcmd_t cmd, void *arg) +{ + int cmajor, dmajor, error = 0; + + dmajor = cmajor = -1; + + switch (cmd) { + case MODULE_CMD_INIT: +#ifdef _MODULE + vcodaattach(NVCODA); + + return devsw_attach("vcoda", NULL, &dmajor, + &vcoda_cdevsw, &cmajor); +#endif + break; + + case MODULE_CMD_FINI: +#ifdef _MODULE + { + for (size_t i = 0; i < NVCODA; i++) { + struct vcomm *vcp = &coda_mnttbl[i].mi_vcomm; + if (VC_OPEN(vcp)) + return EBUSY; + } + return devsw_detach(NULL, &vcoda_cdevsw); + } +#endif + break; + + case MODULE_CMD_STAT: + return ENOTTY; + + default: + return ENOTTY; + } + return error; +} diff --git a/sys/coda/coda_subr.c b/sys/coda/coda_subr.c index 6a39ee256d18..7cbc8194aa90 100644 --- a/sys/coda/coda_subr.c +++ b/sys/coda/coda_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: coda_subr.c,v 1.25 2011/08/31 18:31:02 plunky Exp $ */ +/* $NetBSD: coda_subr.c,v 1.26 2012/04/26 03:04:54 christos Exp $ */ /* * @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_subr.c,v 1.25 2011/08/31 18:31:02 plunky Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_subr.c,v 1.26 2012/04/26 03:04:54 christos Exp $"); #include #include @@ -79,6 +79,12 @@ int coda_new = 0; struct cnode *coda_freelist = NULL; struct cnode *coda_cache[CODA_CACHESIZE]; +MALLOC_DEFINE(M_CODA, "coda", "Coda file system structures and tables"); + +int codadebug = 0; +int coda_printf_delay = 0; /* in microseconds */ +int coda_vnop_print_entry = 0; +int coda_vfsop_print_entry = 0; #define CNODE_NEXT(cp) ((cp)->c_next) diff --git a/sys/coda/coda_venus.c b/sys/coda/coda_venus.c index a45905cc7851..1c77c123ee43 100644 --- a/sys/coda/coda_venus.c +++ b/sys/coda/coda_venus.c @@ -1,4 +1,4 @@ -/* $NetBSD: coda_venus.c,v 1.28 2010/07/20 17:26:03 christos Exp $ */ +/* $NetBSD: coda_venus.c,v 1.29 2012/04/26 03:04:54 christos Exp $ */ /* * @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_venus.c,v 1.28 2010/07/20 17:26:03 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_venus.c,v 1.29 2012/04/26 03:04:54 christos Exp $"); #include #include @@ -201,8 +201,6 @@ __KERNEL_RCSID(0, "$NetBSD: coda_venus.c,v 1.28 2010/07/20 17:26:03 christos Exp } while (/*CONSTCOND*/ 0) -int coda_kernel_version = CODA_KERNEL_VERSION; - int venus_root(void *mdp, kauth_cred_t cred, struct proc *p, diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c index ecd40eadb770..7c2fb17727e4 100644 --- a/sys/coda/coda_vfsops.c +++ b/sys/coda/coda_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: coda_vfsops.c,v 1.70 2011/09/27 00:54:47 christos Exp $ */ +/* $NetBSD: coda_vfsops.c,v 1.71 2012/04/26 03:04:54 christos Exp $ */ /* * @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.70 2011/09/27 00:54:47 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.71 2012/04/26 03:04:54 christos Exp $"); #ifndef _KERNEL_OPT #define NVCODA 4 @@ -86,7 +86,7 @@ int coda_vfsop_print_entry = 0; #define ENTRY if(coda_vfsop_print_entry) myprintf(("Entered %s\n",__func__)) struct vnode *coda_ctlvp; -struct coda_mntinfo coda_mnttbl[NVCODA]; /* indexed by minor device number */ +extern struct coda_mntinfo coda_mnttbl[NVCODA]; /* indexed by minor device number */ /* structure to keep statistics of internally generated/satisfied calls */ diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index c3330d8f6353..dfb968e24f15 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: coda_vnops.c,v 1.81 2011/09/13 19:34:27 gdt Exp $ */ +/* $NetBSD: coda_vnops.c,v 1.82 2012/04/26 03:04:54 christos Exp $ */ /* * @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.81 2011/09/13 19:34:27 gdt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.82 2012/04/26 03:04:54 christos Exp $"); #include #include @@ -91,8 +91,6 @@ struct coda_op_stats coda_vnodeopstats[CODA_VNODEOPS_SIZE]; #define MARK_INT_GEN(op) (coda_vnodeopstats[op].gen_intrn++) /* What we are delaying for in printf */ -int coda_printf_delay = 0; /* in microseconds */ -int coda_vnop_print_entry = 0; static int coda_lockdebug = 0; #define ENTRY if(coda_vnop_print_entry) myprintf(("Entered %s\n",__func__))