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

This commit is contained in:
christos 2012-04-26 03:04:54 +00:00
parent f7b1fda082
commit 704aca390d
5 changed files with 62 additions and 15 deletions

View File

@ -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; /* Set if cache has been initialized */
#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, 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;
}

View File

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

View File

@ -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,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,

View File

@ -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 */

View File

@ -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[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__))