From dc7702617897a904bb61059ce05dfb7221de3d8d Mon Sep 17 00:00:00 2001 From: rvb Date: Fri, 25 Sep 1998 17:38:32 +0000 Subject: [PATCH] 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.) --- sys/coda/coda_fbsd.c | 101 +++++++++++++++++++++++++++++------ sys/coda/coda_namecache.c | 12 ++++- sys/coda/coda_psdev.c | 38 +++++++++---- sys/coda/coda_subr.c | 14 +++-- sys/coda/coda_subr.h | 6 +-- sys/coda/coda_vfsops.c | 53 +++++++++++------- sys/coda/coda_vnops.c | 58 ++++++++++++-------- sys/fs/coda/coda_fbsd.c | 101 +++++++++++++++++++++++++++++------ sys/fs/coda/coda_namecache.c | 12 ++++- sys/fs/coda/coda_psdev.c | 38 +++++++++---- sys/fs/coda/coda_subr.c | 14 +++-- sys/fs/coda/coda_subr.h | 6 +-- sys/fs/coda/coda_vfsops.c | 53 +++++++++++------- sys/fs/coda/coda_vnops.c | 58 ++++++++++++-------- 14 files changed, 410 insertions(+), 154 deletions(-) diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index a334745e398d..10c18a822a4d 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -27,10 +27,17 @@ * 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 $ - * $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 #include #include @@ -47,9 +54,12 @@ #include #include #include +#include #ifdef DEVFS #include + +static void *devfs_token[NVCODA]; #endif /* @@ -66,15 +76,7 @@ #define VC_DEV_NO 93 -/* Type of device methods. */ -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 = +static struct cdevsw codadevsw = { vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, /*93*/ vc_nb_ioctl, nostop, nullreset, nodevtotty, @@ -82,7 +84,7 @@ static struct cdevsw vccdevsw = }; void vcattach __P((void)); -static dev_t vccdev; +static dev_t codadev; int vcdebug = 1; #define VCDEBUG if (vcdebug) printf @@ -93,13 +95,13 @@ vcattach(void) /* * 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"); else VCDEBUG("makedev OK.\n"); - cdevsw_add(&vccdev, &vccdevsw, NULL); - VCDEBUG("coda: vccdevsw entry installed at %d.\n", major(vccdev)); + cdevsw_add(&codadev, &codadevsw, NULL); + VCDEBUG("coda: codadevsw entry installed at %d.\n", major(codadev)); } static vc_devsw_installed = 0; @@ -109,12 +111,28 @@ static void vc_drvinit(void *unused) { dev_t dev; +#ifdef DEVFS + int i; +#endif if( ! vc_devsw_installed ) { dev = makedev(VC_DEV_NO, 0); - cdevsw_add(&dev,&vccdevsw, NULL); + cdevsw_add(&dev,&codadevsw, NULL); 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 @@ -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 +#include + +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 diff --git a/sys/coda/coda_namecache.c b/sys/coda/coda_namecache.c index 44cc4da6f1c2..ae64047aaabc 100644 --- a/sys/coda/coda_namecache.c +++ b/sys/coda/coda_namecache.c @@ -27,7 +27,7 @@ * 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 $ - * $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 * $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 * All the references to cfs, in symbols, structs, and strings * have been changed to coda. (Same for CFS.) @@ -232,6 +235,10 @@ #include #include +#ifdef DEBUG +#include +#endif + /* * Declaration of the name cache data structure. */ @@ -276,7 +283,9 @@ coda_nc_init(void) 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); +#endif CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE); CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE); @@ -868,7 +877,6 @@ coda_nc_resize(hashsize, heapsize, dcstat) return(0); } -#define DEBUG #ifdef DEBUG char coda_nc_name_buf[CODA_MAXNAMLEN+1]; diff --git a/sys/coda/coda_psdev.c b/sys/coda/coda_psdev.c index 9edc7d527f0f..fefc4190b6d3 100644 --- a/sys/coda/coda_psdev.c +++ b/sys/coda/coda_psdev.c @@ -27,7 +27,7 @@ * 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 $ - * $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 * $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 * All the references to cfs, in symbols, structs, and strings * have been changed to coda. (Same for CFS.) @@ -158,7 +161,11 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */ +#ifdef ACTUALLY_LKM_NOT_KERNEL +#define NVCODA 4 +#else #include +#endif #include #include @@ -175,6 +182,7 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */ #include #include #include +#include #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__)) 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 queue vm_chain; @@ -340,7 +342,7 @@ vc_nb_read(dev, uiop, flag) error = EINVAL; } -#ifdef DIAGNOSTIC +#ifdef OLD_DIAGNOSTIC if (vmp->vm_chain.forw == 0 || vmp->vm_chain.back == 0) panic("vc_nb_read: bad chain"); #endif @@ -467,7 +469,7 @@ vc_nb_write(dev, uiop, flag) int vc_nb_ioctl(dev, cmd, addr, flag, p) dev_t dev; - int cmd; + u_long cmd; caddr_t addr; int flag; struct proc *p; @@ -619,20 +621,26 @@ coda_call(mntinfo, inSize, outSize, buffer) if (error == 0) break; else if (error == EWOULDBLOCK) { +#ifdef DIAGNOSTIC printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i); +#endif } else if (p->p_siglist == sigmask(SIGIO)) { p->p_sigmask |= p->p_siglist; +#ifdef DIAGNOSTIC printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); +#endif } else { printf("coda_call: tsleep returns %d, cnt %d\n", error, i); printf("coda_call: siglist = %x, sigmask = %x, mask %x\n", p->p_siglist, p->p_sigmask, p->p_siglist & ~p->p_sigmask); break; +#ifdef notyet p->p_sigmask |= p->p_siglist; printf("coda_call: new mask, siglist = %x, sigmask = %x, mask %x\n", p->p_siglist, p->p_sigmask, p->p_siglist & ~p->p_sigmask); +#endif } } while (error && i++ < 128); p->p_sigmask = psig_omask; @@ -648,7 +656,11 @@ coda_call(mntinfo, inSize, outSize, buffer) else if (!(vmp->vm_flags & VM_READ)) { /* 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", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); REMQUE(vmp->vm_chain); @@ -662,7 +674,11 @@ coda_call(mntinfo, inSize, outSize, buffer) struct coda_in_hdr *dog; 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", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); diff --git a/sys/coda/coda_subr.c b/sys/coda/coda_subr.c index 6e3d0e29c3b0..58620f7053ec 100644 --- a/sys/coda/coda_subr.c +++ b/sys/coda/coda_subr.c @@ -27,7 +27,7 @@ * 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 $ - * $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 * $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 * All the references to cfs, in symbols, structs, and strings * have been changed to coda. (Same for CFS.) @@ -210,7 +213,11 @@ * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address */ +#ifdef ACTUALLY_LKM_NOT_KERNEL +#define NVCODA 4 +#else #include +#endif #include #include @@ -460,6 +467,7 @@ coda_unmounting(whoIam) } #ifdef DEBUG +void coda_checkunmounting(mp) struct mount *mp; { @@ -481,7 +489,7 @@ coda_checkunmounting(mp) } } -int +void coda_cacheprint(whoIam) struct mount *whoIam; { @@ -490,7 +498,7 @@ coda_cacheprint(whoIam) int count = 0; 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"); for (hash = 0; hash < CODA_CACHESIZE; hash++) { diff --git a/sys/coda/coda_subr.h b/sys/coda/coda_subr.h index 73d9e1631532..fe27bfda19ce 100644 --- a/sys/coda/coda_subr.h +++ b/sys/coda/coda_subr.h @@ -27,7 +27,7 @@ * 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 $ - * $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); void coda_flush(enum dc_status dcstat); void coda_testflush(void); -int coda_checkunmounting(struct mount *mp); -int coda_cacheprint(struct mount *whoIam); +void coda_checkunmounting(struct mount *mp); +void coda_cacheprint(struct mount *whoIam); void coda_debugon(void); void coda_debugoff(void); int coda_kill(struct mount *whoIam, enum dc_status dcstat); diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c index 6b17cad696e9..59df97a11ab8 100644 --- a/sys/coda/coda_vfsops.c +++ b/sys/coda/coda_vfsops.c @@ -27,7 +27,7 @@ * 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 $ - * $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 * $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 * All the references to cfs, in symbols, structs, and strings * have been changed to coda. (Same for CFS.) @@ -181,7 +184,12 @@ * * */ + +#ifdef ACTUALLY_LKM_NOT_KERNEL +#define NVCODA 4 +#else #include +#endif #include #include @@ -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 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 coda_vfsopstats_init(void) { @@ -727,3 +717,28 @@ struct mount *devtomp(dev) /* mount structure wasn't found */ 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 diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index 567fb397c121..abb0ae0be583 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -27,7 +27,7 @@ * 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 $ - * $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 * $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 * All the references to cfs, in symbols, structs, and strings * 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_lookup_desc, coda_lookup }, /* lookup */ { &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_close_desc, coda_close }, /* close */ { &vop_access_desc, coda_access }, /* access */ - { &vop_getattr_desc, coda_getattr }, /* getattr */ - { &vop_setattr_desc, coda_setattr }, /* setattr */ + { &vop_getattr_desc, coda_getattr }, /* getattr */ + { &vop_setattr_desc, coda_setattr }, /* setattr */ { &vop_read_desc, coda_read }, /* read */ { &vop_write_desc, coda_write }, /* write */ { &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_remove_desc, coda_remove }, /* remove */ { &vop_link_desc, coda_link }, /* link */ { &vop_rename_desc, coda_rename }, /* rename */ { &vop_mkdir_desc, coda_mkdir }, /* mkdir */ { &vop_rmdir_desc, coda_rmdir }, /* rmdir */ - { &vop_symlink_desc, coda_symlink }, /* symlink */ - { &vop_readdir_desc, coda_readdir }, /* readdir */ + { &vop_symlink_desc, coda_symlink }, /* symlink */ + { &vop_readdir_desc, coda_readdir }, /* readdir */ { &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_reclaim_desc, coda_reclaim }, /* reclaim */ + { &vop_reclaim_desc, coda_reclaim }, /* reclaim */ { &vop_lock_desc, coda_lock }, /* lock */ { &vop_unlock_desc, coda_unlock }, /* unlock */ { &vop_bmap_desc, coda_bmap }, /* bmap */ { &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_pathconf_desc, coda_vop_error }, /* pathconf */ - { &vop_advlock_desc, coda_vop_nop }, /* advlock */ - { &vop_bwrite_desc, coda_vop_error }, /* bwrite */ - { &vop_lease_desc, coda_vop_nop }, /* lease */ + { &vop_pathconf_desc, coda_vop_error }, /* pathconf */ + { &vop_advlock_desc, coda_vop_nop }, /* advlock */ + { &vop_bwrite_desc, coda_vop_error }, /* bwrite */ + { &vop_lease_desc, coda_vop_nop }, /* lease */ { &vop_poll_desc, (vop_t *) vop_stdpoll }, { &vop_getpages_desc, coda_fbsd_getpages }, /* 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); return (error); } +/* grab (above) does this when it calls newvnode unless it's in the cache*/ if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { @@ -480,6 +484,7 @@ coda_open(v) vput(vp); } } + return(error); } @@ -510,11 +515,15 @@ coda_close(v) if (IS_UNMOUNTING(cp)) { if (cp->c_ovp) { +#ifdef DIAGNOSTIC printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n", vp->v_usecount, cp->c_ovp, vp, cp); +#endif vgone(cp->c_ovp); } else { +#ifdef DIAGNOSTIC printf("coda_close: NO container vp %p/cp %p\n", vp, cp); +#endif } return ENODEV; } else { @@ -643,11 +652,13 @@ printf("coda_rdwr: Internally Opening %p\n", vp); cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, CTOV(cp)->v_usecount)); ) + if (rw == UIO_READ) { error = VOP_READ(cfvp, uiop, ioflag, cred); } else { error = VOP_WRITE(cfvp, uiop, ioflag, cred); /* ufs_write updates the vnode_pager_setsize for the vnode/object */ + { struct vattr attr; if (VOP_GETATTR(cfvp, &attr, cred, p) == 0) { @@ -1101,7 +1112,7 @@ coda_inactive(v) #endif lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); } else { -#ifdef DIAGNOSTIC +#ifdef OLD_DIAGNOSTIC if (CTOV(cp)->v_usecount) { panic("coda_inactive: nonzero reference count"); } @@ -1366,11 +1377,11 @@ coda_create(v) panic("unlocked parent but couldn't lock child"); } } -#ifdef DIAGNOSTIC +#ifdef OLD_DIAGNOSTIC else { printf("coda_create: LOCKLEAF not set!\n"); } -#endif /* DIAGNOSTIC */ +#endif } /* 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? This could be Bad. XXX */ -#ifdef DIAGNOSTIC +#ifdef OLD_DIAGNOSTIC if ((fcnp->cn_cred != tcnp->cn_cred) || (fcnp->cn_proc != tcnp->cn_proc)) { panic("coda_rename: component names don't agree"); } -#endif DIAGNOSTIC +#endif /* Check for rename involving control object. */ if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) { @@ -1899,10 +1910,11 @@ coda_bmap(v) cp = VTOC(vp); if (cp->c_ovp) { - printf("coda_bmap: container .. "); 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", cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb, ret); +#endif return ret; } else { printf("coda_bmap: no container\n"); @@ -1956,13 +1968,13 @@ coda_reclaim(v) } #endif } else { -#ifdef DIAGNOSTIC +#ifdef OLD_DIAGNOSTIC if (vp->v_usecount != 0) - vprint("coda_reclaim: pushing active", vp); + print("coda_reclaim: pushing active %p\n", vp); if (VTOC(vp)->c_ovp) { panic("coda_reclaim: c_ovp not void"); } -#endif DIAGNOSTIC +#endif } cache_purge(vp); coda_free(VTOC(vp)); diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c index a334745e398d..10c18a822a4d 100644 --- a/sys/fs/coda/coda_fbsd.c +++ b/sys/fs/coda/coda_fbsd.c @@ -27,10 +27,17 @@ * 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 $ - * $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 #include #include @@ -47,9 +54,12 @@ #include #include #include +#include #ifdef DEVFS #include + +static void *devfs_token[NVCODA]; #endif /* @@ -66,15 +76,7 @@ #define VC_DEV_NO 93 -/* Type of device methods. */ -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 = +static struct cdevsw codadevsw = { vc_nb_open, vc_nb_close, vc_nb_read, vc_nb_write, /*93*/ vc_nb_ioctl, nostop, nullreset, nodevtotty, @@ -82,7 +84,7 @@ static struct cdevsw vccdevsw = }; void vcattach __P((void)); -static dev_t vccdev; +static dev_t codadev; int vcdebug = 1; #define VCDEBUG if (vcdebug) printf @@ -93,13 +95,13 @@ vcattach(void) /* * 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"); else VCDEBUG("makedev OK.\n"); - cdevsw_add(&vccdev, &vccdevsw, NULL); - VCDEBUG("coda: vccdevsw entry installed at %d.\n", major(vccdev)); + cdevsw_add(&codadev, &codadevsw, NULL); + VCDEBUG("coda: codadevsw entry installed at %d.\n", major(codadev)); } static vc_devsw_installed = 0; @@ -109,12 +111,28 @@ static void vc_drvinit(void *unused) { dev_t dev; +#ifdef DEVFS + int i; +#endif if( ! vc_devsw_installed ) { dev = makedev(VC_DEV_NO, 0); - cdevsw_add(&dev,&vccdevsw, NULL); + cdevsw_add(&dev,&codadevsw, NULL); 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 @@ -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 +#include + +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 diff --git a/sys/fs/coda/coda_namecache.c b/sys/fs/coda/coda_namecache.c index 44cc4da6f1c2..ae64047aaabc 100644 --- a/sys/fs/coda/coda_namecache.c +++ b/sys/fs/coda/coda_namecache.c @@ -27,7 +27,7 @@ * 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 $ - * $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 * $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 * All the references to cfs, in symbols, structs, and strings * have been changed to coda. (Same for CFS.) @@ -232,6 +235,10 @@ #include #include +#ifdef DEBUG +#include +#endif + /* * Declaration of the name cache data structure. */ @@ -276,7 +283,9 @@ coda_nc_init(void) 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); +#endif CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE); CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE); @@ -868,7 +877,6 @@ coda_nc_resize(hashsize, heapsize, dcstat) return(0); } -#define DEBUG #ifdef DEBUG char coda_nc_name_buf[CODA_MAXNAMLEN+1]; diff --git a/sys/fs/coda/coda_psdev.c b/sys/fs/coda/coda_psdev.c index 9edc7d527f0f..fefc4190b6d3 100644 --- a/sys/fs/coda/coda_psdev.c +++ b/sys/fs/coda/coda_psdev.c @@ -27,7 +27,7 @@ * 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 $ - * $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 * $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 * All the references to cfs, in symbols, structs, and strings * have been changed to coda. (Same for CFS.) @@ -158,7 +161,11 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */ +#ifdef ACTUALLY_LKM_NOT_KERNEL +#define NVCODA 4 +#else #include +#endif #include #include @@ -175,6 +182,7 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */ #include #include #include +#include #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__)) 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 queue vm_chain; @@ -340,7 +342,7 @@ vc_nb_read(dev, uiop, flag) error = EINVAL; } -#ifdef DIAGNOSTIC +#ifdef OLD_DIAGNOSTIC if (vmp->vm_chain.forw == 0 || vmp->vm_chain.back == 0) panic("vc_nb_read: bad chain"); #endif @@ -467,7 +469,7 @@ vc_nb_write(dev, uiop, flag) int vc_nb_ioctl(dev, cmd, addr, flag, p) dev_t dev; - int cmd; + u_long cmd; caddr_t addr; int flag; struct proc *p; @@ -619,20 +621,26 @@ coda_call(mntinfo, inSize, outSize, buffer) if (error == 0) break; else if (error == EWOULDBLOCK) { +#ifdef DIAGNOSTIC printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i); +#endif } else if (p->p_siglist == sigmask(SIGIO)) { p->p_sigmask |= p->p_siglist; +#ifdef DIAGNOSTIC printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); +#endif } else { printf("coda_call: tsleep returns %d, cnt %d\n", error, i); printf("coda_call: siglist = %x, sigmask = %x, mask %x\n", p->p_siglist, p->p_sigmask, p->p_siglist & ~p->p_sigmask); break; +#ifdef notyet p->p_sigmask |= p->p_siglist; printf("coda_call: new mask, siglist = %x, sigmask = %x, mask %x\n", p->p_siglist, p->p_sigmask, p->p_siglist & ~p->p_sigmask); +#endif } } while (error && i++ < 128); p->p_sigmask = psig_omask; @@ -648,7 +656,11 @@ coda_call(mntinfo, inSize, outSize, buffer) else if (!(vmp->vm_flags & VM_READ)) { /* 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", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); REMQUE(vmp->vm_chain); @@ -662,7 +674,11 @@ coda_call(mntinfo, inSize, outSize, buffer) struct coda_in_hdr *dog; 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", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); diff --git a/sys/fs/coda/coda_subr.c b/sys/fs/coda/coda_subr.c index 6e3d0e29c3b0..58620f7053ec 100644 --- a/sys/fs/coda/coda_subr.c +++ b/sys/fs/coda/coda_subr.c @@ -27,7 +27,7 @@ * 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 $ - * $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 * $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 * All the references to cfs, in symbols, structs, and strings * have been changed to coda. (Same for CFS.) @@ -210,7 +213,11 @@ * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address */ +#ifdef ACTUALLY_LKM_NOT_KERNEL +#define NVCODA 4 +#else #include +#endif #include #include @@ -460,6 +467,7 @@ coda_unmounting(whoIam) } #ifdef DEBUG +void coda_checkunmounting(mp) struct mount *mp; { @@ -481,7 +489,7 @@ coda_checkunmounting(mp) } } -int +void coda_cacheprint(whoIam) struct mount *whoIam; { @@ -490,7 +498,7 @@ coda_cacheprint(whoIam) int count = 0; 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"); for (hash = 0; hash < CODA_CACHESIZE; hash++) { diff --git a/sys/fs/coda/coda_subr.h b/sys/fs/coda/coda_subr.h index 73d9e1631532..fe27bfda19ce 100644 --- a/sys/fs/coda/coda_subr.h +++ b/sys/fs/coda/coda_subr.h @@ -27,7 +27,7 @@ * 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 $ - * $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); void coda_flush(enum dc_status dcstat); void coda_testflush(void); -int coda_checkunmounting(struct mount *mp); -int coda_cacheprint(struct mount *whoIam); +void coda_checkunmounting(struct mount *mp); +void coda_cacheprint(struct mount *whoIam); void coda_debugon(void); void coda_debugoff(void); int coda_kill(struct mount *whoIam, enum dc_status dcstat); diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c index 6b17cad696e9..59df97a11ab8 100644 --- a/sys/fs/coda/coda_vfsops.c +++ b/sys/fs/coda/coda_vfsops.c @@ -27,7 +27,7 @@ * 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 $ - * $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 * $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 * All the references to cfs, in symbols, structs, and strings * have been changed to coda. (Same for CFS.) @@ -181,7 +184,12 @@ * * */ + +#ifdef ACTUALLY_LKM_NOT_KERNEL +#define NVCODA 4 +#else #include +#endif #include #include @@ -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 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 coda_vfsopstats_init(void) { @@ -727,3 +717,28 @@ struct mount *devtomp(dev) /* mount structure wasn't found */ 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 diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index 567fb397c121..abb0ae0be583 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -27,7 +27,7 @@ * 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 $ - * $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 * $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 * All the references to cfs, in symbols, structs, and strings * 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_lookup_desc, coda_lookup }, /* lookup */ { &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_close_desc, coda_close }, /* close */ { &vop_access_desc, coda_access }, /* access */ - { &vop_getattr_desc, coda_getattr }, /* getattr */ - { &vop_setattr_desc, coda_setattr }, /* setattr */ + { &vop_getattr_desc, coda_getattr }, /* getattr */ + { &vop_setattr_desc, coda_setattr }, /* setattr */ { &vop_read_desc, coda_read }, /* read */ { &vop_write_desc, coda_write }, /* write */ { &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_remove_desc, coda_remove }, /* remove */ { &vop_link_desc, coda_link }, /* link */ { &vop_rename_desc, coda_rename }, /* rename */ { &vop_mkdir_desc, coda_mkdir }, /* mkdir */ { &vop_rmdir_desc, coda_rmdir }, /* rmdir */ - { &vop_symlink_desc, coda_symlink }, /* symlink */ - { &vop_readdir_desc, coda_readdir }, /* readdir */ + { &vop_symlink_desc, coda_symlink }, /* symlink */ + { &vop_readdir_desc, coda_readdir }, /* readdir */ { &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_reclaim_desc, coda_reclaim }, /* reclaim */ + { &vop_reclaim_desc, coda_reclaim }, /* reclaim */ { &vop_lock_desc, coda_lock }, /* lock */ { &vop_unlock_desc, coda_unlock }, /* unlock */ { &vop_bmap_desc, coda_bmap }, /* bmap */ { &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_pathconf_desc, coda_vop_error }, /* pathconf */ - { &vop_advlock_desc, coda_vop_nop }, /* advlock */ - { &vop_bwrite_desc, coda_vop_error }, /* bwrite */ - { &vop_lease_desc, coda_vop_nop }, /* lease */ + { &vop_pathconf_desc, coda_vop_error }, /* pathconf */ + { &vop_advlock_desc, coda_vop_nop }, /* advlock */ + { &vop_bwrite_desc, coda_vop_error }, /* bwrite */ + { &vop_lease_desc, coda_vop_nop }, /* lease */ { &vop_poll_desc, (vop_t *) vop_stdpoll }, { &vop_getpages_desc, coda_fbsd_getpages }, /* 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); return (error); } +/* grab (above) does this when it calls newvnode unless it's in the cache*/ if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { @@ -480,6 +484,7 @@ coda_open(v) vput(vp); } } + return(error); } @@ -510,11 +515,15 @@ coda_close(v) if (IS_UNMOUNTING(cp)) { if (cp->c_ovp) { +#ifdef DIAGNOSTIC printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n", vp->v_usecount, cp->c_ovp, vp, cp); +#endif vgone(cp->c_ovp); } else { +#ifdef DIAGNOSTIC printf("coda_close: NO container vp %p/cp %p\n", vp, cp); +#endif } return ENODEV; } else { @@ -643,11 +652,13 @@ printf("coda_rdwr: Internally Opening %p\n", vp); cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, CTOV(cp)->v_usecount)); ) + if (rw == UIO_READ) { error = VOP_READ(cfvp, uiop, ioflag, cred); } else { error = VOP_WRITE(cfvp, uiop, ioflag, cred); /* ufs_write updates the vnode_pager_setsize for the vnode/object */ + { struct vattr attr; if (VOP_GETATTR(cfvp, &attr, cred, p) == 0) { @@ -1101,7 +1112,7 @@ coda_inactive(v) #endif lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); } else { -#ifdef DIAGNOSTIC +#ifdef OLD_DIAGNOSTIC if (CTOV(cp)->v_usecount) { panic("coda_inactive: nonzero reference count"); } @@ -1366,11 +1377,11 @@ coda_create(v) panic("unlocked parent but couldn't lock child"); } } -#ifdef DIAGNOSTIC +#ifdef OLD_DIAGNOSTIC else { printf("coda_create: LOCKLEAF not set!\n"); } -#endif /* DIAGNOSTIC */ +#endif } /* 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? This could be Bad. XXX */ -#ifdef DIAGNOSTIC +#ifdef OLD_DIAGNOSTIC if ((fcnp->cn_cred != tcnp->cn_cred) || (fcnp->cn_proc != tcnp->cn_proc)) { panic("coda_rename: component names don't agree"); } -#endif DIAGNOSTIC +#endif /* Check for rename involving control object. */ if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) { @@ -1899,10 +1910,11 @@ coda_bmap(v) cp = VTOC(vp); if (cp->c_ovp) { - printf("coda_bmap: container .. "); 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", cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb, ret); +#endif return ret; } else { printf("coda_bmap: no container\n"); @@ -1956,13 +1968,13 @@ coda_reclaim(v) } #endif } else { -#ifdef DIAGNOSTIC +#ifdef OLD_DIAGNOSTIC if (vp->v_usecount != 0) - vprint("coda_reclaim: pushing active", vp); + print("coda_reclaim: pushing active %p\n", vp); if (VTOC(vp)->c_ovp) { panic("coda_reclaim: c_ovp not void"); } -#endif DIAGNOSTIC +#endif } cache_purge(vp); coda_free(VTOC(vp));