Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/coda re-arrange things so that vcoda does not depend on ...



details:   https://anonhg.NetBSD.org/src/rev/8f729ef944fe
branches:  trunk
changeset: 779023:8f729ef944fe
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 26 03:04:54 2012 +0000

description:
re-arrange things so that vcoda does not depend on coda.

diffstat:

 sys/coda/coda_psdev.c  |  49 +++++++++++++++++++++++++++++++++++++++++++++++--
 sys/coda/coda_subr.c   |  10 ++++++++--
 sys/coda/coda_venus.c  |   6 ++----
 sys/coda/coda_vfsops.c |   6 +++---
 sys/coda/coda_vnops.c  |   6 ++----
 5 files changed, 62 insertions(+), 15 deletions(-)

diffs (200 lines):

diff -r bc156269b215 -r 8f729ef944fe sys/coda/coda_psdev.c
--- a/sys/coda/coda_psdev.c     Thu Apr 26 03:03:53 2012 +0000
+++ b/sys/coda/coda_psdev.c     Thu Apr 26 03:04:54 2012 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
 #include <sys/select.h>
 #include <sys/conf.h>
 #include <sys/atomic.h>
+#include <sys/module.h>
 
 #include <miscfs/syncfs/syncfs.h>
 
@@ -95,6 +96,8 @@
 #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 @@
     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 @@
        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 -r bc156269b215 -r 8f729ef944fe sys/coda/coda_subr.c
--- a/sys/coda/coda_subr.c      Thu Apr 26 03:03:53 2012 +0000
+++ b/sys/coda/coda_subr.c      Thu Apr 26 03:04:54 2012 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
 #include <sys/systm.h>
@@ -79,6 +79,12 @@
 
 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 -r bc156269b215 -r 8f729ef944fe sys/coda/coda_venus.c
--- a/sys/coda/coda_venus.c     Thu Apr 26 03:03:53 2012 +0000
+++ b/sys/coda/coda_venus.c     Thu Apr 26 03:04:54 2012 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
 #include <sys/systm.h>
@@ -201,8 +201,6 @@
        } while (/*CONSTCOND*/ 0)
 
 
-int coda_kernel_version = CODA_KERNEL_VERSION;
-
 int
 venus_root(void *mdp,
        kauth_cred_t cred, struct proc *p,
diff -r bc156269b215 -r 8f729ef944fe sys/coda/coda_vfsops.c
--- a/sys/coda/coda_vfsops.c    Thu Apr 26 03:03:53 2012 +0000
+++ b/sys/coda/coda_vfsops.c    Thu Apr 26 03:04:54 2012 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
 #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 -r bc156269b215 -r 8f729ef944fe sys/coda/coda_vnops.c
--- a/sys/coda/coda_vnops.c     Thu Apr 26 03:03:53 2012 +0000
+++ b/sys/coda/coda_vnops.c     Thu Apr 26 03:04:54 2012 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
 #include <sys/systm.h>
@@ -91,8 +91,6 @@
 #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__))



Home | Main Index | Thread Index | Old Index