Put "stray" printouts under DIAGNOSTIC. Make everything build

with DEBUG on.  Add support for lkm.  (The macro's don't work
for me; for a good chuckle look at the end of coda_fbsd.c.)
This commit is contained in:
rvb 1998-09-25 17:38:32 +00:00
parent 52dddc9d06
commit dc77026178
14 changed files with 410 additions and 154 deletions

View File

@ -27,10 +27,17 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_fbsd.c,v 1.3 1998/09/11 18:50:16 rvb Exp $ * $Id: coda_fbsd.c,v 1.4 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
#ifdef ACTUALLY_LKM_NOT_KERNEL
#define NVCODA 4
#else
#include "vcoda.h"
#include "opt_devfs.h"
#endif
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h> #include <sys/kernel.h>
@ -47,9 +54,12 @@
#include <coda/coda.h> #include <coda/coda.h>
#include <coda/cnode.h> #include <coda/cnode.h>
#include <coda/coda_vnops.h> #include <coda/coda_vnops.h>
#include <coda/coda_psdev.h>
#ifdef DEVFS #ifdef DEVFS
#include <sys/devfsext.h> #include <sys/devfsext.h>
static void *devfs_token[NVCODA];
#endif #endif
/* /*
@ -66,15 +76,7 @@
#define VC_DEV_NO 93 #define VC_DEV_NO 93
/* Type of device methods. */ static struct cdevsw codadevsw =
extern d_open_t vc_nb_open;
extern d_close_t vc_nb_close;
extern d_read_t vc_nb_read;
extern d_write_t vc_nb_write;
extern d_ioctl_t vc_nb_ioctl;
extern d_poll_t vc_nb_poll;
static struct cdevsw vccdevsw =
{ {
vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, /*93*/ vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, /*93*/
vc_nb_ioctl, nostop, nullreset, nodevtotty, vc_nb_ioctl, nostop, nullreset, nodevtotty,
@ -82,7 +84,7 @@ static struct cdevsw vccdevsw =
}; };
void vcattach __P((void)); void vcattach __P((void));
static dev_t vccdev; static dev_t codadev;
int vcdebug = 1; int vcdebug = 1;
#define VCDEBUG if (vcdebug) printf #define VCDEBUG if (vcdebug) printf
@ -93,13 +95,13 @@ vcattach(void)
/* /*
* In case we are an LKM, set up device switch. * In case we are an LKM, set up device switch.
*/ */
if (0 == (vccdev = makedev(VC_DEV_NO, 0))) if (0 == (codadev = makedev(VC_DEV_NO, 0)))
VCDEBUG("makedev returned null\n"); VCDEBUG("makedev returned null\n");
else else
VCDEBUG("makedev OK.\n"); VCDEBUG("makedev OK.\n");
cdevsw_add(&vccdev, &vccdevsw, NULL); cdevsw_add(&codadev, &codadevsw, NULL);
VCDEBUG("coda: vccdevsw entry installed at %d.\n", major(vccdev)); VCDEBUG("coda: codadevsw entry installed at %d.\n", major(codadev));
} }
static vc_devsw_installed = 0; static vc_devsw_installed = 0;
@ -109,12 +111,28 @@ static void
vc_drvinit(void *unused) vc_drvinit(void *unused)
{ {
dev_t dev; dev_t dev;
#ifdef DEVFS
int i;
#endif
if( ! vc_devsw_installed ) { if( ! vc_devsw_installed ) {
dev = makedev(VC_DEV_NO, 0); dev = makedev(VC_DEV_NO, 0);
cdevsw_add(&dev,&vccdevsw, NULL); cdevsw_add(&dev,&codadevsw, NULL);
vc_devsw_installed = 1; vc_devsw_installed = 1;
} }
#ifdef DEVFS
for (i = 0; i < NVCODA; i++) {
devfs_token[i] =
devfs_add_devswf(&codadevsw, i
DV_CHR, 0, 0, 0666,
"cfs%d", i);
devfs_token[i] =
devfs_add_devswf(&codadevsw, i
DV_CHR, 0, 0, 0666,
"coda%d", i);
}
#endif
} }
int int
@ -202,4 +220,55 @@ coda_fbsd_putpages(v)
} }
SYSINIT(vccdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,vc_drvinit,NULL) SYSINIT(codadev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,vc_drvinit,NULL)
#ifdef ACTUALLY_LKM_NOT_KERNEL
#include <sys/mount.h>
#include <sys/lkm.h>
extern struct vfsops coda_vfsops;
static struct vfsconf _fs_vfsconf = { &coda_vfsops, "coda", -1, 0, 0 };
extern struct linker_set coda_modvnops ;
static struct lkm_vfs coda_mod_vfs = {
LM_VFS, LKM_VERSION, "coda", 0, &coda_modvnops, &_fs_vfsconf };
static struct lkm_dev coda_mod_dev = {
LM_DEV, LKM_VERSION, "codadev", VC_DEV_NO, LM_DT_CHAR, (void *) &codadevsw};
int coda_mod(struct lkm_table *, int, int);
int
coda_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
int error = 0;
if (ver != LKM_VERSION)
return EINVAL;
switch (cmd) {
case LKM_E_LOAD:
lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_dev;
error = lkmdispatch(lkmtp, cmd);
if (error)
break;
lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_vfs ;
error = lkmdispatch(lkmtp, cmd);
break;
case LKM_E_UNLOAD:
lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_vfs ;
error = lkmdispatch(lkmtp, cmd);
if (error)
break;
lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_dev;
error = lkmdispatch(lkmtp, cmd);
break;
case LKM_E_STAT:
error = lkmdispatch(lkmtp, cmd);
break;
}
return error;
}
#endif

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_namecache.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_namecache.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_namecache.c,v 1.4 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_namecache.c,v 1.5 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -47,6 +47,9 @@
/* /*
* HISTORY * HISTORY
* $Log: coda_namecache.c,v $ * $Log: coda_namecache.c,v $
* Revision 1.5 1998/09/13 13:57:59 rvb
* Finish conversion of cfs -> coda
*
* Revision 1.4 1998/09/11 18:50:17 rvb * Revision 1.4 1998/09/11 18:50:17 rvb
* All the references to cfs, in symbols, structs, and strings * All the references to cfs, in symbols, structs, and strings
* have been changed to coda. (Same for CFS.) * have been changed to coda. (Same for CFS.)
@ -232,6 +235,10 @@
#include <coda/cnode.h> #include <coda/cnode.h>
#include <coda/coda_namecache.h> #include <coda/coda_namecache.h>
#ifdef DEBUG
#include <coda/coda_vnops.h>
#endif
/* /*
* Declaration of the name cache data structure. * Declaration of the name cache data structure.
*/ */
@ -276,7 +283,9 @@ coda_nc_init(void)
bzero(&coda_nc_stat, (sizeof(struct coda_nc_statistics))); bzero(&coda_nc_stat, (sizeof(struct coda_nc_statistics)));
#ifdef DIAGNOSTIC
printf("CODA NAME CACHE: CACHE %d, HASH TBL %d\n", CODA_NC_CACHESIZE, CODA_NC_HASHSIZE); printf("CODA NAME CACHE: CACHE %d, HASH TBL %d\n", CODA_NC_CACHESIZE, CODA_NC_HASHSIZE);
#endif
CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE); CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE);
CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE); CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE);
@ -868,7 +877,6 @@ coda_nc_resize(hashsize, heapsize, dcstat)
return(0); return(0);
} }
#define DEBUG
#ifdef DEBUG #ifdef DEBUG
char coda_nc_name_buf[CODA_MAXNAMLEN+1]; char coda_nc_name_buf[CODA_MAXNAMLEN+1];

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_psdev.c,v 1.3 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_psdev.c,v 1.4 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -53,6 +53,9 @@
/* /*
* HISTORY * HISTORY
* $Log: coda_psdev.c,v $ * $Log: coda_psdev.c,v $
* Revision 1.4 1998/09/13 13:57:59 rvb
* Finish conversion of cfs -> coda
*
* Revision 1.3 1998/09/11 18:50:17 rvb * Revision 1.3 1998/09/11 18:50:17 rvb
* All the references to cfs, in symbols, structs, and strings * All the references to cfs, in symbols, structs, and strings
* have been changed to coda. (Same for CFS.) * have been changed to coda. (Same for CFS.)
@ -158,7 +161,11 @@
extern int coda_nc_initialized; /* Set if cache has been initialized */ extern int coda_nc_initialized; /* Set if cache has been initialized */
#ifdef ACTUALLY_LKM_NOT_KERNEL
#define NVCODA 4
#else
#include <vcoda.h> #include <vcoda.h>
#endif
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -175,6 +182,7 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */
#include <coda/cnode.h> #include <coda/cnode.h>
#include <coda/coda_namecache.h> #include <coda/coda_namecache.h>
#include <coda/coda_io.h> #include <coda/coda_io.h>
#include <coda/coda_psdev.h>
#define CTL_C #define CTL_C
@ -183,12 +191,6 @@ int coda_psdev_print_entry = 0;
#define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) #define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
void vcodaattach(int n); void vcodaattach(int n);
int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p);
int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p);
int vc_nb_read(dev_t dev, struct uio *uiop, int flag);
int vc_nb_write(dev_t dev, struct uio *uiop, int flag);
int vc_nb_ioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p);
int vc_nb_poll(dev_t dev, int events, struct proc *p);
struct vmsg { struct vmsg {
struct queue vm_chain; struct queue vm_chain;
@ -340,7 +342,7 @@ vc_nb_read(dev, uiop, flag)
error = EINVAL; error = EINVAL;
} }
#ifdef DIAGNOSTIC #ifdef OLD_DIAGNOSTIC
if (vmp->vm_chain.forw == 0 || vmp->vm_chain.back == 0) if (vmp->vm_chain.forw == 0 || vmp->vm_chain.back == 0)
panic("vc_nb_read: bad chain"); panic("vc_nb_read: bad chain");
#endif #endif
@ -467,7 +469,7 @@ vc_nb_write(dev, uiop, flag)
int int
vc_nb_ioctl(dev, cmd, addr, flag, p) vc_nb_ioctl(dev, cmd, addr, flag, p)
dev_t dev; dev_t dev;
int cmd; u_long cmd;
caddr_t addr; caddr_t addr;
int flag; int flag;
struct proc *p; struct proc *p;
@ -619,20 +621,26 @@ coda_call(mntinfo, inSize, outSize, buffer)
if (error == 0) if (error == 0)
break; break;
else if (error == EWOULDBLOCK) { else if (error == EWOULDBLOCK) {
#ifdef DIAGNOSTIC
printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i); printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i);
#endif
} else if (p->p_siglist == sigmask(SIGIO)) { } else if (p->p_siglist == sigmask(SIGIO)) {
p->p_sigmask |= p->p_siglist; p->p_sigmask |= p->p_siglist;
#ifdef DIAGNOSTIC
printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i);
#endif
} else { } else {
printf("coda_call: tsleep returns %d, cnt %d\n", error, i); printf("coda_call: tsleep returns %d, cnt %d\n", error, i);
printf("coda_call: siglist = %x, sigmask = %x, mask %x\n", printf("coda_call: siglist = %x, sigmask = %x, mask %x\n",
p->p_siglist, p->p_sigmask, p->p_siglist, p->p_sigmask,
p->p_siglist & ~p->p_sigmask); p->p_siglist & ~p->p_sigmask);
break; break;
#ifdef notyet
p->p_sigmask |= p->p_siglist; p->p_sigmask |= p->p_siglist;
printf("coda_call: new mask, siglist = %x, sigmask = %x, mask %x\n", printf("coda_call: new mask, siglist = %x, sigmask = %x, mask %x\n",
p->p_siglist, p->p_sigmask, p->p_siglist, p->p_sigmask,
p->p_siglist & ~p->p_sigmask); p->p_siglist & ~p->p_sigmask);
#endif
} }
} while (error && i++ < 128); } while (error && i++ < 128);
p->p_sigmask = psig_omask; p->p_sigmask = psig_omask;
@ -648,7 +656,11 @@ coda_call(mntinfo, inSize, outSize, buffer)
else if (!(vmp->vm_flags & VM_READ)) { else if (!(vmp->vm_flags & VM_READ)) {
/* Interrupted before venus read it. */ /* Interrupted before venus read it. */
if (codadebug||1) #ifdef DIAGNOSTIC
if (1)
#else
if (codadebug)
#endif
myprintf(("interrupted before read: op = %d.%d, flags = %x\n", myprintf(("interrupted before read: op = %d.%d, flags = %x\n",
vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));
REMQUE(vmp->vm_chain); REMQUE(vmp->vm_chain);
@ -662,7 +674,11 @@ coda_call(mntinfo, inSize, outSize, buffer)
struct coda_in_hdr *dog; struct coda_in_hdr *dog;
struct vmsg *svmp; struct vmsg *svmp;
if (codadebug||1) #ifdef DIAGNOSTIC
if (1)
#else
if (codadebug)
#endif
myprintf(("Sending Venus a signal: op = %d.%d, flags = %x\n", myprintf(("Sending Venus a signal: op = %d.%d, flags = %x\n",
vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_subr.c,v 1.4 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_subr.c,v 1.5 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -46,6 +46,9 @@
/* /*
* HISTORY * HISTORY
* $Log: coda_subr.c,v $ * $Log: coda_subr.c,v $
* Revision 1.5 1998/09/13 13:57:59 rvb
* Finish conversion of cfs -> coda
*
* Revision 1.4 1998/09/11 18:50:17 rvb * Revision 1.4 1998/09/11 18:50:17 rvb
* All the references to cfs, in symbols, structs, and strings * All the references to cfs, in symbols, structs, and strings
* have been changed to coda. (Same for CFS.) * have been changed to coda. (Same for CFS.)
@ -210,7 +213,11 @@
* 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address
*/ */
#ifdef ACTUALLY_LKM_NOT_KERNEL
#define NVCODA 4
#else
#include <vcoda.h> #include <vcoda.h>
#endif
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -460,6 +467,7 @@ coda_unmounting(whoIam)
} }
#ifdef DEBUG #ifdef DEBUG
void
coda_checkunmounting(mp) coda_checkunmounting(mp)
struct mount *mp; struct mount *mp;
{ {
@ -481,7 +489,7 @@ coda_checkunmounting(mp)
} }
} }
int void
coda_cacheprint(whoIam) coda_cacheprint(whoIam)
struct mount *whoIam; struct mount *whoIam;
{ {
@ -490,7 +498,7 @@ coda_cacheprint(whoIam)
int count = 0; int count = 0;
printf("coda_cacheprint: coda_ctlvp %p, cp %p", coda_ctlvp, VTOC(coda_ctlvp)); printf("coda_cacheprint: coda_ctlvp %p, cp %p", coda_ctlvp, VTOC(coda_ctlvp));
coda_nc_name(coda_ctlvp); coda_nc_name(VTOC(coda_ctlvp));
printf("\n"); printf("\n");
for (hash = 0; hash < CODA_CACHESIZE; hash++) { for (hash = 0; hash < CODA_CACHESIZE; hash++) {

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_subr.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_subr.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_subr.h,v 1.4 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_subr.h,v 1.5 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -36,8 +36,8 @@ void coda_free(struct cnode *cp);
struct cnode *coda_find(ViceFid *fid); struct cnode *coda_find(ViceFid *fid);
void coda_flush(enum dc_status dcstat); void coda_flush(enum dc_status dcstat);
void coda_testflush(void); void coda_testflush(void);
int coda_checkunmounting(struct mount *mp); void coda_checkunmounting(struct mount *mp);
int coda_cacheprint(struct mount *whoIam); void coda_cacheprint(struct mount *whoIam);
void coda_debugon(void); void coda_debugon(void);
void coda_debugoff(void); void coda_debugoff(void);
int coda_kill(struct mount *whoIam, enum dc_status dcstat); int coda_kill(struct mount *whoIam, enum dc_status dcstat);

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_vfsops.c,v 1.4 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_vfsops.c,v 1.5 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -47,6 +47,9 @@
/* /*
* HISTORY * HISTORY
* $Log: coda_vfsops.c,v $ * $Log: coda_vfsops.c,v $
* Revision 1.5 1998/09/13 13:57:59 rvb
* Finish conversion of cfs -> coda
*
* Revision 1.4 1998/09/11 18:50:17 rvb * Revision 1.4 1998/09/11 18:50:17 rvb
* All the references to cfs, in symbols, structs, and strings * All the references to cfs, in symbols, structs, and strings
* have been changed to coda. (Same for CFS.) * have been changed to coda. (Same for CFS.)
@ -181,7 +184,12 @@
* *
* *
*/ */
#ifdef ACTUALLY_LKM_NOT_KERNEL
#define NVCODA 4
#else
#include <vcoda.h> #include <vcoda.h>
#endif
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -223,24 +231,6 @@ struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE];
extern int coda_nc_initialized; /* Set if cache has been initialized */ extern int coda_nc_initialized; /* Set if cache has been initialized */
extern int vc_nb_open __P((dev_t, int, int, struct proc *)); extern int vc_nb_open __P((dev_t, int, int, struct proc *));
struct vfsops coda_vfsops = {
coda_mount,
coda_start,
coda_unmount,
coda_root,
coda_quotactl,
coda_nb_statfs,
coda_sync,
coda_vget,
(int (*) (struct mount *, struct fid *, struct sockaddr *, struct vnode **,
int *, struct ucred **))
eopnotsupp,
(int (*) (struct vnode *, struct fid *)) eopnotsupp,
coda_init,
};
VFS_SET(coda_vfsops, coda, VFCF_NETWORK);
int int
coda_vfsopstats_init(void) coda_vfsopstats_init(void)
{ {
@ -727,3 +717,28 @@ struct mount *devtomp(dev)
/* mount structure wasn't found */ /* mount structure wasn't found */
return(NULL); return(NULL);
} }
struct vfsops coda_vfsops = {
coda_mount,
coda_start,
coda_unmount,
coda_root,
coda_quotactl,
coda_nb_statfs,
coda_sync,
coda_vget,
(int (*) (struct mount *, struct fid *, struct sockaddr *, struct vnode **,
int *, struct ucred **))
eopnotsupp,
(int (*) (struct vnode *, struct fid *)) eopnotsupp,
coda_init,
};
#ifdef ACTUALLY_LKM_NOT_KERNEL
/*
* This case is being handled in coda_fbsd.c
* What we want is too hairy for VFS_SET to get right!
*/
#else
VFS_SET(coda_vfsops, coda, VFCF_NETWORK);
#endif

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_vnops.c,v 1.3 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_vnops.c,v 1.4 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -48,6 +48,9 @@
/* /*
* HISTORY * HISTORY
* $Log: coda_vnops.c,v $ * $Log: coda_vnops.c,v $
* Revision 1.4 1998/09/13 13:57:59 rvb
* Finish conversion of cfs -> coda
*
* Revision 1.3 1998/09/11 18:50:17 rvb * Revision 1.3 1998/09/11 18:50:17 rvb
* All the references to cfs, in symbols, structs, and strings * All the references to cfs, in symbols, structs, and strings
* have been changed to coda. (Same for CFS.) * have been changed to coda. (Same for CFS.)
@ -291,38 +294,38 @@ struct vnodeopv_entry_desc coda_vnodeop_entries[] = {
{ &vop_default_desc, coda_vop_error }, { &vop_default_desc, coda_vop_error },
{ &vop_lookup_desc, coda_lookup }, /* lookup */ { &vop_lookup_desc, coda_lookup }, /* lookup */
{ &vop_create_desc, coda_create }, /* create */ { &vop_create_desc, coda_create }, /* create */
{ &vop_mknod_desc, coda_vop_error }, /* mknod */ { &vop_mknod_desc, coda_vop_error }, /* mknod */
{ &vop_open_desc, coda_open }, /* open */ { &vop_open_desc, coda_open }, /* open */
{ &vop_close_desc, coda_close }, /* close */ { &vop_close_desc, coda_close }, /* close */
{ &vop_access_desc, coda_access }, /* access */ { &vop_access_desc, coda_access }, /* access */
{ &vop_getattr_desc, coda_getattr }, /* getattr */ { &vop_getattr_desc, coda_getattr }, /* getattr */
{ &vop_setattr_desc, coda_setattr }, /* setattr */ { &vop_setattr_desc, coda_setattr }, /* setattr */
{ &vop_read_desc, coda_read }, /* read */ { &vop_read_desc, coda_read }, /* read */
{ &vop_write_desc, coda_write }, /* write */ { &vop_write_desc, coda_write }, /* write */
{ &vop_ioctl_desc, coda_ioctl }, /* ioctl */ { &vop_ioctl_desc, coda_ioctl }, /* ioctl */
{ &vop_mmap_desc, coda_vop_error }, /* mmap */ { &vop_mmap_desc, coda_vop_error }, /* mmap */
{ &vop_fsync_desc, coda_fsync }, /* fsync */ { &vop_fsync_desc, coda_fsync }, /* fsync */
{ &vop_remove_desc, coda_remove }, /* remove */ { &vop_remove_desc, coda_remove }, /* remove */
{ &vop_link_desc, coda_link }, /* link */ { &vop_link_desc, coda_link }, /* link */
{ &vop_rename_desc, coda_rename }, /* rename */ { &vop_rename_desc, coda_rename }, /* rename */
{ &vop_mkdir_desc, coda_mkdir }, /* mkdir */ { &vop_mkdir_desc, coda_mkdir }, /* mkdir */
{ &vop_rmdir_desc, coda_rmdir }, /* rmdir */ { &vop_rmdir_desc, coda_rmdir }, /* rmdir */
{ &vop_symlink_desc, coda_symlink }, /* symlink */ { &vop_symlink_desc, coda_symlink }, /* symlink */
{ &vop_readdir_desc, coda_readdir }, /* readdir */ { &vop_readdir_desc, coda_readdir }, /* readdir */
{ &vop_readlink_desc, coda_readlink }, /* readlink */ { &vop_readlink_desc, coda_readlink }, /* readlink */
{ &vop_abortop_desc, coda_abortop }, /* abortop */ { &vop_abortop_desc, coda_abortop }, /* abortop */
{ &vop_inactive_desc, coda_inactive }, /* inactive */ { &vop_inactive_desc, coda_inactive }, /* inactive */
{ &vop_reclaim_desc, coda_reclaim }, /* reclaim */ { &vop_reclaim_desc, coda_reclaim }, /* reclaim */
{ &vop_lock_desc, coda_lock }, /* lock */ { &vop_lock_desc, coda_lock }, /* lock */
{ &vop_unlock_desc, coda_unlock }, /* unlock */ { &vop_unlock_desc, coda_unlock }, /* unlock */
{ &vop_bmap_desc, coda_bmap }, /* bmap */ { &vop_bmap_desc, coda_bmap }, /* bmap */
{ &vop_strategy_desc, coda_strategy }, /* strategy */ { &vop_strategy_desc, coda_strategy }, /* strategy */
{ &vop_print_desc, coda_vop_error }, /* print */ { &vop_print_desc, coda_vop_error }, /* print */
{ &vop_islocked_desc, coda_islocked }, /* islocked */ { &vop_islocked_desc, coda_islocked }, /* islocked */
{ &vop_pathconf_desc, coda_vop_error }, /* pathconf */ { &vop_pathconf_desc, coda_vop_error }, /* pathconf */
{ &vop_advlock_desc, coda_vop_nop }, /* advlock */ { &vop_advlock_desc, coda_vop_nop }, /* advlock */
{ &vop_bwrite_desc, coda_vop_error }, /* bwrite */ { &vop_bwrite_desc, coda_vop_error }, /* bwrite */
{ &vop_lease_desc, coda_vop_nop }, /* lease */ { &vop_lease_desc, coda_vop_nop }, /* lease */
{ &vop_poll_desc, (vop_t *) vop_stdpoll }, { &vop_poll_desc, (vop_t *) vop_stdpoll },
{ &vop_getpages_desc, coda_fbsd_getpages }, /* pager intf.*/ { &vop_getpages_desc, coda_fbsd_getpages }, /* pager intf.*/
{ &vop_putpages_desc, coda_fbsd_putpages }, /* pager intf.*/ { &vop_putpages_desc, coda_fbsd_putpages }, /* pager intf.*/
@ -473,6 +476,7 @@ coda_open(v)
printf("coda_open: VOP_OPEN on container failed %d\n", error); printf("coda_open: VOP_OPEN on container failed %d\n", error);
return (error); return (error);
} }
/* grab (above) does this when it calls newvnode unless it's in the cache*/
if (vp->v_type == VREG) { if (vp->v_type == VREG) {
error = vfs_object_create(vp, p, cred, 1); error = vfs_object_create(vp, p, cred, 1);
if (error != 0) { if (error != 0) {
@ -480,6 +484,7 @@ coda_open(v)
vput(vp); vput(vp);
} }
} }
return(error); return(error);
} }
@ -510,11 +515,15 @@ coda_close(v)
if (IS_UNMOUNTING(cp)) { if (IS_UNMOUNTING(cp)) {
if (cp->c_ovp) { if (cp->c_ovp) {
#ifdef DIAGNOSTIC
printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n", printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n",
vp->v_usecount, cp->c_ovp, vp, cp); vp->v_usecount, cp->c_ovp, vp, cp);
#endif
vgone(cp->c_ovp); vgone(cp->c_ovp);
} else { } else {
#ifdef DIAGNOSTIC
printf("coda_close: NO container vp %p/cp %p\n", vp, cp); printf("coda_close: NO container vp %p/cp %p\n", vp, cp);
#endif
} }
return ENODEV; return ENODEV;
} else { } else {
@ -643,11 +652,13 @@ printf("coda_rdwr: Internally Opening %p\n", vp);
cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Volume, cp->c_fid.Vnode,
cp->c_fid.Unique, CTOV(cp)->v_usecount)); ) cp->c_fid.Unique, CTOV(cp)->v_usecount)); )
if (rw == UIO_READ) { if (rw == UIO_READ) {
error = VOP_READ(cfvp, uiop, ioflag, cred); error = VOP_READ(cfvp, uiop, ioflag, cred);
} else { } else {
error = VOP_WRITE(cfvp, uiop, ioflag, cred); error = VOP_WRITE(cfvp, uiop, ioflag, cred);
/* ufs_write updates the vnode_pager_setsize for the vnode/object */ /* ufs_write updates the vnode_pager_setsize for the vnode/object */
{ struct vattr attr; { struct vattr attr;
if (VOP_GETATTR(cfvp, &attr, cred, p) == 0) { if (VOP_GETATTR(cfvp, &attr, cred, p) == 0) {
@ -1101,7 +1112,7 @@ coda_inactive(v)
#endif #endif
lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p);
} else { } else {
#ifdef DIAGNOSTIC #ifdef OLD_DIAGNOSTIC
if (CTOV(cp)->v_usecount) { if (CTOV(cp)->v_usecount) {
panic("coda_inactive: nonzero reference count"); panic("coda_inactive: nonzero reference count");
} }
@ -1366,11 +1377,11 @@ coda_create(v)
panic("unlocked parent but couldn't lock child"); panic("unlocked parent but couldn't lock child");
} }
} }
#ifdef DIAGNOSTIC #ifdef OLD_DIAGNOSTIC
else { else {
printf("coda_create: LOCKLEAF not set!\n"); printf("coda_create: LOCKLEAF not set!\n");
} }
#endif /* DIAGNOSTIC */ #endif
} }
/* Have to free the previously saved name */ /* Have to free the previously saved name */
/* /*
@ -1530,13 +1541,13 @@ coda_rename(v)
/* Hmmm. The vnodes are already looked up. Perhaps they are locked? /* Hmmm. The vnodes are already looked up. Perhaps they are locked?
This could be Bad. XXX */ This could be Bad. XXX */
#ifdef DIAGNOSTIC #ifdef OLD_DIAGNOSTIC
if ((fcnp->cn_cred != tcnp->cn_cred) if ((fcnp->cn_cred != tcnp->cn_cred)
|| (fcnp->cn_proc != tcnp->cn_proc)) || (fcnp->cn_proc != tcnp->cn_proc))
{ {
panic("coda_rename: component names don't agree"); panic("coda_rename: component names don't agree");
} }
#endif DIAGNOSTIC #endif
/* Check for rename involving control object. */ /* Check for rename involving control object. */
if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) { if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) {
@ -1899,10 +1910,11 @@ coda_bmap(v)
cp = VTOC(vp); cp = VTOC(vp);
if (cp->c_ovp) { if (cp->c_ovp) {
printf("coda_bmap: container .. ");
ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb); ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb);
#if 0
printf("VOP_BMAP(cp->c_ovp %p, bn %p, vpp %p, bnp %p, ap->a_runp %p, ap->a_runb %p) = %d\n", printf("VOP_BMAP(cp->c_ovp %p, bn %p, vpp %p, bnp %p, ap->a_runp %p, ap->a_runb %p) = %d\n",
cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb, ret); cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb, ret);
#endif
return ret; return ret;
} else { } else {
printf("coda_bmap: no container\n"); printf("coda_bmap: no container\n");
@ -1956,13 +1968,13 @@ coda_reclaim(v)
} }
#endif #endif
} else { } else {
#ifdef DIAGNOSTIC #ifdef OLD_DIAGNOSTIC
if (vp->v_usecount != 0) if (vp->v_usecount != 0)
vprint("coda_reclaim: pushing active", vp); print("coda_reclaim: pushing active %p\n", vp);
if (VTOC(vp)->c_ovp) { if (VTOC(vp)->c_ovp) {
panic("coda_reclaim: c_ovp not void"); panic("coda_reclaim: c_ovp not void");
} }
#endif DIAGNOSTIC #endif
} }
cache_purge(vp); cache_purge(vp);
coda_free(VTOC(vp)); coda_free(VTOC(vp));

View File

@ -27,10 +27,17 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_fbsd.c,v 1.3 1998/09/11 18:50:16 rvb Exp $ * $Id: coda_fbsd.c,v 1.4 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
#ifdef ACTUALLY_LKM_NOT_KERNEL
#define NVCODA 4
#else
#include "vcoda.h"
#include "opt_devfs.h"
#endif
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h> #include <sys/kernel.h>
@ -47,9 +54,12 @@
#include <coda/coda.h> #include <coda/coda.h>
#include <coda/cnode.h> #include <coda/cnode.h>
#include <coda/coda_vnops.h> #include <coda/coda_vnops.h>
#include <coda/coda_psdev.h>
#ifdef DEVFS #ifdef DEVFS
#include <sys/devfsext.h> #include <sys/devfsext.h>
static void *devfs_token[NVCODA];
#endif #endif
/* /*
@ -66,15 +76,7 @@
#define VC_DEV_NO 93 #define VC_DEV_NO 93
/* Type of device methods. */ static struct cdevsw codadevsw =
extern d_open_t vc_nb_open;
extern d_close_t vc_nb_close;
extern d_read_t vc_nb_read;
extern d_write_t vc_nb_write;
extern d_ioctl_t vc_nb_ioctl;
extern d_poll_t vc_nb_poll;
static struct cdevsw vccdevsw =
{ {
vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, /*93*/ vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, /*93*/
vc_nb_ioctl, nostop, nullreset, nodevtotty, vc_nb_ioctl, nostop, nullreset, nodevtotty,
@ -82,7 +84,7 @@ static struct cdevsw vccdevsw =
}; };
void vcattach __P((void)); void vcattach __P((void));
static dev_t vccdev; static dev_t codadev;
int vcdebug = 1; int vcdebug = 1;
#define VCDEBUG if (vcdebug) printf #define VCDEBUG if (vcdebug) printf
@ -93,13 +95,13 @@ vcattach(void)
/* /*
* In case we are an LKM, set up device switch. * In case we are an LKM, set up device switch.
*/ */
if (0 == (vccdev = makedev(VC_DEV_NO, 0))) if (0 == (codadev = makedev(VC_DEV_NO, 0)))
VCDEBUG("makedev returned null\n"); VCDEBUG("makedev returned null\n");
else else
VCDEBUG("makedev OK.\n"); VCDEBUG("makedev OK.\n");
cdevsw_add(&vccdev, &vccdevsw, NULL); cdevsw_add(&codadev, &codadevsw, NULL);
VCDEBUG("coda: vccdevsw entry installed at %d.\n", major(vccdev)); VCDEBUG("coda: codadevsw entry installed at %d.\n", major(codadev));
} }
static vc_devsw_installed = 0; static vc_devsw_installed = 0;
@ -109,12 +111,28 @@ static void
vc_drvinit(void *unused) vc_drvinit(void *unused)
{ {
dev_t dev; dev_t dev;
#ifdef DEVFS
int i;
#endif
if( ! vc_devsw_installed ) { if( ! vc_devsw_installed ) {
dev = makedev(VC_DEV_NO, 0); dev = makedev(VC_DEV_NO, 0);
cdevsw_add(&dev,&vccdevsw, NULL); cdevsw_add(&dev,&codadevsw, NULL);
vc_devsw_installed = 1; vc_devsw_installed = 1;
} }
#ifdef DEVFS
for (i = 0; i < NVCODA; i++) {
devfs_token[i] =
devfs_add_devswf(&codadevsw, i
DV_CHR, 0, 0, 0666,
"cfs%d", i);
devfs_token[i] =
devfs_add_devswf(&codadevsw, i
DV_CHR, 0, 0, 0666,
"coda%d", i);
}
#endif
} }
int int
@ -202,4 +220,55 @@ coda_fbsd_putpages(v)
} }
SYSINIT(vccdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,vc_drvinit,NULL) SYSINIT(codadev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+VC_DEV_NO,vc_drvinit,NULL)
#ifdef ACTUALLY_LKM_NOT_KERNEL
#include <sys/mount.h>
#include <sys/lkm.h>
extern struct vfsops coda_vfsops;
static struct vfsconf _fs_vfsconf = { &coda_vfsops, "coda", -1, 0, 0 };
extern struct linker_set coda_modvnops ;
static struct lkm_vfs coda_mod_vfs = {
LM_VFS, LKM_VERSION, "coda", 0, &coda_modvnops, &_fs_vfsconf };
static struct lkm_dev coda_mod_dev = {
LM_DEV, LKM_VERSION, "codadev", VC_DEV_NO, LM_DT_CHAR, (void *) &codadevsw};
int coda_mod(struct lkm_table *, int, int);
int
coda_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
int error = 0;
if (ver != LKM_VERSION)
return EINVAL;
switch (cmd) {
case LKM_E_LOAD:
lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_dev;
error = lkmdispatch(lkmtp, cmd);
if (error)
break;
lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_vfs ;
error = lkmdispatch(lkmtp, cmd);
break;
case LKM_E_UNLOAD:
lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_vfs ;
error = lkmdispatch(lkmtp, cmd);
if (error)
break;
lkmtp->private.lkm_any = (struct lkm_any *) &coda_mod_dev;
error = lkmdispatch(lkmtp, cmd);
break;
case LKM_E_STAT:
error = lkmdispatch(lkmtp, cmd);
break;
}
return error;
}
#endif

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_namecache.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_namecache.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_namecache.c,v 1.4 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_namecache.c,v 1.5 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -47,6 +47,9 @@
/* /*
* HISTORY * HISTORY
* $Log: coda_namecache.c,v $ * $Log: coda_namecache.c,v $
* Revision 1.5 1998/09/13 13:57:59 rvb
* Finish conversion of cfs -> coda
*
* Revision 1.4 1998/09/11 18:50:17 rvb * Revision 1.4 1998/09/11 18:50:17 rvb
* All the references to cfs, in symbols, structs, and strings * All the references to cfs, in symbols, structs, and strings
* have been changed to coda. (Same for CFS.) * have been changed to coda. (Same for CFS.)
@ -232,6 +235,10 @@
#include <coda/cnode.h> #include <coda/cnode.h>
#include <coda/coda_namecache.h> #include <coda/coda_namecache.h>
#ifdef DEBUG
#include <coda/coda_vnops.h>
#endif
/* /*
* Declaration of the name cache data structure. * Declaration of the name cache data structure.
*/ */
@ -276,7 +283,9 @@ coda_nc_init(void)
bzero(&coda_nc_stat, (sizeof(struct coda_nc_statistics))); bzero(&coda_nc_stat, (sizeof(struct coda_nc_statistics)));
#ifdef DIAGNOSTIC
printf("CODA NAME CACHE: CACHE %d, HASH TBL %d\n", CODA_NC_CACHESIZE, CODA_NC_HASHSIZE); printf("CODA NAME CACHE: CACHE %d, HASH TBL %d\n", CODA_NC_CACHESIZE, CODA_NC_HASHSIZE);
#endif
CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE); CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE);
CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE); CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE);
@ -868,7 +877,6 @@ coda_nc_resize(hashsize, heapsize, dcstat)
return(0); return(0);
} }
#define DEBUG
#ifdef DEBUG #ifdef DEBUG
char coda_nc_name_buf[CODA_MAXNAMLEN+1]; char coda_nc_name_buf[CODA_MAXNAMLEN+1];

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_psdev.c,v 1.3 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_psdev.c,v 1.4 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -53,6 +53,9 @@
/* /*
* HISTORY * HISTORY
* $Log: coda_psdev.c,v $ * $Log: coda_psdev.c,v $
* Revision 1.4 1998/09/13 13:57:59 rvb
* Finish conversion of cfs -> coda
*
* Revision 1.3 1998/09/11 18:50:17 rvb * Revision 1.3 1998/09/11 18:50:17 rvb
* All the references to cfs, in symbols, structs, and strings * All the references to cfs, in symbols, structs, and strings
* have been changed to coda. (Same for CFS.) * have been changed to coda. (Same for CFS.)
@ -158,7 +161,11 @@
extern int coda_nc_initialized; /* Set if cache has been initialized */ extern int coda_nc_initialized; /* Set if cache has been initialized */
#ifdef ACTUALLY_LKM_NOT_KERNEL
#define NVCODA 4
#else
#include <vcoda.h> #include <vcoda.h>
#endif
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -175,6 +182,7 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */
#include <coda/cnode.h> #include <coda/cnode.h>
#include <coda/coda_namecache.h> #include <coda/coda_namecache.h>
#include <coda/coda_io.h> #include <coda/coda_io.h>
#include <coda/coda_psdev.h>
#define CTL_C #define CTL_C
@ -183,12 +191,6 @@ int coda_psdev_print_entry = 0;
#define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) #define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
void vcodaattach(int n); void vcodaattach(int n);
int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p);
int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p);
int vc_nb_read(dev_t dev, struct uio *uiop, int flag);
int vc_nb_write(dev_t dev, struct uio *uiop, int flag);
int vc_nb_ioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p);
int vc_nb_poll(dev_t dev, int events, struct proc *p);
struct vmsg { struct vmsg {
struct queue vm_chain; struct queue vm_chain;
@ -340,7 +342,7 @@ vc_nb_read(dev, uiop, flag)
error = EINVAL; error = EINVAL;
} }
#ifdef DIAGNOSTIC #ifdef OLD_DIAGNOSTIC
if (vmp->vm_chain.forw == 0 || vmp->vm_chain.back == 0) if (vmp->vm_chain.forw == 0 || vmp->vm_chain.back == 0)
panic("vc_nb_read: bad chain"); panic("vc_nb_read: bad chain");
#endif #endif
@ -467,7 +469,7 @@ vc_nb_write(dev, uiop, flag)
int int
vc_nb_ioctl(dev, cmd, addr, flag, p) vc_nb_ioctl(dev, cmd, addr, flag, p)
dev_t dev; dev_t dev;
int cmd; u_long cmd;
caddr_t addr; caddr_t addr;
int flag; int flag;
struct proc *p; struct proc *p;
@ -619,20 +621,26 @@ coda_call(mntinfo, inSize, outSize, buffer)
if (error == 0) if (error == 0)
break; break;
else if (error == EWOULDBLOCK) { else if (error == EWOULDBLOCK) {
#ifdef DIAGNOSTIC
printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i); printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i);
#endif
} else if (p->p_siglist == sigmask(SIGIO)) { } else if (p->p_siglist == sigmask(SIGIO)) {
p->p_sigmask |= p->p_siglist; p->p_sigmask |= p->p_siglist;
#ifdef DIAGNOSTIC
printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i);
#endif
} else { } else {
printf("coda_call: tsleep returns %d, cnt %d\n", error, i); printf("coda_call: tsleep returns %d, cnt %d\n", error, i);
printf("coda_call: siglist = %x, sigmask = %x, mask %x\n", printf("coda_call: siglist = %x, sigmask = %x, mask %x\n",
p->p_siglist, p->p_sigmask, p->p_siglist, p->p_sigmask,
p->p_siglist & ~p->p_sigmask); p->p_siglist & ~p->p_sigmask);
break; break;
#ifdef notyet
p->p_sigmask |= p->p_siglist; p->p_sigmask |= p->p_siglist;
printf("coda_call: new mask, siglist = %x, sigmask = %x, mask %x\n", printf("coda_call: new mask, siglist = %x, sigmask = %x, mask %x\n",
p->p_siglist, p->p_sigmask, p->p_siglist, p->p_sigmask,
p->p_siglist & ~p->p_sigmask); p->p_siglist & ~p->p_sigmask);
#endif
} }
} while (error && i++ < 128); } while (error && i++ < 128);
p->p_sigmask = psig_omask; p->p_sigmask = psig_omask;
@ -648,7 +656,11 @@ coda_call(mntinfo, inSize, outSize, buffer)
else if (!(vmp->vm_flags & VM_READ)) { else if (!(vmp->vm_flags & VM_READ)) {
/* Interrupted before venus read it. */ /* Interrupted before venus read it. */
if (codadebug||1) #ifdef DIAGNOSTIC
if (1)
#else
if (codadebug)
#endif
myprintf(("interrupted before read: op = %d.%d, flags = %x\n", myprintf(("interrupted before read: op = %d.%d, flags = %x\n",
vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));
REMQUE(vmp->vm_chain); REMQUE(vmp->vm_chain);
@ -662,7 +674,11 @@ coda_call(mntinfo, inSize, outSize, buffer)
struct coda_in_hdr *dog; struct coda_in_hdr *dog;
struct vmsg *svmp; struct vmsg *svmp;
if (codadebug||1) #ifdef DIAGNOSTIC
if (1)
#else
if (codadebug)
#endif
myprintf(("Sending Venus a signal: op = %d.%d, flags = %x\n", myprintf(("Sending Venus a signal: op = %d.%d, flags = %x\n",
vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_subr.c,v 1.4 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_subr.c,v 1.5 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -46,6 +46,9 @@
/* /*
* HISTORY * HISTORY
* $Log: coda_subr.c,v $ * $Log: coda_subr.c,v $
* Revision 1.5 1998/09/13 13:57:59 rvb
* Finish conversion of cfs -> coda
*
* Revision 1.4 1998/09/11 18:50:17 rvb * Revision 1.4 1998/09/11 18:50:17 rvb
* All the references to cfs, in symbols, structs, and strings * All the references to cfs, in symbols, structs, and strings
* have been changed to coda. (Same for CFS.) * have been changed to coda. (Same for CFS.)
@ -210,7 +213,11 @@
* 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address
*/ */
#ifdef ACTUALLY_LKM_NOT_KERNEL
#define NVCODA 4
#else
#include <vcoda.h> #include <vcoda.h>
#endif
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -460,6 +467,7 @@ coda_unmounting(whoIam)
} }
#ifdef DEBUG #ifdef DEBUG
void
coda_checkunmounting(mp) coda_checkunmounting(mp)
struct mount *mp; struct mount *mp;
{ {
@ -481,7 +489,7 @@ coda_checkunmounting(mp)
} }
} }
int void
coda_cacheprint(whoIam) coda_cacheprint(whoIam)
struct mount *whoIam; struct mount *whoIam;
{ {
@ -490,7 +498,7 @@ coda_cacheprint(whoIam)
int count = 0; int count = 0;
printf("coda_cacheprint: coda_ctlvp %p, cp %p", coda_ctlvp, VTOC(coda_ctlvp)); printf("coda_cacheprint: coda_ctlvp %p, cp %p", coda_ctlvp, VTOC(coda_ctlvp));
coda_nc_name(coda_ctlvp); coda_nc_name(VTOC(coda_ctlvp));
printf("\n"); printf("\n");
for (hash = 0; hash < CODA_CACHESIZE; hash++) { for (hash = 0; hash < CODA_CACHESIZE; hash++) {

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_subr.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_subr.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_subr.h,v 1.4 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_subr.h,v 1.5 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -36,8 +36,8 @@ void coda_free(struct cnode *cp);
struct cnode *coda_find(ViceFid *fid); struct cnode *coda_find(ViceFid *fid);
void coda_flush(enum dc_status dcstat); void coda_flush(enum dc_status dcstat);
void coda_testflush(void); void coda_testflush(void);
int coda_checkunmounting(struct mount *mp); void coda_checkunmounting(struct mount *mp);
int coda_cacheprint(struct mount *whoIam); void coda_cacheprint(struct mount *whoIam);
void coda_debugon(void); void coda_debugon(void);
void coda_debugoff(void); void coda_debugoff(void);
int coda_kill(struct mount *whoIam, enum dc_status dcstat); int coda_kill(struct mount *whoIam, enum dc_status dcstat);

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_vfsops.c,v 1.4 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_vfsops.c,v 1.5 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -47,6 +47,9 @@
/* /*
* HISTORY * HISTORY
* $Log: coda_vfsops.c,v $ * $Log: coda_vfsops.c,v $
* Revision 1.5 1998/09/13 13:57:59 rvb
* Finish conversion of cfs -> coda
*
* Revision 1.4 1998/09/11 18:50:17 rvb * Revision 1.4 1998/09/11 18:50:17 rvb
* All the references to cfs, in symbols, structs, and strings * All the references to cfs, in symbols, structs, and strings
* have been changed to coda. (Same for CFS.) * have been changed to coda. (Same for CFS.)
@ -181,7 +184,12 @@
* *
* *
*/ */
#ifdef ACTUALLY_LKM_NOT_KERNEL
#define NVCODA 4
#else
#include <vcoda.h> #include <vcoda.h>
#endif
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -223,24 +231,6 @@ struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE];
extern int coda_nc_initialized; /* Set if cache has been initialized */ extern int coda_nc_initialized; /* Set if cache has been initialized */
extern int vc_nb_open __P((dev_t, int, int, struct proc *)); extern int vc_nb_open __P((dev_t, int, int, struct proc *));
struct vfsops coda_vfsops = {
coda_mount,
coda_start,
coda_unmount,
coda_root,
coda_quotactl,
coda_nb_statfs,
coda_sync,
coda_vget,
(int (*) (struct mount *, struct fid *, struct sockaddr *, struct vnode **,
int *, struct ucred **))
eopnotsupp,
(int (*) (struct vnode *, struct fid *)) eopnotsupp,
coda_init,
};
VFS_SET(coda_vfsops, coda, VFCF_NETWORK);
int int
coda_vfsopstats_init(void) coda_vfsopstats_init(void)
{ {
@ -727,3 +717,28 @@ struct mount *devtomp(dev)
/* mount structure wasn't found */ /* mount structure wasn't found */
return(NULL); return(NULL);
} }
struct vfsops coda_vfsops = {
coda_mount,
coda_start,
coda_unmount,
coda_root,
coda_quotactl,
coda_nb_statfs,
coda_sync,
coda_vget,
(int (*) (struct mount *, struct fid *, struct sockaddr *, struct vnode **,
int *, struct ucred **))
eopnotsupp,
(int (*) (struct vnode *, struct fid *)) eopnotsupp,
coda_init,
};
#ifdef ACTUALLY_LKM_NOT_KERNEL
/*
* This case is being handled in coda_fbsd.c
* What we want is too hairy for VFS_SET to get right!
*/
#else
VFS_SET(coda_vfsops, coda, VFCF_NETWORK);
#endif

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance. * Mellon the rights to redistribute these changes without encumbrance.
* *
* @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_vnops.c,v 1.3 1998/09/11 18:50:17 rvb Exp $ * $Id: coda_vnops.c,v 1.4 1998/09/13 13:57:59 rvb Exp $
* *
*/ */
@ -48,6 +48,9 @@
/* /*
* HISTORY * HISTORY
* $Log: coda_vnops.c,v $ * $Log: coda_vnops.c,v $
* Revision 1.4 1998/09/13 13:57:59 rvb
* Finish conversion of cfs -> coda
*
* Revision 1.3 1998/09/11 18:50:17 rvb * Revision 1.3 1998/09/11 18:50:17 rvb
* All the references to cfs, in symbols, structs, and strings * All the references to cfs, in symbols, structs, and strings
* have been changed to coda. (Same for CFS.) * have been changed to coda. (Same for CFS.)
@ -291,38 +294,38 @@ struct vnodeopv_entry_desc coda_vnodeop_entries[] = {
{ &vop_default_desc, coda_vop_error }, { &vop_default_desc, coda_vop_error },
{ &vop_lookup_desc, coda_lookup }, /* lookup */ { &vop_lookup_desc, coda_lookup }, /* lookup */
{ &vop_create_desc, coda_create }, /* create */ { &vop_create_desc, coda_create }, /* create */
{ &vop_mknod_desc, coda_vop_error }, /* mknod */ { &vop_mknod_desc, coda_vop_error }, /* mknod */
{ &vop_open_desc, coda_open }, /* open */ { &vop_open_desc, coda_open }, /* open */
{ &vop_close_desc, coda_close }, /* close */ { &vop_close_desc, coda_close }, /* close */
{ &vop_access_desc, coda_access }, /* access */ { &vop_access_desc, coda_access }, /* access */
{ &vop_getattr_desc, coda_getattr }, /* getattr */ { &vop_getattr_desc, coda_getattr }, /* getattr */
{ &vop_setattr_desc, coda_setattr }, /* setattr */ { &vop_setattr_desc, coda_setattr }, /* setattr */
{ &vop_read_desc, coda_read }, /* read */ { &vop_read_desc, coda_read }, /* read */
{ &vop_write_desc, coda_write }, /* write */ { &vop_write_desc, coda_write }, /* write */
{ &vop_ioctl_desc, coda_ioctl }, /* ioctl */ { &vop_ioctl_desc, coda_ioctl }, /* ioctl */
{ &vop_mmap_desc, coda_vop_error }, /* mmap */ { &vop_mmap_desc, coda_vop_error }, /* mmap */
{ &vop_fsync_desc, coda_fsync }, /* fsync */ { &vop_fsync_desc, coda_fsync }, /* fsync */
{ &vop_remove_desc, coda_remove }, /* remove */ { &vop_remove_desc, coda_remove }, /* remove */
{ &vop_link_desc, coda_link }, /* link */ { &vop_link_desc, coda_link }, /* link */
{ &vop_rename_desc, coda_rename }, /* rename */ { &vop_rename_desc, coda_rename }, /* rename */
{ &vop_mkdir_desc, coda_mkdir }, /* mkdir */ { &vop_mkdir_desc, coda_mkdir }, /* mkdir */
{ &vop_rmdir_desc, coda_rmdir }, /* rmdir */ { &vop_rmdir_desc, coda_rmdir }, /* rmdir */
{ &vop_symlink_desc, coda_symlink }, /* symlink */ { &vop_symlink_desc, coda_symlink }, /* symlink */
{ &vop_readdir_desc, coda_readdir }, /* readdir */ { &vop_readdir_desc, coda_readdir }, /* readdir */
{ &vop_readlink_desc, coda_readlink }, /* readlink */ { &vop_readlink_desc, coda_readlink }, /* readlink */
{ &vop_abortop_desc, coda_abortop }, /* abortop */ { &vop_abortop_desc, coda_abortop }, /* abortop */
{ &vop_inactive_desc, coda_inactive }, /* inactive */ { &vop_inactive_desc, coda_inactive }, /* inactive */
{ &vop_reclaim_desc, coda_reclaim }, /* reclaim */ { &vop_reclaim_desc, coda_reclaim }, /* reclaim */
{ &vop_lock_desc, coda_lock }, /* lock */ { &vop_lock_desc, coda_lock }, /* lock */
{ &vop_unlock_desc, coda_unlock }, /* unlock */ { &vop_unlock_desc, coda_unlock }, /* unlock */
{ &vop_bmap_desc, coda_bmap }, /* bmap */ { &vop_bmap_desc, coda_bmap }, /* bmap */
{ &vop_strategy_desc, coda_strategy }, /* strategy */ { &vop_strategy_desc, coda_strategy }, /* strategy */
{ &vop_print_desc, coda_vop_error }, /* print */ { &vop_print_desc, coda_vop_error }, /* print */
{ &vop_islocked_desc, coda_islocked }, /* islocked */ { &vop_islocked_desc, coda_islocked }, /* islocked */
{ &vop_pathconf_desc, coda_vop_error }, /* pathconf */ { &vop_pathconf_desc, coda_vop_error }, /* pathconf */
{ &vop_advlock_desc, coda_vop_nop }, /* advlock */ { &vop_advlock_desc, coda_vop_nop }, /* advlock */
{ &vop_bwrite_desc, coda_vop_error }, /* bwrite */ { &vop_bwrite_desc, coda_vop_error }, /* bwrite */
{ &vop_lease_desc, coda_vop_nop }, /* lease */ { &vop_lease_desc, coda_vop_nop }, /* lease */
{ &vop_poll_desc, (vop_t *) vop_stdpoll }, { &vop_poll_desc, (vop_t *) vop_stdpoll },
{ &vop_getpages_desc, coda_fbsd_getpages }, /* pager intf.*/ { &vop_getpages_desc, coda_fbsd_getpages }, /* pager intf.*/
{ &vop_putpages_desc, coda_fbsd_putpages }, /* pager intf.*/ { &vop_putpages_desc, coda_fbsd_putpages }, /* pager intf.*/
@ -473,6 +476,7 @@ coda_open(v)
printf("coda_open: VOP_OPEN on container failed %d\n", error); printf("coda_open: VOP_OPEN on container failed %d\n", error);
return (error); return (error);
} }
/* grab (above) does this when it calls newvnode unless it's in the cache*/
if (vp->v_type == VREG) { if (vp->v_type == VREG) {
error = vfs_object_create(vp, p, cred, 1); error = vfs_object_create(vp, p, cred, 1);
if (error != 0) { if (error != 0) {
@ -480,6 +484,7 @@ coda_open(v)
vput(vp); vput(vp);
} }
} }
return(error); return(error);
} }
@ -510,11 +515,15 @@ coda_close(v)
if (IS_UNMOUNTING(cp)) { if (IS_UNMOUNTING(cp)) {
if (cp->c_ovp) { if (cp->c_ovp) {
#ifdef DIAGNOSTIC
printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n", printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n",
vp->v_usecount, cp->c_ovp, vp, cp); vp->v_usecount, cp->c_ovp, vp, cp);
#endif
vgone(cp->c_ovp); vgone(cp->c_ovp);
} else { } else {
#ifdef DIAGNOSTIC
printf("coda_close: NO container vp %p/cp %p\n", vp, cp); printf("coda_close: NO container vp %p/cp %p\n", vp, cp);
#endif
} }
return ENODEV; return ENODEV;
} else { } else {
@ -643,11 +652,13 @@ printf("coda_rdwr: Internally Opening %p\n", vp);
cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Volume, cp->c_fid.Vnode,
cp->c_fid.Unique, CTOV(cp)->v_usecount)); ) cp->c_fid.Unique, CTOV(cp)->v_usecount)); )
if (rw == UIO_READ) { if (rw == UIO_READ) {
error = VOP_READ(cfvp, uiop, ioflag, cred); error = VOP_READ(cfvp, uiop, ioflag, cred);
} else { } else {
error = VOP_WRITE(cfvp, uiop, ioflag, cred); error = VOP_WRITE(cfvp, uiop, ioflag, cred);
/* ufs_write updates the vnode_pager_setsize for the vnode/object */ /* ufs_write updates the vnode_pager_setsize for the vnode/object */
{ struct vattr attr; { struct vattr attr;
if (VOP_GETATTR(cfvp, &attr, cred, p) == 0) { if (VOP_GETATTR(cfvp, &attr, cred, p) == 0) {
@ -1101,7 +1112,7 @@ coda_inactive(v)
#endif #endif
lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p);
} else { } else {
#ifdef DIAGNOSTIC #ifdef OLD_DIAGNOSTIC
if (CTOV(cp)->v_usecount) { if (CTOV(cp)->v_usecount) {
panic("coda_inactive: nonzero reference count"); panic("coda_inactive: nonzero reference count");
} }
@ -1366,11 +1377,11 @@ coda_create(v)
panic("unlocked parent but couldn't lock child"); panic("unlocked parent but couldn't lock child");
} }
} }
#ifdef DIAGNOSTIC #ifdef OLD_DIAGNOSTIC
else { else {
printf("coda_create: LOCKLEAF not set!\n"); printf("coda_create: LOCKLEAF not set!\n");
} }
#endif /* DIAGNOSTIC */ #endif
} }
/* Have to free the previously saved name */ /* Have to free the previously saved name */
/* /*
@ -1530,13 +1541,13 @@ coda_rename(v)
/* Hmmm. The vnodes are already looked up. Perhaps they are locked? /* Hmmm. The vnodes are already looked up. Perhaps they are locked?
This could be Bad. XXX */ This could be Bad. XXX */
#ifdef DIAGNOSTIC #ifdef OLD_DIAGNOSTIC
if ((fcnp->cn_cred != tcnp->cn_cred) if ((fcnp->cn_cred != tcnp->cn_cred)
|| (fcnp->cn_proc != tcnp->cn_proc)) || (fcnp->cn_proc != tcnp->cn_proc))
{ {
panic("coda_rename: component names don't agree"); panic("coda_rename: component names don't agree");
} }
#endif DIAGNOSTIC #endif
/* Check for rename involving control object. */ /* Check for rename involving control object. */
if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) { if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) {
@ -1899,10 +1910,11 @@ coda_bmap(v)
cp = VTOC(vp); cp = VTOC(vp);
if (cp->c_ovp) { if (cp->c_ovp) {
printf("coda_bmap: container .. ");
ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb); ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb);
#if 0
printf("VOP_BMAP(cp->c_ovp %p, bn %p, vpp %p, bnp %p, ap->a_runp %p, ap->a_runb %p) = %d\n", printf("VOP_BMAP(cp->c_ovp %p, bn %p, vpp %p, bnp %p, ap->a_runp %p, ap->a_runb %p) = %d\n",
cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb, ret); cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb, ret);
#endif
return ret; return ret;
} else { } else {
printf("coda_bmap: no container\n"); printf("coda_bmap: no container\n");
@ -1956,13 +1968,13 @@ coda_reclaim(v)
} }
#endif #endif
} else { } else {
#ifdef DIAGNOSTIC #ifdef OLD_DIAGNOSTIC
if (vp->v_usecount != 0) if (vp->v_usecount != 0)
vprint("coda_reclaim: pushing active", vp); print("coda_reclaim: pushing active %p\n", vp);
if (VTOC(vp)->c_ovp) { if (VTOC(vp)->c_ovp) {
panic("coda_reclaim: c_ovp not void"); panic("coda_reclaim: c_ovp not void");
} }
#endif DIAGNOSTIC #endif
} }
cache_purge(vp); cache_purge(vp);
coda_free(VTOC(vp)); coda_free(VTOC(vp));