Module Name:    src
Committed By:   christos
Date:           Thu Apr 26 03:04:55 UTC 2012

Modified Files:
        src/sys/coda: coda_psdev.c coda_subr.c coda_venus.c coda_vfsops.c
            coda_vnops.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/coda/coda_psdev.c
cvs rdiff -u -r1.25 -r1.26 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.28 -r1.29 src/sys/coda/coda_venus.c
cvs rdiff -u -r1.70 -r1.71 src/sys/coda/coda_vfsops.c
cvs rdiff -u -r1.81 -r1.82 src/sys/coda/coda_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/coda/coda_psdev.c
diff -u src/sys/coda/coda_psdev.c:1.47 src/sys/coda/coda_psdev.c:1.48
--- src/sys/coda/coda_psdev.c:1.47	Sat Jan 10 21:45:46 2009
+++ src/sys/coda/coda_psdev.c	Wed Apr 25 23:04:54 2012
@@ -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 @@ extern int coda_nc_initialized;    /* Se
 #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 @@ 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, 
 	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;
+}

Index: src/sys/coda/coda_subr.c
diff -u src/sys/coda/coda_subr.c:1.25 src/sys/coda/coda_subr.c:1.26
--- src/sys/coda/coda_subr.c:1.25	Wed Aug 31 14:31:02 2011
+++ src/sys/coda/coda_subr.c	Wed Apr 25 23:04:54 2012
@@ -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 @@ 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)
 

Index: src/sys/coda/coda_venus.c
diff -u src/sys/coda/coda_venus.c:1.28 src/sys/coda/coda_venus.c:1.29
--- src/sys/coda/coda_venus.c:1.28	Tue Jul 20 13:26:03 2010
+++ src/sys/coda/coda_venus.c	Wed Apr 25 23:04:54 2012
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: coda_venus.c
 	} while (/*CONSTCOND*/ 0)
 
 
-int coda_kernel_version = CODA_KERNEL_VERSION;
-
 int
 venus_root(void *mdp,
 	kauth_cred_t cred, struct proc *p,

Index: src/sys/coda/coda_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.70 src/sys/coda/coda_vfsops.c:1.71
--- src/sys/coda/coda_vfsops.c:1.70	Mon Sep 26 20:54:47 2011
+++ src/sys/coda/coda_vfsops.c	Wed Apr 25 23:04:54 2012
@@ -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 @@ 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 */
 

Index: src/sys/coda/coda_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.81 src/sys/coda/coda_vnops.c:1.82
--- src/sys/coda/coda_vnops.c:1.81	Tue Sep 13 15:34:27 2011
+++ src/sys/coda/coda_vnops.c	Wed Apr 25 23:04:54 2012
@@ -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 @@ struct coda_op_stats coda_vnodeopstats[C
 #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__))

Reply via email to