From 918e3ab49af89b663522d5ef2f6ca6710a51f835 Mon Sep 17 00:00:00 2001 From: rvb Date: Fri, 11 Sep 1998 18:50:17 +0000 Subject: All the references to cfs, in symbols, structs, and strings have been changed to coda. (Same for CFS.) --- sys/cfs/cfs_fbsd.c | 18 +- sys/cfs/cfs_namecache.c | 401 ++++++++++++++-------------- sys/cfs/cfs_psdev.c | 165 ++++++------ sys/cfs/cfs_subr.c | 267 ++++++++++--------- sys/cfs/cfs_subr.h | 24 +- sys/cfs/cfs_venus.c | 242 ++++++++--------- sys/cfs/cfs_vfsops.c | 220 ++++++++-------- sys/cfs/cfs_vfsops.h | 28 +- sys/cfs/cfs_vnodeops.c | 603 ++++++++++++++++++++++--------------------- sys/cfs/cfs_vnodeops.h | 79 +++--- sys/cfs/cfsio.h | 23 +- sys/cfs/cfsnc.h | 147 +++++------ sys/cfs/cnode.h | 83 +++--- sys/cfs/coda.h | 454 ++++++++++++++++---------------- sys/cfs/coda_opstats.h | 60 ++--- sys/cfs/pioctl.h | 9 +- sys/coda/cnode.h | 83 +++--- sys/coda/coda.h | 454 ++++++++++++++++---------------- sys/coda/coda_fbsd.c | 18 +- sys/coda/coda_io.h | 23 +- sys/coda/coda_namecache.c | 401 ++++++++++++++-------------- sys/coda/coda_namecache.h | 147 +++++------ sys/coda/coda_opstats.h | 60 ++--- sys/coda/coda_pioctl.h | 9 +- sys/coda/coda_psdev.c | 165 ++++++------ sys/coda/coda_subr.c | 267 ++++++++++--------- sys/coda/coda_subr.h | 24 +- sys/coda/coda_venus.c | 242 ++++++++--------- sys/coda/coda_vfsops.c | 220 ++++++++-------- sys/coda/coda_vfsops.h | 28 +- sys/coda/coda_vnops.c | 603 ++++++++++++++++++++++--------------------- sys/coda/coda_vnops.h | 79 +++--- sys/conf/NOTES | 8 +- sys/conf/files | 14 +- sys/conf/options | 4 +- sys/fs/coda/cnode.h | 83 +++--- sys/fs/coda/coda.h | 454 ++++++++++++++++---------------- sys/fs/coda/coda_fbsd.c | 18 +- sys/fs/coda/coda_io.h | 23 +- sys/fs/coda/coda_namecache.c | 401 ++++++++++++++-------------- sys/fs/coda/coda_namecache.h | 147 +++++------ sys/fs/coda/coda_opstats.h | 60 ++--- sys/fs/coda/coda_pioctl.h | 9 +- sys/fs/coda/coda_psdev.c | 165 ++++++------ sys/fs/coda/coda_subr.c | 267 ++++++++++--------- sys/fs/coda/coda_subr.h | 24 +- sys/fs/coda/coda_venus.c | 242 ++++++++--------- sys/fs/coda/coda_vfsops.c | 220 ++++++++-------- sys/fs/coda/coda_vfsops.h | 28 +- sys/fs/coda/coda_vnops.c | 603 ++++++++++++++++++++++--------------------- sys/fs/coda/coda_vnops.h | 79 +++--- sys/i386/conf/LINT | 8 +- sys/i386/conf/NOTES | 8 +- sys/sys/vnode.h | 4 +- 54 files changed, 4286 insertions(+), 4229 deletions(-) diff --git a/sys/cfs/cfs_fbsd.c b/sys/cfs/cfs_fbsd.c index f137ff5..4c49386 100644 --- a/sys/cfs/cfs_fbsd.c +++ b/sys/cfs/cfs_fbsd.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfs_fbsd.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfs_fbsd.c,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -99,7 +99,7 @@ vcattach(void) VCDEBUG("makedev OK.\n"); cdevsw_add(&vccdev, &vccdevsw, NULL); - VCDEBUG("cfs: vccdevsw entry installed at %d.\n", major(vccdev)); + VCDEBUG("coda: vccdevsw entry installed at %d.\n", major(vccdev)); } static vc_devsw_installed = 0; @@ -118,7 +118,7 @@ vc_drvinit(void *unused) } int -cfs_fbsd_getpages(v) +coda_fbsd_getpages(v) void *v; { struct vop_getpages_args *ap = v; @@ -151,16 +151,16 @@ cfs_fbsd_getpages(v) opened_internally = 1; error = VOP_OPEN(vp, FREAD, cred, p); -printf("cfs_getp: Internally Opening %p\n", vp); +printf("coda_getp: Internally Opening %p\n", vp); if (error) { - printf("cfs_getpage: VOP_OPEN on container failed %d\n", error); + printf("coda_getpage: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_getpage: vfs_object_create() returns %d\n", error); + printf("coda_getpage: vfs_object_create() returns %d\n", error); vput(vp); return(error); } @@ -168,10 +168,10 @@ printf("cfs_getp: Internally Opening %p\n", vp); cfvp = cp->c_ovp; } else { -printf("cfs_getp: has container %p\n", cfvp); +printf("coda_getp: has container %p\n", cfvp); } -printf("cfs_fbsd_getpages: using container "); +printf("coda_fbsd_getpages: using container "); /* error = vnode_pager_generic_getpages(cfvp, ap->a_m, ap->a_count, ap->a_reqpage); @@ -191,7 +191,7 @@ printf("error = %d\n", error); } int -cfs_fbsd_putpages(v) +coda_fbsd_putpages(v) void *v; { struct vop_putpages_args *ap = v; diff --git a/sys/cfs/cfs_namecache.c b/sys/cfs/cfs_namecache.c index 2a079e5..1a88346 100644 --- a/sys/cfs/cfs_namecache.c +++ b/sys/cfs/cfs_namecache.c @@ -69,7 +69,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.7 98/01/23 11:53:39 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.6.2.4 98/01/23 11:21:02 rvb * Sync with 2.2.5 @@ -109,7 +109,7 @@ * >64Meg; venus can be killed! * * Revision 1.5 97/08/05 11:08:01 lily - * Removed cfsnc_replace, replaced it with a cfs_find, unhash, and + * Removed cfsnc_replace, replaced it with a coda_find, unhash, and * rehash. This fixes a cnode leak and a bug in which the fid is * not actually replaced. (cfs_namecache.c, cfsnc.h, cfs_subr.c) * @@ -125,7 +125,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:15 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:07:57 bnoble * Branch for NetBSD port revisions @@ -137,20 +137,20 @@ * Made changes 'cause sun4s have braindead compilers * * Revision 2.2 94/08/28 19:37:35 luqi - * Add a new CFS_REPLACE call to allow venus to replace a ViceFid in the + * Add a new CODA_REPLACE call to allow venus to replace a ViceFid in the * mini-cache. * * In "cfs.h": - * Add CFS_REPLACE decl. + * Add CODA_REPLACE decl. * * In "cfs_namecache.c": * Add routine cfsnc_replace. * * In "cfs_subr.c": - * Add case-statement to process CFS_REPLACE. + * Add case-statement to process CODA_REPLACE. * * In "cfsnc.h": - * Add decl for CFSNC_REPLACE. + * Add decl for CODA_NC_REPLACE. * * * Revision 2.1 94/07/21 16:25:15 satya @@ -160,7 +160,7 @@ * merge kernel/latest and alpha/src/cfs * * Revision 2.3 92/09/30 14:16:20 mja - * call cfs_flush instead of calling inode_uncache_try directly + * call coda_flush instead of calling inode_uncache_try directly * (from dcs). Also... * * Substituted rvb's history blurb so that we agree with Mach 2.5 sources. @@ -180,7 +180,7 @@ */ /* - * This module contains the routines to implement the CFS name cache. The + * This module contains the routines to implement the CODA name cache. The * purpose of this cache is to reduce the cost of translating pathnames * into Vice FIDs. Each entry in the cache contains the name of the file, * the vnode (FID) of the parent directory, and the cred structure of the @@ -203,8 +203,8 @@ * NOTES: rvb@cs * 1. The name cache holds a reference to every vnode in it. Hence files can not be * closed or made inactive until they are released. - * 2. cfsnc_name(cp) was added to get a name for a cnode pointer for debugging. - * 3. cfsnc_find() has debug code to detect when entries are stored with different + * 2. coda_nc_name(cp) was added to get a name for a cnode pointer for debugging. + * 3. coda_nc_find() has debug code to detect when entries are stored with different * credentials. We don't understand yet, if/how entries are NOT EQ but still * EQUAL * 4. I wonder if this name cache could be replace by the vnode name cache. @@ -227,82 +227,78 @@ #include #include #include -#ifdef DEBUG -/* for printcred */ -#include -#endif /* * Declaration of the name cache data structure. */ -int cfsnc_use = 1; /* Indicate use of CFS Name Cache */ -int cfsnc_size = CFSNC_CACHESIZE; /* size of the cache */ -int cfsnc_hashsize = CFSNC_HASHSIZE; /* size of the primary hash */ +int coda_nc_use = 1; /* Indicate use of CODA Name Cache */ +int coda_nc_size = CODA_NC_CACHESIZE; /* size of the cache */ +int coda_nc_hashsize = CODA_NC_HASHSIZE; /* size of the primary hash */ -struct cfscache *cfsncheap; /* pointer to the cache entries */ -struct cfshash *cfsnchash; /* hash table of cfscache pointers */ -struct cfslru cfsnc_lru; /* head of lru chain */ +struct coda_cache *coda_nc_heap; /* pointer to the cache entries */ +struct coda_hash *coda_nc_hash; /* hash table of coda_cache pointers */ +struct coda_lru coda_nc_lru; /* head of lru chain */ -struct cfsnc_statistics cfsnc_stat; /* Keep various stats */ +struct coda_nc_statistics coda_nc_stat; /* Keep various stats */ /* * for testing purposes */ -int cfsnc_debug = 0; +int coda_nc_debug = 0; /* - * Entry points for the CFS Name Cache + * Entry points for the CODA Name Cache */ -static struct cfscache *cfsnc_find(struct cnode *dcp, const char *name, int namelen, +static struct coda_cache *coda_nc_find(struct cnode *dcp, const char *name, int namelen, struct ucred *cred, int hash); -static void cfsnc_remove(struct cfscache *cncp, enum dc_status dcstat); +static void coda_nc_remove(struct coda_cache *cncp, enum dc_status dcstat); /* * Initialize the cache, the LRU structure and the Hash structure(s) */ -#define TOTAL_CACHE_SIZE (sizeof(struct cfscache) * cfsnc_size) -#define TOTAL_HASH_SIZE (sizeof(struct cfshash) * cfsnc_hashsize) +#define TOTAL_CACHE_SIZE (sizeof(struct coda_cache) * coda_nc_size) +#define TOTAL_HASH_SIZE (sizeof(struct coda_hash) * coda_nc_hashsize) -int cfsnc_initialized = 0; /* Initially the cache has not been initialized */ +int coda_nc_initialized = 0; /* Initially the cache has not been initialized */ void -cfsnc_init(void) +coda_nc_init(void) { int i; /* zero the statistics structure */ - bzero(&cfsnc_stat, (sizeof(struct cfsnc_statistics))); + bzero(&coda_nc_stat, (sizeof(struct coda_nc_statistics))); - printf("CFS NAME CACHE: CACHE %d, HASH TBL %d\n", CFSNC_CACHESIZE, CFSNC_HASHSIZE); - CFS_ALLOC(cfsncheap, struct cfscache *, TOTAL_CACHE_SIZE); - CFS_ALLOC(cfsnchash, struct cfshash *, TOTAL_HASH_SIZE); + printf("CODA NAME CACHE: CACHE %d, HASH TBL %d\n", CODA_NC_CACHESIZE, CODA_NC_HASHSIZE); + CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE); + CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE); - cfsnc_lru.lru_next = - cfsnc_lru.lru_prev = (struct cfscache *)LRU_PART(&cfsnc_lru); + coda_nc_lru.lru_next = + coda_nc_lru.lru_prev = (struct coda_cache *)LRU_PART(&coda_nc_lru); - for (i=0; i < cfsnc_size; i++) { /* initialize the heap */ - CFSNC_LRUINS(&cfsncheap[i], &cfsnc_lru); - CFSNC_HSHNUL(&cfsncheap[i]); - cfsncheap[i].cp = cfsncheap[i].dcp = (struct cnode *)0; + for (i=0; i < coda_nc_size; i++) { /* initialize the heap */ + CODA_NC_LRUINS(&coda_nc_heap[i], &coda_nc_lru); + CODA_NC_HSHNUL(&coda_nc_heap[i]); + coda_nc_heap[i].cp = coda_nc_heap[i].dcp = (struct cnode *)0; } - for (i=0; i < cfsnc_hashsize; i++) { /* initialize the hashtable */ - CFSNC_HSHNUL((struct cfscache *)&cfsnchash[i]); + for (i=0; i < coda_nc_hashsize; i++) { /* initialize the hashtable */ + CODA_NC_HSHNUL((struct coda_cache *)&coda_nc_hash[i]); } - cfsnc_initialized++; + coda_nc_initialized++; } /* * Auxillary routines -- shouldn't be entry points */ -static struct cfscache * -cfsnc_find(dcp, name, namelen, cred, hash) +static struct coda_cache * +coda_nc_find(dcp, name, namelen, cred, hash) struct cnode *dcp; const char *name; int namelen; @@ -313,28 +309,28 @@ cfsnc_find(dcp, name, namelen, cred, hash) * hash to find the appropriate bucket, look through the chain * for the right entry (especially right cred, unless cred == 0) */ - struct cfscache *cncp; + struct coda_cache *cncp; int count = 1; - CFSNC_DEBUG(CFSNC_FIND, - myprintf(("cfsnc_find(dcp %p, name %s, len %d, cred %p, hash %d\n", + CODA_NC_DEBUG(CODA_NC_FIND, + myprintf(("coda_nc_find(dcp %p, name %s, len %d, cred %p, hash %d\n", dcp, name, namelen, cred, hash));) - for (cncp = cfsnchash[hash].hash_next; - cncp != (struct cfscache *)&cfsnchash[hash]; + for (cncp = coda_nc_hash[hash].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[hash]; cncp = cncp->hash_next, count++) { - if ((CFS_NAMEMATCH(cncp, name, namelen, dcp)) && + if ((CODA_NAMEMATCH(cncp, name, namelen, dcp)) && ((cred == 0) || (cncp->cred == cred))) { /* compare cr_uid instead */ - cfsnc_stat.Search_len += count; + coda_nc_stat.Search_len += count; return(cncp); } #ifdef DEBUG - else if (CFS_NAMEMATCH(cncp, name, namelen, dcp)) { - printf("cfsnc_find: name %s, new cred = %p, cred = %p\n", + else if (CODA_NAMEMATCH(cncp, name, namelen, dcp)) { + printf("coda_nc_find: name %s, new cred = %p, cred = %p\n", name, cred, cncp->cred); printf("nref %d, nuid %d, ngid %d // oref %d, ocred %d, ogid %d\n", cred->cr_ref, cred->cr_uid, cred->cr_gid, @@ -345,7 +341,7 @@ cfsnc_find(dcp, name, namelen, cred, hash) #endif } - return((struct cfscache *)0); + return((struct coda_cache *)0); } /* @@ -353,52 +349,52 @@ cfsnc_find(dcp, name, namelen, cred, hash) * LRU and Hash as needed. */ void -cfsnc_enter(dcp, name, namelen, cred, cp) +coda_nc_enter(dcp, name, namelen, cred, cp) struct cnode *dcp; const char *name; int namelen; struct ucred *cred; struct cnode *cp; { - struct cfscache *cncp; + struct coda_cache *cncp; int hash; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ENTER, + CODA_NC_DEBUG(CODA_NC_ENTER, myprintf(("Enter: dcp %p cp %p name %s cred %p \n", dcp, cp, name, cred)); ) - if (namelen > CFSNC_NAMELEN) { - CFSNC_DEBUG(CFSNC_ENTER, + if (namelen > CODA_NC_NAMELEN) { + CODA_NC_DEBUG(CODA_NC_ENTER, myprintf(("long name enter %s\n",name));) - cfsnc_stat.long_name_enters++; /* record stats */ + coda_nc_stat.long_name_enters++; /* record stats */ return; } - hash = CFSNC_HASH(name, namelen, dcp); - cncp = cfsnc_find(dcp, name, namelen, cred, hash); - if (cncp != (struct cfscache *) 0) { - cfsnc_stat.dbl_enters++; /* duplicate entry */ + hash = CODA_NC_HASH(name, namelen, dcp); + cncp = coda_nc_find(dcp, name, namelen, cred, hash); + if (cncp != (struct coda_cache *) 0) { + coda_nc_stat.dbl_enters++; /* duplicate entry */ return; } - cfsnc_stat.enters++; /* record the enters statistic */ + coda_nc_stat.enters++; /* record the enters statistic */ /* Grab the next element in the lru chain */ - cncp = CFSNC_LRUGET(cfsnc_lru); + cncp = CODA_NC_LRUGET(coda_nc_lru); - CFSNC_LRUREM(cncp); /* remove it from the lists */ + CODA_NC_LRUREM(cncp); /* remove it from the lists */ - if (CFSNC_VALID(cncp)) { + if (CODA_NC_VALID(cncp)) { /* Seems really ugly, but we have to decrement the appropriate hash bucket length here, so we have to find the hash bucket */ - cfsnchash[CFSNC_HASH(cncp->name, cncp->namelen, cncp->dcp)].length--; + coda_nc_hash[CODA_NC_HASH(cncp->name, cncp->namelen, cncp->dcp)].length--; - cfsnc_stat.lru_rm++; /* zapped a valid entry */ - CFSNC_HSHREM(cncp); + coda_nc_stat.lru_rm++; /* zapped a valid entry */ + CODA_NC_HSHREM(cncp); vrele(CTOV(cncp->dcp)); vrele(CTOV(cncp->cp)); crfree(cncp->cred); @@ -419,11 +415,11 @@ cfsnc_enter(dcp, name, namelen, cred, cp) /* Insert into the lru and hash chains. */ - CFSNC_LRUINS(cncp, &cfsnc_lru); - CFSNC_HSHINS(cncp, &cfsnchash[hash]); - cfsnchash[hash].length++; /* Used for tuning */ + CODA_NC_LRUINS(cncp, &coda_nc_lru); + CODA_NC_HSHINS(cncp, &coda_nc_hash[hash]); + coda_nc_hash[hash].length++; /* Used for tuning */ - CFSNC_DEBUG(CFSNC_PRINTCFSNC, print_cfsnc(); ) + CODA_NC_DEBUG(CODA_NC_PRINTCODA_NC, print_coda_nc(); ) } /* @@ -431,22 +427,22 @@ cfsnc_enter(dcp, name, namelen, cred, cp) * matches the input, return it, otherwise return 0 */ struct cnode * -cfsnc_lookup(dcp, name, namelen, cred) +coda_nc_lookup(dcp, name, namelen, cred) struct cnode *dcp; const char *name; int namelen; struct ucred *cred; { int hash; - struct cfscache *cncp; + struct coda_cache *cncp; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return((struct cnode *) 0); - if (namelen > CFSNC_NAMELEN) { - CFSNC_DEBUG(CFSNC_LOOKUP, + if (namelen > CODA_NC_NAMELEN) { + CODA_NC_DEBUG(CODA_NC_LOOKUP, myprintf(("long name lookup %s\n",name));) - cfsnc_stat.long_name_lookups++; /* record stats */ + coda_nc_stat.long_name_lookups++; /* record stats */ return((struct cnode *) 0); } @@ -455,25 +451,25 @@ cfsnc_lookup(dcp, name, namelen, cred) the correct cred. */ - hash = CFSNC_HASH(name, namelen, dcp); - cncp = cfsnc_find(dcp, name, namelen, cred, hash); - if (cncp == (struct cfscache *) 0) { - cfsnc_stat.misses++; /* record miss */ + hash = CODA_NC_HASH(name, namelen, dcp); + cncp = coda_nc_find(dcp, name, namelen, cred, hash); + if (cncp == (struct coda_cache *) 0) { + coda_nc_stat.misses++; /* record miss */ return((struct cnode *) 0); } - cfsnc_stat.hits++; + coda_nc_stat.hits++; /* put this entry at the end of the LRU */ - CFSNC_LRUREM(cncp); - CFSNC_LRUINS(cncp, &cfsnc_lru); + CODA_NC_LRUREM(cncp); + CODA_NC_LRUINS(cncp, &coda_nc_lru); /* move it to the front of the hash chain */ /* don't need to change the hash bucket length */ - CFSNC_HSHREM(cncp); - CFSNC_HSHINS(cncp, &cfsnchash[hash]); + CODA_NC_HSHREM(cncp); + CODA_NC_HSHINS(cncp, &coda_nc_hash[hash]); - CFSNC_DEBUG(CFSNC_LOOKUP, + CODA_NC_DEBUG(CODA_NC_LOOKUP, printf("lookup: dcp %p, name %s, cred %p = cp %p\n", dcp, name, cred, cncp->cp); ) @@ -481,8 +477,8 @@ cfsnc_lookup(dcp, name, namelen, cred) } static void -cfsnc_remove(cncp, dcstat) - struct cfscache *cncp; +coda_nc_remove(cncp, dcstat) + struct coda_cache *cncp; enum dc_status dcstat; { /* @@ -490,14 +486,14 @@ cfsnc_remove(cncp, dcstat) * remove it from it's hash chain, and * place it at the head of the lru list. */ - CFSNC_DEBUG(CFSNC_REMOVE, - myprintf(("cfsnc_remove %s from parent %lx.%lx.%lx\n", + CODA_NC_DEBUG(CODA_NC_REMOVE, + myprintf(("coda_nc_remove %s from parent %lx.%lx.%lx\n", cncp->name, (cncp->dcp)->c_fid.Volume, (cncp->dcp)->c_fid.Vnode, (cncp->dcp)->c_fid.Unique));) - CFSNC_HSHREM(cncp); + CODA_NC_HSHREM(cncp); - CFSNC_HSHNUL(cncp); /* have it be a null chain */ + CODA_NC_HSHNUL(cncp); /* have it be a null chain */ if ((dcstat == IS_DOWNCALL) && (CTOV(cncp->dcp)->v_usecount == 1)) { cncp->dcp->c_flags |= C_PURGING; } @@ -513,15 +509,15 @@ cfsnc_remove(cncp, dcstat) /* Put the null entry just after the least-recently-used entry */ /* LRU_TOP adjusts the pointer to point to the top of the structure. */ - CFSNC_LRUREM(cncp); - CFSNC_LRUINS(cncp, LRU_TOP(cfsnc_lru.lru_prev)); + CODA_NC_LRUREM(cncp); + CODA_NC_LRUINS(cncp, LRU_TOP(coda_nc_lru.lru_prev)); } /* * Remove all entries with a parent which has the input fid. */ void -cfsnc_zapParentfid(fid, dcstat) +coda_nc_zapParentfid(fid, dcstat) ViceFid *fid; enum dc_status dcstat; { @@ -530,34 +526,34 @@ cfsnc_zapParentfid(fid, dcstat) appropriate entries. The later may be acceptable since I don't think callbacks or whatever Case 1 covers are frequent occurences. */ - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPPFID, + CODA_NC_DEBUG(CODA_NC_ZAPPFID, myprintf(("ZapParent: fid 0x%lx, 0x%lx, 0x%lx \n", fid->Volume, fid->Vnode, fid->Unique)); ) - cfsnc_stat.zapPfids++; + coda_nc_stat.zapPfids++; - for (i = 0; i < cfsnc_hashsize; i++) { + for (i = 0; i < coda_nc_hashsize; i++) { /* * Need to save the hash_next pointer in case we remove the * entry. remove causes hash_next to point to itself. */ - for (cncp = cfsnchash[i].hash_next; - cncp != (struct cfscache *)&cfsnchash[i]; + for (cncp = coda_nc_hash[i].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[i]; cncp = ncncp) { ncncp = cncp->hash_next; if ((cncp->dcp->c_fid.Volume == fid->Volume) && (cncp->dcp->c_fid.Vnode == fid->Vnode) && (cncp->dcp->c_fid.Unique == fid->Unique)) { - cfsnchash[i].length--; /* Used for tuning */ - cfsnc_remove(cncp, dcstat); + coda_nc_hash[i].length--; /* Used for tuning */ + coda_nc_remove(cncp, dcstat); } } } @@ -568,35 +564,35 @@ cfsnc_zapParentfid(fid, dcstat) * Remove all entries which have the same fid as the input */ void -cfsnc_zapfid(fid, dcstat) +coda_nc_zapfid(fid, dcstat) ViceFid *fid; enum dc_status dcstat; { /* See comment for zapParentfid. This routine will be used if attributes are being cached. */ - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPFID, + CODA_NC_DEBUG(CODA_NC_ZAPFID, myprintf(("Zapfid: fid 0x%lx, 0x%lx, 0x%lx \n", fid->Volume, fid->Vnode, fid->Unique)); ) - cfsnc_stat.zapFids++; + coda_nc_stat.zapFids++; - for (i = 0; i < cfsnc_hashsize; i++) { - for (cncp = cfsnchash[i].hash_next; - cncp != (struct cfscache *)&cfsnchash[i]; + for (i = 0; i < coda_nc_hashsize; i++) { + for (cncp = coda_nc_hash[i].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[i]; cncp = ncncp) { ncncp = cncp->hash_next; if ((cncp->cp->c_fid.Volume == fid->Volume) && (cncp->cp->c_fid.Vnode == fid->Vnode) && (cncp->cp->c_fid.Unique == fid->Unique)) { - cfsnchash[i].length--; /* Used for tuning */ - cfsnc_remove(cncp, dcstat); + coda_nc_hash[i].length--; /* Used for tuning */ + coda_nc_remove(cncp, dcstat); } } } @@ -606,7 +602,7 @@ cfsnc_zapfid(fid, dcstat) * Remove all entries which match the fid and the cred */ void -cfsnc_zapvnode(fid, cred, dcstat) +coda_nc_zapvnode(fid, cred, dcstat) ViceFid *fid; struct ucred *cred; enum dc_status dcstat; @@ -615,10 +611,10 @@ cfsnc_zapvnode(fid, cred, dcstat) want to zap a file with a specific cred from the kernel. We'll leave this one unimplemented. */ - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPVNODE, + CODA_NC_DEBUG(CODA_NC_ZAPVNODE, myprintf(("Zapvnode: fid 0x%lx, 0x%lx, 0x%lx cred %p\n", fid->Volume, fid->Vnode, fid->Unique, cred)); ) @@ -628,7 +624,7 @@ cfsnc_zapvnode(fid, cred, dcstat) * Remove all entries which have the (dir vnode, name) pair */ void -cfsnc_zapfile(dcp, name, namelen) +coda_nc_zapfile(dcp, name, namelen) struct cnode *dcp; const char *name; int namelen; @@ -636,31 +632,31 @@ cfsnc_zapfile(dcp, name, namelen) /* use the hash function to locate the file, then zap all entries of it regardless of the cred. */ - struct cfscache *cncp; + struct coda_cache *cncp; int hash; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPFILE, + CODA_NC_DEBUG(CODA_NC_ZAPFILE, myprintf(("Zapfile: dcp %p name %s \n", dcp, name)); ) - if (namelen > CFSNC_NAMELEN) { - cfsnc_stat.long_remove++; /* record stats */ + if (namelen > CODA_NC_NAMELEN) { + coda_nc_stat.long_remove++; /* record stats */ return; } - cfsnc_stat.zapFile++; + coda_nc_stat.zapFile++; - hash = CFSNC_HASH(name, namelen, dcp); - cncp = cfsnc_find(dcp, name, namelen, 0, hash); + hash = CODA_NC_HASH(name, namelen, dcp); + cncp = coda_nc_find(dcp, name, namelen, 0, hash); while (cncp) { - cfsnchash[hash].length--; /* Used for tuning */ + coda_nc_hash[hash].length--; /* Used for tuning */ - cfsnc_remove(cncp, NOT_DOWNCALL); - cncp = cfsnc_find(dcp, name, namelen, 0, hash); + coda_nc_remove(cncp, NOT_DOWNCALL); + cncp = coda_nc_find(dcp, name, namelen, 0, hash); } } @@ -669,7 +665,7 @@ cfsnc_zapfile(dcp, name, namelen) * A user is determined by his/her effective user id (id_uid). */ void -cfsnc_purge_user(uid, dcstat) +coda_nc_purge_user(uid, dcstat) vuid_t uid; enum dc_status dcstat; { @@ -681,30 +677,30 @@ cfsnc_purge_user(uid, dcstat) * always be full and LRU is more straightforward. */ - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int hash; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_PURGEUSER, + CODA_NC_DEBUG(CODA_NC_PURGEUSER, myprintf(("ZapDude: uid %lx\n", uid)); ) - cfsnc_stat.zapUsers++; + coda_nc_stat.zapUsers++; - for (cncp = CFSNC_LRUGET(cfsnc_lru); - cncp != (struct cfscache *)(&cfsnc_lru); + for (cncp = CODA_NC_LRUGET(coda_nc_lru); + cncp != (struct coda_cache *)(&coda_nc_lru); cncp = ncncp) { - ncncp = CFSNC_LRUGET(*cncp); + ncncp = CODA_NC_LRUGET(*cncp); - if ((CFSNC_VALID(cncp)) && + if ((CODA_NC_VALID(cncp)) && ((cncp->cred)->cr_uid == uid)) { /* Seems really ugly, but we have to decrement the appropriate hash bucket length here, so we have to find the hash bucket */ - hash = CFSNC_HASH(cncp->name, cncp->namelen, cncp->dcp); - cfsnchash[hash].length--; /* For performance tuning */ + hash = CODA_NC_HASH(cncp->name, cncp->namelen, cncp->dcp); + coda_nc_hash[hash].length--; /* For performance tuning */ - cfsnc_remove(cncp, dcstat); + coda_nc_remove(cncp, dcstat); } } } @@ -713,7 +709,7 @@ cfsnc_purge_user(uid, dcstat) * Flush the entire name cache. In response to a flush of the Venus cache. */ void -cfsnc_flush(dcstat) +coda_nc_flush(dcstat) enum dc_status dcstat; { /* One option is to deallocate the current name cache and @@ -727,21 +723,21 @@ cfsnc_flush(dcstat) * I don't use remove since that would rebuild the lru chain * as it went and that seemed unneccesary. */ - struct cfscache *cncp; + struct coda_cache *cncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - cfsnc_stat.Flushes++; + coda_nc_stat.Flushes++; - for (cncp = CFSNC_LRUGET(cfsnc_lru); - cncp != (struct cfscache *)&cfsnc_lru; - cncp = CFSNC_LRUGET(*cncp)) { - if (CFSNC_VALID(cncp)) { + for (cncp = CODA_NC_LRUGET(coda_nc_lru); + cncp != (struct coda_cache *)&coda_nc_lru; + cncp = CODA_NC_LRUGET(*cncp)) { + if (CODA_NC_VALID(cncp)) { - CFSNC_HSHREM(cncp); /* only zero valid nodes */ - CFSNC_HSHNUL(cncp); + CODA_NC_HSHREM(cncp); /* only zero valid nodes */ + CODA_NC_HSHNUL(cncp); if ((dcstat == IS_DOWNCALL) && (CTOV(cncp->dcp)->v_usecount == 1)) { @@ -750,9 +746,9 @@ cfsnc_flush(dcstat) vrele(CTOV(cncp->dcp)); if (CTOV(cncp->cp)->v_flag & VTEXT) { - if (cfs_vmflush(cncp->cp)) - CFSDEBUG(CFS_FLUSH, - myprintf(("cfsnc_flush: (%lx.%lx.%lx) busy\n", cncp->cp->c_fid.Volume, cncp->cp->c_fid.Vnode, cncp->cp->c_fid.Unique)); ) + if (coda_vmflush(cncp->cp)) + CODADEBUG(CODA_FLUSH, + myprintf(("coda_nc_flush: (%lx.%lx.%lx) busy\n", cncp->cp->c_fid.Volume, cncp->cp->c_fid.Vnode, cncp->cp->c_fid.Unique)); ) } if ((dcstat == IS_DOWNCALL) @@ -767,8 +763,8 @@ cfsnc_flush(dcstat) } } - for (i = 0; i < cfsnc_hashsize; i++) - cfsnchash[i].length = 0; + for (i = 0; i < coda_nc_hashsize; i++) + coda_nc_hash[i].length = 0; } /* @@ -779,16 +775,16 @@ cfsnc_flush(dcstat) * This routine should print out all the hash chains to the console. */ void -print_cfsnc(void) +print_coda_nc(void) { int hash; - struct cfscache *cncp; + struct coda_cache *cncp; - for (hash = 0; hash < cfsnc_hashsize; hash++) { + for (hash = 0; hash < coda_nc_hashsize; hash++) { myprintf(("\nhash %d\n",hash)); - for (cncp = cfsnchash[hash].hash_next; - cncp != (struct cfscache *)&cfsnchash[hash]; + for (cncp = coda_nc_hash[hash].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[hash]; cncp = cncp->hash_next) { myprintf(("cp %p dcp %p cred %p name %s\n", cncp->cp, cncp->dcp, @@ -798,42 +794,42 @@ print_cfsnc(void) } void -cfsnc_gather_stats(void) +coda_nc_gather_stats(void) { int i, max = 0, sum = 0, temp, zeros = 0, ave, n; - for (i = 0; i < cfsnc_hashsize; i++) { - if (cfsnchash[i].length) { - sum += cfsnchash[i].length; + for (i = 0; i < coda_nc_hashsize; i++) { + if (coda_nc_hash[i].length) { + sum += coda_nc_hash[i].length; } else { zeros++; } - if (cfsnchash[i].length > max) - max = cfsnchash[i].length; + if (coda_nc_hash[i].length > max) + max = coda_nc_hash[i].length; } /* * When computing the Arithmetic mean, only count slots which * are not empty in the distribution. */ - cfsnc_stat.Sum_bucket_len = sum; - cfsnc_stat.Num_zero_len = zeros; - cfsnc_stat.Max_bucket_len = max; + coda_nc_stat.Sum_bucket_len = sum; + coda_nc_stat.Num_zero_len = zeros; + coda_nc_stat.Max_bucket_len = max; - if ((n = cfsnc_hashsize - zeros) > 0) + if ((n = coda_nc_hashsize - zeros) > 0) ave = sum / n; else ave = 0; sum = 0; - for (i = 0; i < cfsnc_hashsize; i++) { - if (cfsnchash[i].length) { - temp = cfsnchash[i].length - ave; + for (i = 0; i < coda_nc_hashsize; i++) { + if (coda_nc_hash[i].length) { + temp = coda_nc_hash[i].length - ave; sum += temp * temp; } } - cfsnc_stat.Sum2_bucket_len = sum; + coda_nc_stat.Sum2_bucket_len = sum; } /* @@ -843,7 +839,7 @@ cfsnc_gather_stats(void) * is in an improper state (except by turning the cache off). */ int -cfsnc_resize(hashsize, heapsize, dcstat) +coda_nc_resize(hashsize, heapsize, dcstat) int hashsize, heapsize; enum dc_status dcstat; { @@ -851,46 +847,49 @@ cfsnc_resize(hashsize, heapsize, dcstat) return(EINVAL); } - cfsnc_use = 0; /* Turn the cache off */ + coda_nc_use = 0; /* Turn the cache off */ - cfsnc_flush(dcstat); /* free any cnodes in the cache */ + coda_nc_flush(dcstat); /* free any cnodes in the cache */ /* WARNING: free must happen *before* size is reset */ - CFS_FREE(cfsncheap,TOTAL_CACHE_SIZE); - CFS_FREE(cfsnchash,TOTAL_HASH_SIZE); + CODA_FREE(coda_nc_heap,TOTAL_CACHE_SIZE); + CODA_FREE(coda_nc_hash,TOTAL_HASH_SIZE); - cfsnc_hashsize = hashsize; - cfsnc_size = heapsize; + coda_nc_hashsize = hashsize; + coda_nc_size = heapsize; - cfsnc_init(); /* Set up a cache with the new size */ + coda_nc_init(); /* Set up a cache with the new size */ - cfsnc_use = 1; /* Turn the cache back on */ + coda_nc_use = 1; /* Turn the cache back on */ return(0); } -char cfsnc_name_buf[CFS_MAXNAMLEN+1]; +#define DEBUG +#ifdef DEBUG +char coda_nc_name_buf[CODA_MAXNAMLEN+1]; void -cfsnc_name(struct cnode *cp) +coda_nc_name(struct cnode *cp) { - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - for (i = 0; i < cfsnc_hashsize; i++) { - for (cncp = cfsnchash[i].hash_next; - cncp != (struct cfscache *)&cfsnchash[i]; + for (i = 0; i < coda_nc_hashsize; i++) { + for (cncp = coda_nc_hash[i].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[i]; cncp = ncncp) { ncncp = cncp->hash_next; if (cncp->cp == cp) { - bcopy(cncp->name, cfsnc_name_buf, cncp->namelen); - cfsnc_name_buf[cncp->namelen] = 0; + bcopy(cncp->name, coda_nc_name_buf, cncp->namelen); + coda_nc_name_buf[cncp->namelen] = 0; printf(" is %s (%p,%p)@%p", - cfsnc_name_buf, cncp->cp, cncp->dcp, cncp); + coda_nc_name_buf, cncp->cp, cncp->dcp, cncp); } } } } +#endif diff --git a/sys/cfs/cfs_psdev.c b/sys/cfs/cfs_psdev.c index 3c7c724..d8d7635 100644 --- a/sys/cfs/cfs_psdev.c +++ b/sys/cfs/cfs_psdev.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfs_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfs_psdev.c,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -53,6 +53,9 @@ /* * HISTORY * $Log: cfs_psdev.c,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -78,7 +81,7 @@ * sync 1.2 and 1.3 * * Revision 1.5.2.6 98/01/22 13:11:24 rvb - * Move makecfsnode ctlfid later so vfsp is known; work on ^c and ^z + * Move make_coda_node ctlfid later so vfsp is known; work on ^c and ^z * * Revision 1.5.2.5 97/12/16 22:01:27 rvb * Oops add cfs_subr.h cfs_venus.h; sync with peter @@ -87,7 +90,7 @@ * Sync with 1.3 * * Revision 1.5.2.3 97/12/10 14:08:24 rvb - * Fix O_ flags; check result in cfscall + * Fix O_ flags; check result in coda_call * * Revision 1.5.2.2 97/12/10 11:40:24 rvb * No more ody @@ -140,7 +143,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:24 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 1.1 1995/03/14 20:52:15 bnoble * Initial revision @@ -149,9 +152,9 @@ /* These routines are the device entry points for Venus. */ -extern int cfsnc_initialized; /* Set if cache has been initialized */ +extern int coda_nc_initialized; /* Set if cache has been initialized */ -#include +#include #include #include @@ -171,11 +174,11 @@ extern int cfsnc_initialized; /* Set if cache has been initialized */ #define CTL_C -int cfs_psdev_print_entry = 0; +int coda_psdev_print_entry = 0; -#define ENTRY if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) +#define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -void vcfsattach(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); @@ -198,9 +201,9 @@ struct vmsg { #define VM_WRITE 2 #define VM_INTR 4 -/* vcfsattach: do nothing */ +/* vcodaattach: do nothing */ void -vcfsattach(n) +vcodaattach(n) int n; { } @@ -216,13 +219,13 @@ vc_nb_open(dev, flag, mode, p) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - if (!cfsnc_initialized) - cfsnc_init(); + if (!coda_nc_initialized) + coda_nc_init(); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; if (VC_OPEN(vcp)) return(EBUSY); @@ -231,8 +234,8 @@ vc_nb_open(dev, flag, mode, p) INIT_QUEUE(vcp->vc_replys); MARK_VC_OPEN(vcp); - cfs_mnttbl[minor(dev)].mi_vfsp = NULL; - cfs_mnttbl[minor(dev)].mi_rootvp = NULL; + coda_mnttbl[minor(dev)].mi_vfsp = NULL; + coda_mnttbl[minor(dev)].mi_rootvp = NULL; return(0); } @@ -246,15 +249,15 @@ vc_nb_close (dev, flag, mode, p) { register struct vcomm *vcp; register struct vmsg *vmp; - struct cfs_mntinfo *mi; + struct coda_mntinfo *mi; int err; ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - mi = &cfs_mnttbl[minor(dev)]; + mi = &coda_mnttbl[minor(dev)]; vcp = &(mi->mi_vcomm); if (!VC_OPEN(vcp)) @@ -269,7 +272,7 @@ vc_nb_close (dev, flag, mode, p) if (mi->mi_rootvp) { /* Let unmount know this is for real */ VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING; - cfs_unmounting(mi->mi_vfsp); + coda_unmounting(mi->mi_vfsp); err = dounmount(mi->mi_vfsp, flag, p); if (err) myprintf(("Error %d unmounting vfs in vcclose(%d)\n", @@ -283,9 +286,9 @@ vc_nb_close (dev, flag, mode, p) { /* Free signal request messages and don't wakeup cause no one is waiting. */ - if (vmp->vm_opcode == CFS_SIGNAL) { - CFS_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); - CFS_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); + if (vmp->vm_opcode == CODA_SIGNAL) { + CODA_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); + CODA_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); continue; } @@ -315,10 +318,10 @@ vc_nb_read(dev, uiop, flag) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; /* Get message at head of request queue. */ if (EMPTY(vcp->vc_requests)) return(0); /* Nothing to read */ @@ -342,12 +345,12 @@ vc_nb_read(dev, uiop, flag) /* If request was a signal, free up the message and don't enqueue it in the reply queue. */ - if (vmp->vm_opcode == CFS_SIGNAL) { - if (cfsdebug) + if (vmp->vm_opcode == CODA_SIGNAL) { + if (codadebug) myprintf(("vcread: signal msg (%d, %d)\n", vmp->vm_opcode, vmp->vm_unique)); - CFS_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); - CFS_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); + CODA_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); + CODA_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); return(error); } @@ -365,7 +368,7 @@ vc_nb_write(dev, uiop, flag) { register struct vcomm * vcp; register struct vmsg *vmp; - struct cfs_out_hdr *out; + struct coda_out_hdr *out; u_long seq; u_long opcode; int buf[2]; @@ -373,10 +376,10 @@ vc_nb_write(dev, uiop, flag) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; /* Peek at the opcode, unique without transfering the data. */ uiop->uio_rw = UIO_WRITE; @@ -389,7 +392,7 @@ vc_nb_write(dev, uiop, flag) opcode = buf[0]; seq = buf[1]; - if (cfsdebug) + if (codadebug) myprintf(("vcwrite got a call for %ld.%ld\n", opcode, seq)); if (DOWNCALL(opcode)) { @@ -397,7 +400,7 @@ vc_nb_write(dev, uiop, flag) /* get the rest of the data. */ uiop->uio_rw = UIO_WRITE; - error = uiomove((caddr_t)&pbuf.cfs_purgeuser.oh.result, sizeof(pbuf) - (sizeof(int)*2), uiop); + error = uiomove((caddr_t)&pbuf.coda_purgeuser.oh.result, sizeof(pbuf) - (sizeof(int)*2), uiop); if (error) { myprintf(("vcwrite: error (%d) on uiomove (Op %ld seq %ld)\n", error, opcode, seq)); @@ -416,7 +419,7 @@ vc_nb_write(dev, uiop, flag) } if (EOQ(vmp, vcp->vc_replys)) { - if (cfsdebug) + if (codadebug) myprintf(("vcwrite: msg (%ld, %ld) not found\n", opcode, seq)); return(ESRCH); @@ -426,7 +429,7 @@ vc_nb_write(dev, uiop, flag) REMQUE(vmp->vm_chain); /* move data into response buffer. */ - out = (struct cfs_out_hdr *)vmp->vm_data; + out = (struct coda_out_hdr *)vmp->vm_data; /* Don't need to copy opcode and uniquifier. */ /* get the rest of the data. */ @@ -468,22 +471,22 @@ vc_nb_ioctl(dev, cmd, addr, flag, p) ENTRY; switch(cmd) { - case CFSRESIZE: { - struct cfs_resize *data = (struct cfs_resize *)addr; - return(cfsnc_resize(data->hashsize, data->heapsize, IS_DOWNCALL)); + case CODARESIZE: { + struct coda_resize *data = (struct coda_resize *)addr; + return(coda_nc_resize(data->hashsize, data->heapsize, IS_DOWNCALL)); break; } - case CFSSTATS: - if (cfsnc_use) { - cfsnc_gather_stats(); + case CODASTATS: + if (coda_nc_use) { + coda_nc_gather_stats(); return(0); } else { return(ENODEV); } break; - case CFSPRINT: - if (cfsnc_use) { - print_cfsnc(); + case CODAPRINT: + if (coda_nc_use) { + print_coda_nc(); return(0); } else { return(ENODEV); @@ -506,10 +509,10 @@ vc_nb_poll(dev, events, p) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; event_msk = events & (POLLIN|POLLRDNORM); if (!event_msk) @@ -526,7 +529,7 @@ vc_nb_poll(dev, events, p) /* * Statistics */ -struct cfs_clstat cfs_clstat; +struct coda_clstat coda_clstat; /* * Key question: whether to sleep interuptably or uninteruptably when @@ -537,15 +540,15 @@ struct cfs_clstat cfs_clstat; * (e.g. kill -9). */ -int cfscall_sleep = PZERO - 1; +int coda_call_sleep = PZERO - 1; #ifdef CTL_C -int cfs_pcatch = PCATCH; +int coda_pcatch = PCATCH; #else #endif int -cfscall(mntinfo, inSize, outSize, buffer) - struct cfs_mntinfo *mntinfo; int inSize; int *outSize; caddr_t buffer; +coda_call(mntinfo, inSize, outSize, buffer) + struct coda_mntinfo *mntinfo; int inSize; int *outSize; caddr_t buffer; { struct vcomm *vcp; struct vmsg *vmp; @@ -562,27 +565,27 @@ cfscall(mntinfo, inSize, outSize, buffer) vcp = &(mntinfo->mi_vcomm); - cfs_clstat.ncalls++; - cfs_clstat.reqs[((struct cfs_in_hdr *)buffer)->opcode]++; + coda_clstat.ncalls++; + coda_clstat.reqs[((struct coda_in_hdr *)buffer)->opcode]++; if (!VC_OPEN(vcp)) return(ENODEV); - CFS_ALLOC(vmp,struct vmsg *,sizeof(struct vmsg)); + CODA_ALLOC(vmp,struct vmsg *,sizeof(struct vmsg)); /* Format the request message. */ vmp->vm_data = buffer; vmp->vm_flags = 0; vmp->vm_inSize = inSize; vmp->vm_outSize = *outSize ? *outSize : inSize; /* |buffer| >= inSize */ - vmp->vm_opcode = ((struct cfs_in_hdr *)buffer)->opcode; + vmp->vm_opcode = ((struct coda_in_hdr *)buffer)->opcode; vmp->vm_unique = ++vcp->vc_seq; - if (cfsdebug) + if (codadebug) myprintf(("Doing a call for %d.%d\n", vmp->vm_opcode, vmp->vm_unique)); /* Fill in the common input args. */ - ((struct cfs_in_hdr *)buffer)->unique = vmp->vm_unique; + ((struct coda_in_hdr *)buffer)->unique = vmp->vm_unique; /* Append msg to request queue and poke Venus. */ INSQUE(vmp->vm_chain, vcp->vc_requests); @@ -599,7 +602,7 @@ cfscall(mntinfo, inSize, outSize, buffer) /* Ignore return, We have to check anyway */ #ifdef CTL_C - /* This is work in progress. Setting cfs_pcatch lets tsleep reawaken + /* This is work in progress. Setting coda_pcatch lets tsleep reawaken on a ^c or ^z. The problem is that emacs sets certain interrupts as SA_RESTART. This means that we should exit sleep handle the "signal" and then go to sleep again. Mostly this is done by letting @@ -608,29 +611,29 @@ cfscall(mntinfo, inSize, outSize, buffer) */ i = 0; do { - error = tsleep(&vmp->vm_sleep, (cfscall_sleep|cfs_pcatch), "cfscall", hz*2); + error = tsleep(&vmp->vm_sleep, (coda_call_sleep|coda_pcatch), "coda_call", hz*2); if (error == 0) break; else if (error == EWOULDBLOCK) { - printf("cfscall: tsleep TIMEOUT %d sec\n", 2+2*i); + printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i); } else if (p->p_siglist == sigmask(SIGIO)) { p->p_sigmask |= p->p_siglist; - printf("cfscall: tsleep returns %d SIGIO, cnt %d\n", error, i); + printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); } else { - printf("cfscall: tsleep returns %d, cnt %d\n", error, i); - printf("cfscall: siglist = %x, sigmask = %x, mask %x\n", + 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; p->p_sigmask |= p->p_siglist; - printf("cfscall: 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); } } while (error && i++ < 128); p->p_sigmask = psig_omask; #else - (void) tsleep(&vmp->vm_sleep, cfscall_sleep, "cfscall", 0); + (void) tsleep(&vmp->vm_sleep, coda_call_sleep, "coda_call", 0); #endif if (VC_OPEN(vcp)) { /* Venus is still alive */ /* Op went through, interrupt or not... */ @@ -641,7 +644,7 @@ cfscall(mntinfo, inSize, outSize, buffer) else if (!(vmp->vm_flags & VM_READ)) { /* Interrupted before venus read it. */ - if (cfsdebug||1) + if (codadebug||1) myprintf(("interrupted before read: op = %d.%d, flags = %x\n", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); REMQUE(vmp->vm_chain); @@ -652,29 +655,29 @@ cfscall(mntinfo, inSize, outSize, buffer) /* (!(vmp->vm_flags & VM_WRITE)) means interrupted after upcall started */ /* Interrupted after start of upcall, send venus a signal */ - struct cfs_in_hdr *dog; + struct coda_in_hdr *dog; struct vmsg *svmp; - if (cfsdebug||1) + if (codadebug||1) myprintf(("Sending Venus a signal: op = %d.%d, flags = %x\n", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); REMQUE(vmp->vm_chain); error = EINTR; - CFS_ALLOC(svmp, struct vmsg *, sizeof (struct vmsg)); + CODA_ALLOC(svmp, struct vmsg *, sizeof (struct vmsg)); - CFS_ALLOC((svmp->vm_data), char *, sizeof (struct cfs_in_hdr)); - dog = (struct cfs_in_hdr *)svmp->vm_data; + CODA_ALLOC((svmp->vm_data), char *, sizeof (struct coda_in_hdr)); + dog = (struct coda_in_hdr *)svmp->vm_data; svmp->vm_flags = 0; - dog->opcode = svmp->vm_opcode = CFS_SIGNAL; + dog->opcode = svmp->vm_opcode = CODA_SIGNAL; dog->unique = svmp->vm_unique = vmp->vm_unique; - svmp->vm_inSize = sizeof (struct cfs_in_hdr); -/*??? rvb */ svmp->vm_outSize = sizeof (struct cfs_in_hdr); + svmp->vm_inSize = sizeof (struct coda_in_hdr); +/*??? rvb */ svmp->vm_outSize = sizeof (struct coda_in_hdr); - if (cfsdebug) - myprintf(("cfscall: enqueing signal msg (%d, %d)\n", + if (codadebug) + myprintf(("coda_call: enqueing signal msg (%d, %d)\n", svmp->vm_opcode, svmp->vm_unique)); /* insert at head of queue! */ @@ -684,16 +687,16 @@ cfscall(mntinfo, inSize, outSize, buffer) } else { /* If venus died (!VC_OPEN(vcp)) */ - if (cfsdebug) + if (codadebug) myprintf(("vcclose woke op %d.%d flags %d\n", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); error = ENODEV; } - CFS_FREE(vmp, sizeof(struct vmsg)); + CODA_FREE(vmp, sizeof(struct vmsg)); if (!error) - error = ((struct cfs_out_hdr *)buffer)->result; + error = ((struct coda_out_hdr *)buffer)->result; return(error); } diff --git a/sys/cfs/cfs_subr.c b/sys/cfs/cfs_subr.c index 5a55e8a..3e6472d 100644 --- a/sys/cfs/cfs_subr.c +++ b/sys/cfs/cfs_subr.c @@ -68,7 +68,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.7 98/01/23 11:53:42 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.6.2.3 98/01/23 11:21:05 rvb * Sync with 2.2.5 @@ -108,7 +108,7 @@ * >64Meg; venus can be killed! * * Revision 1.5 97/08/05 11:08:17 lily - * Removed cfsnc_replace, replaced it with a cfs_find, unhash, and + * Removed cfsnc_replace, replaced it with a coda_find, unhash, and * rehash. This fixes a cnode leak and a bug in which the fid is * not actually replaced. (cfs_namecache.c, cfsnc.h, cfs_subr.c) * @@ -123,7 +123,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:27 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:07:59 bnoble * Branch for NetBSD port revisions @@ -161,7 +161,7 @@ * * Revision 2.4 92/09/30 14:16:26 mja * Incorporated Dave Steere's fix for the GNU-Emacs bug. - * Also, included his cfs_flush routine in place of the former cfsnc_flush. + * Also, included his coda_flush routine in place of the former coda_nc_flush. * [91/02/07 jjk] * * Added contributors blurb. @@ -196,17 +196,17 @@ */ /* NOTES: rvb - * 1. Added cfs_unmounting to mark all cnodes as being UNMOUNTING. This has to + * 1. Added coda_unmounting to mark all cnodes as being UNMOUNTING. This has to * be done before dounmount is called. Because some of the routines that - * dounmount calls before cfs_unmounted might try to force flushes to venus. + * dounmount calls before coda_unmounted might try to force flushes to venus. * The vnode pager does this. - * 2. cfs_unmounting marks all cnodes scanning cfs_cache. + * 2. coda_unmounting marks all cnodes scanning coda_cache. * 3. cfs_checkunmounting (under DEBUG) checks all cnodes by chasing the vnodes * under the /coda mount point. - * 4. cfs_cacheprint (under DEBUG) prints names with vnode/cnode address + * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address */ -#include +#include #include #include @@ -220,14 +220,14 @@ #include #include -int cfs_active = 0; -int cfs_reuse = 0; -int cfs_new = 0; +int coda_active = 0; +int coda_reuse = 0; +int coda_new = 0; -struct cnode *cfs_freelist = NULL; -struct cnode *cfs_cache[CFS_CACHESIZE]; +struct cnode *coda_freelist = NULL; +struct cnode *coda_cache[CODA_CACHESIZE]; -#define cfshash(fid) (((fid)->Volume + (fid)->Vnode) & (CFS_CACHESIZE-1)) +#define coda_hash(fid) (((fid)->Volume + (fid)->Vnode) & (CODA_CACHESIZE-1)) #define CNODE_NEXT(cp) ((cp)->c_next) #define ODD(vnode) ((vnode) & 0x1) @@ -235,22 +235,22 @@ struct cnode *cfs_cache[CFS_CACHESIZE]; * Allocate a cnode. */ struct cnode * -cfs_alloc(void) +coda_alloc(void) { struct cnode *cp; - if (cfs_freelist) { - cp = cfs_freelist; - cfs_freelist = CNODE_NEXT(cp); - cfs_reuse++; + if (coda_freelist) { + cp = coda_freelist; + coda_freelist = CNODE_NEXT(cp); + coda_reuse++; } else { - CFS_ALLOC(cp, struct cnode *, sizeof(struct cnode)); + CODA_ALLOC(cp, struct cnode *, sizeof(struct cnode)); /* NetBSD vnodes don't have any Pager info in them ('cause there are no external pagers, duh!) */ #define VNODE_VM_INFO_INIT(vp) /* MT */ VNODE_VM_INFO_INIT(CTOV(cp)); - cfs_new++; + coda_new++; } bzero(cp, sizeof (struct cnode)); @@ -261,40 +261,40 @@ cfs_alloc(void) * Deallocate a cnode. */ void -cfs_free(cp) +coda_free(cp) register struct cnode *cp; { - CNODE_NEXT(cp) = cfs_freelist; - cfs_freelist = cp; + CNODE_NEXT(cp) = coda_freelist; + coda_freelist = cp; } /* * Put a cnode in the hash table */ void -cfs_save(cp) +coda_save(cp) struct cnode *cp; { - CNODE_NEXT(cp) = cfs_cache[cfshash(&cp->c_fid)]; - cfs_cache[cfshash(&cp->c_fid)] = cp; + CNODE_NEXT(cp) = coda_cache[coda_hash(&cp->c_fid)]; + coda_cache[coda_hash(&cp->c_fid)] = cp; } /* * Remove a cnode from the hash table */ void -cfs_unsave(cp) +coda_unsave(cp) struct cnode *cp; { struct cnode *ptr; struct cnode *ptrprev = NULL; - ptr = cfs_cache[cfshash(&cp->c_fid)]; + ptr = coda_cache[coda_hash(&cp->c_fid)]; while (ptr != NULL) { if (ptr == cp) { if (ptrprev == NULL) { - cfs_cache[cfshash(&cp->c_fid)] + coda_cache[coda_hash(&cp->c_fid)] = CNODE_NEXT(ptr); } else { CNODE_NEXT(ptrprev) = CNODE_NEXT(ptr); @@ -313,19 +313,19 @@ cfs_unsave(cp) * NOTE: this allows multiple cnodes with same fid -- dcs 1/25/95 */ struct cnode * -cfs_find(fid) +coda_find(fid) ViceFid *fid; { struct cnode *cp; - cp = cfs_cache[cfshash(fid)]; + cp = coda_cache[coda_hash(fid)]; while (cp) { if ((cp->c_fid.Vnode == fid->Vnode) && (cp->c_fid.Volume == fid->Volume) && (cp->c_fid.Unique == fid->Unique) && (!IS_UNMOUNTING(cp))) { - cfs_active++; + coda_active++; return(cp); } cp = CNODE_NEXT(cp); @@ -334,16 +334,16 @@ cfs_find(fid) } /* - * cfs_kill is called as a side effect to vcopen. To prevent any + * coda_kill is called as a side effect to vcopen. To prevent any * cnodes left around from an earlier run of a venus or warden from * causing problems with the new instance, mark any outstanding cnodes * as dying. Future operations on these cnodes should fail (excepting - * cfs_inactive of course!). Since multiple venii/wardens can be + * coda_inactive of course!). Since multiple venii/wardens can be * running, only kill the cnodes for a particular entry in the - * cfs_mnttbl. -- DCS 12/1/94 */ + * coda_mnttbl. -- DCS 12/1/94 */ int -cfs_kill(whoIam, dcstat) +coda_kill(whoIam, dcstat) struct mount *whoIam; enum dc_status dcstat; { @@ -361,16 +361,16 @@ cfs_kill(whoIam, dcstat) /* This is slightly overkill, but should work. Eventually it'd be * nice to only flush those entries from the namecache that * reference a vnode in this vfs. */ - cfsnc_flush(dcstat); + coda_nc_flush(dcstat); - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (CTOV(cp)->v_mount == whoIam) { #ifdef DEBUG - printf("cfs_kill: vp %p, cp %p\n", CTOV(cp), cp); + printf("coda_kill: vp %p, cp %p\n", CTOV(cp), cp); #endif count++; - CFSDEBUG(CFS_FLUSH, + CODADEBUG(CODA_FLUSH, myprintf(("Live cnode fid %lx.%lx.%lx flags %d count %d\n", (cp->c_fid).Volume, (cp->c_fid).Vnode, @@ -388,21 +388,21 @@ cfs_kill(whoIam, dcstat) * name cache or it may be executing. */ void -cfs_flush(dcstat) +coda_flush(dcstat) enum dc_status dcstat; { int hash; struct cnode *cp; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_FLUSH]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_FLUSH]++; - cfsnc_flush(dcstat); /* flush files from the name cache */ + coda_nc_flush(dcstat); /* flush files from the name cache */ - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (!ODD(cp->c_fid.Vnode)) /* only files can be executed */ - cfs_vmflush(cp); + coda_vmflush(cp); } } } @@ -412,13 +412,13 @@ cfs_flush(dcstat) * name cache flush. */ void -cfs_testflush(void) +coda_testflush(void) { int hash; struct cnode *cp; - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { myprintf(("Live cnode fid %lx.%lx.%lx count %d\n", @@ -435,17 +435,17 @@ cfs_testflush(void) * */ void -cfs_unmounting(whoIam) +coda_unmounting(whoIam) struct mount *whoIam; { int hash; struct cnode *cp; - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (CTOV(cp)->v_mount == whoIam) { if (cp->c_flags & (C_LOCKED|C_WANTED)) { - printf("cfs_unmounting: Unlocking %p\n", cp); + printf("coda_unmounting: Unlocking %p\n", cp); cp->c_flags &= ~(C_LOCKED|C_WANTED); wakeup((caddr_t) cp); } @@ -456,8 +456,7 @@ cfs_unmounting(whoIam) } #ifdef DEBUG -void -cfs_checkunmounting(mp) +coda_checkunmounting(mp) struct mount *mp; { register struct vnode *vp, *nvp; @@ -478,29 +477,29 @@ loop: } } -void -cfs_cacheprint(whoIam) +int +coda_cacheprint(whoIam) struct mount *whoIam; { int hash; struct cnode *cp; int count = 0; - printf("cfs_cacheprint: cfs_ctlvp %p, cp %p", cfs_ctlvp, VTOC(cfs_ctlvp)); - cfsnc_name(VTOC(cfs_ctlvp)); + printf("coda_cacheprint: coda_ctlvp %p, cp %p", coda_ctlvp, VTOC(coda_ctlvp)); + coda_nc_name(coda_ctlvp); printf("\n"); - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (CTOV(cp)->v_mount == whoIam) { - printf("cfs_cacheprint: vp %p, cp %p", CTOV(cp), cp); - cfsnc_name(cp); + printf("coda_cacheprint: vp %p, cp %p", CTOV(cp), cp); + coda_nc_name(cp); printf("\n"); count++; } } } - printf("cfs_cacheprint: count %d\n", count); + printf("coda_cacheprint: count %d\n", count); } #endif @@ -508,17 +507,17 @@ cfs_cacheprint(whoIam) * There are 6 cases where invalidations occur. The semantics of each * is listed here. * - * CFS_FLUSH -- flush all entries from the name cache and the cnode cache. - * CFS_PURGEUSER -- flush all entries from the name cache for a specific user + * CODA_FLUSH -- flush all entries from the name cache and the cnode cache. + * CODA_PURGEUSER -- flush all entries from the name cache for a specific user * This call is a result of token expiration. * * The next two are the result of callbacks on a file or directory. - * CFS_ZAPDIR -- flush the attributes for the dir from its cnode. + * CODA_ZAPDIR -- flush the attributes for the dir from its cnode. * Zap all children of this directory from the namecache. - * CFS_ZAPFILE -- flush the attributes for a file. + * CODA_ZAPFILE -- flush the attributes for a file. * * The fifth is a result of Venus detecting an inconsistent file. - * CFS_PURGEFID -- flush the attribute for the file + * CODA_PURGEFID -- flush the attribute for the file * If it is a dir (odd vnode), purge its * children from the namecache * remove the file from the namecache. @@ -526,7 +525,7 @@ cfs_cacheprint(whoIam) * The sixth allows Venus to replace local fids with global ones * during reintegration. * - * CFS_REPLACE -- replace one ViceFid with another throughout the name cache + * CODA_REPLACE -- replace one ViceFid with another throughout the name cache */ int handleDownCall(opcode, out) @@ -536,38 +535,38 @@ int handleDownCall(opcode, out) /* Handle invalidate requests. */ switch (opcode) { - case CFS_FLUSH : { + case CODA_FLUSH : { - cfs_flush(IS_DOWNCALL); + coda_flush(IS_DOWNCALL); - CFSDEBUG(CFS_FLUSH,cfs_testflush();) /* print remaining cnodes */ + CODADEBUG(CODA_FLUSH,coda_testflush();) /* print remaining cnodes */ return(0); } - case CFS_PURGEUSER : { - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_PURGEUSER]++; + case CODA_PURGEUSER : { + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_PURGEUSER]++; /* XXX - need to prevent fsync's */ - cfsnc_purge_user(out->cfs_purgeuser.cred.cr_uid, IS_DOWNCALL); + coda_nc_purge_user(out->coda_purgeuser.cred.cr_uid, IS_DOWNCALL); return(0); } - case CFS_ZAPFILE : { + case CODA_ZAPFILE : { struct cnode *cp; error = 0; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_ZAPFILE]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_ZAPFILE]++; - cp = cfs_find(&out->cfs_zapfile.CodaFid); + cp = coda_find(&out->coda_zapfile.CodaFid); if (cp != NULL) { vref(CTOV(cp)); cp->c_flags &= ~C_VATTR; if (CTOV(cp)->v_flag & VTEXT) - error = cfs_vmflush(cp); - CFSDEBUG(CFS_ZAPFILE, myprintf(("zapfile: fid = (%lx.%lx.%lx), + error = coda_vmflush(cp); + CODADEBUG(CODA_ZAPFILE, myprintf(("zapfile: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, @@ -582,20 +581,20 @@ int handleDownCall(opcode, out) return(error); } - case CFS_ZAPDIR : { + case CODA_ZAPDIR : { struct cnode *cp; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_ZAPDIR]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_ZAPDIR]++; - cp = cfs_find(&out->cfs_zapdir.CodaFid); + cp = coda_find(&out->coda_zapdir.CodaFid); if (cp != NULL) { vref(CTOV(cp)); cp->c_flags &= ~C_VATTR; - cfsnc_zapParentfid(&out->cfs_zapdir.CodaFid, IS_DOWNCALL); + coda_nc_zapParentfid(&out->coda_zapdir.CodaFid, IS_DOWNCALL); - CFSDEBUG(CFS_ZAPDIR, myprintf(("zapdir: fid = (%lx.%lx.%lx), + CODADEBUG(CODA_ZAPDIR, myprintf(("zapdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, @@ -609,44 +608,44 @@ int handleDownCall(opcode, out) return(0); } - case CFS_ZAPVNODE : { - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_ZAPVNODE]++; + case CODA_ZAPVNODE : { + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_ZAPVNODE]++; - myprintf(("CFS_ZAPVNODE: Called, but uniplemented\n")); + myprintf(("CODA_ZAPVNODE: Called, but uniplemented\n")); /* * Not that below we must really translate the returned coda_cred to * a netbsd cred. This is a bit muddled at present and the cfsnc_zapnode * is further unimplemented, so punt! * I suppose we could use just the uid. */ - /* cfsnc_zapvnode(&out->cfs_zapvnode.VFid, &out->cfs_zapvnode.cred, + /* coda_nc_zapvnode(&out->coda_zapvnode.VFid, &out->coda_zapvnode.cred, IS_DOWNCALL); */ return(0); } - case CFS_PURGEFID : { + case CODA_PURGEFID : { struct cnode *cp; error = 0; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_PURGEFID]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_PURGEFID]++; - cp = cfs_find(&out->cfs_purgefid.CodaFid); + cp = coda_find(&out->coda_purgefid.CodaFid); if (cp != NULL) { vref(CTOV(cp)); - if (ODD(out->cfs_purgefid.CodaFid.Vnode)) { /* Vnode is a directory */ - cfsnc_zapParentfid(&out->cfs_purgefid.CodaFid, + if (ODD(out->coda_purgefid.CodaFid.Vnode)) { /* Vnode is a directory */ + coda_nc_zapParentfid(&out->coda_purgefid.CodaFid, IS_DOWNCALL); } cp->c_flags &= ~C_VATTR; - cfsnc_zapfid(&out->cfs_purgefid.CodaFid, IS_DOWNCALL); - if (!(ODD(out->cfs_purgefid.CodaFid.Vnode)) + coda_nc_zapfid(&out->coda_purgefid.CodaFid, IS_DOWNCALL); + if (!(ODD(out->coda_purgefid.CodaFid.Vnode)) && (CTOV(cp)->v_flag & VTEXT)) { - error = cfs_vmflush(cp); + error = coda_vmflush(cp); } - CFSDEBUG(CFS_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", + CODADEBUG(CODA_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, CTOV(cp)->v_usecount - 1, error));); @@ -658,24 +657,24 @@ int handleDownCall(opcode, out) return(error); } - case CFS_REPLACE : { + case CODA_REPLACE : { struct cnode *cp = NULL; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_REPLACE]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_REPLACE]++; - cp = cfs_find(&out->cfs_replace.OldFid); + cp = coda_find(&out->coda_replace.OldFid); if (cp != NULL) { /* remove the cnode from the hash table, replace the fid, and reinsert */ vref(CTOV(cp)); - cfs_unsave(cp); - cp->c_fid = out->cfs_replace.NewFid; - cfs_save(cp); - - CFSDEBUG(CFS_REPLACE, myprintf(("replace: oldfid = (%lx.%lx.%lx), newfid = (%lx.%lx.%lx), cp = %p\n", - out->cfs_replace.OldFid.Volume, - out->cfs_replace.OldFid.Vnode, - out->cfs_replace.OldFid.Unique, + coda_unsave(cp); + cp->c_fid = out->coda_replace.NewFid; + coda_save(cp); + + CODADEBUG(CODA_REPLACE, myprintf(("replace: oldfid = (%lx.%lx.%lx), newfid = (%lx.%lx.%lx), cp = %p\n", + out->coda_replace.OldFid.Volume, + out->coda_replace.OldFid.Vnode, + out->coda_replace.OldFid.Unique, cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, cp));) vrele(CTOV(cp)); @@ -688,10 +687,10 @@ int handleDownCall(opcode, out) } } -/* cfs_grab_vnode: lives in either cfs_mach.c or cfs_nbsd.c */ +/* coda_grab_vnode: lives in either cfs_mach.c or cfs_nbsd.c */ int -cfs_vmflush(cp) +coda_vmflush(cp) struct cnode *cp; { return 0; @@ -701,22 +700,22 @@ cfs_vmflush(cp) /* * kernel-internal debugging switches */ -void cfs_debugon(void) +void coda_debugon(void) { - cfsdebug = -1; - cfsnc_debug = -1; - cfs_vnop_print_entry = 1; - cfs_psdev_print_entry = 1; - cfs_vfsop_print_entry = 1; + codadebug = -1; + coda_nc_debug = -1; + coda_vnop_print_entry = 1; + coda_psdev_print_entry = 1; + coda_vfsop_print_entry = 1; } -void cfs_debugoff(void) +void coda_debugoff(void) { - cfsdebug = 0; - cfsnc_debug = 0; - cfs_vnop_print_entry = 0; - cfs_psdev_print_entry = 0; - cfs_vfsop_print_entry = 0; + codadebug = 0; + coda_nc_debug = 0; + coda_vnop_print_entry = 0; + coda_psdev_print_entry = 0; + coda_vfsop_print_entry = 0; } /* diff --git a/sys/cfs/cfs_subr.h b/sys/cfs/cfs_subr.h index 0263432..7a68e58 100644 --- a/sys/cfs/cfs_subr.h +++ b/sys/cfs/cfs_subr.h @@ -31,15 +31,15 @@ * */ -struct cnode *cfs_alloc(void); -void cfs_free(struct cnode *cp); -struct cnode *cfs_find(ViceFid *fid); -void cfs_flush(enum dc_status dcstat); -void cfs_testflush(void); -void cfs_checkunmounting(struct mount *mp); -void cfs_cacheprint(struct mount *whoIam); -void cfs_debugon(void); -void cfs_debugoff(void); -int cfs_kill(struct mount *whoIam, enum dc_status dcstat); -void cfs_save(struct cnode *cp); -void cfs_unsave(struct cnode *cp); +struct cnode *coda_alloc(void); +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_debugon(void); +void coda_debugoff(void); +int coda_kill(struct mount *whoIam, enum dc_status dcstat); +void coda_save(struct cnode *cp); +void coda_unsave(struct cnode *cp); diff --git a/sys/cfs/cfs_venus.c b/sys/cfs/cfs_venus.c index 7f7b30b..586d30d 100644 --- a/sys/cfs/cfs_venus.c +++ b/sys/cfs/cfs_venus.c @@ -26,8 +26,8 @@ * improvements or extensions that they make, and to grant Carnegie * Mellon the rights to redistribute these changes without encumbrance. * - * @(#) src/sys/cfs/cfs_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * @(#) src/sys/cfs/coda_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: coda_venus.c,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -45,10 +45,10 @@ #include #define DECL_NO_IN(name) \ - struct cfs_in_hdr *inp; \ + struct coda_in_hdr *inp; \ struct name ## _out *outp; \ - int name ## _size = sizeof (struct cfs_in_hdr); \ - int Isize = sizeof (struct cfs_in_hdr); \ + int name ## _size = sizeof (struct coda_in_hdr); \ + int Isize = sizeof (struct coda_in_hdr); \ int Osize = sizeof (struct name ## _out); \ int error @@ -62,29 +62,29 @@ #define DECL_NO_OUT(name) \ struct name ## _in *inp; \ - struct cfs_out_hdr *outp; \ + struct coda_out_hdr *outp; \ int name ## _size = sizeof (struct name ## _in); \ int Isize = sizeof (struct name ## _in); \ - int Osize = sizeof (struct cfs_out_hdr); \ + int Osize = sizeof (struct coda_out_hdr); \ int error #define ALLOC_NO_IN(name) \ if (Osize > name ## _size) \ name ## _size = Osize; \ - CFS_ALLOC(inp, struct cfs_in_hdr *, name ## _size);\ + CODA_ALLOC(inp, struct coda_in_hdr *, name ## _size);\ outp = (struct name ## _out *) inp #define ALLOC(name) \ if (Osize > name ## _size) \ name ## _size = Osize; \ - CFS_ALLOC(inp, struct name ## _in *, name ## _size);\ + CODA_ALLOC(inp, struct name ## _in *, name ## _size);\ outp = (struct name ## _out *) inp #define ALLOC_NO_OUT(name) \ if (Osize > name ## _size) \ name ## _size = Osize; \ - CFS_ALLOC(inp, struct name ## _in *, name ## _size);\ - outp = (struct cfs_out_hdr *) inp + CODA_ALLOC(inp, struct name ## _in *, name ## _size);\ + outp = (struct coda_out_hdr *) inp #define STRCPY(struc, name, len) \ bcopy(name, (char *)inp + (int)inp->struc, len); \ @@ -163,17 +163,17 @@ venus_root(void *mdp, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid) { - DECL_NO_IN(cfs_root); /* sets Isize & Osize */ - ALLOC_NO_IN(cfs_root); /* sets inp & outp */ + DECL_NO_IN(coda_root); /* sets Isize & Osize */ + ALLOC_NO_IN(coda_root); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(inp, CFS_ROOT, cred, p); + INIT_IN(inp, CODA_ROOT, cred, p); - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) *VFid = outp->VFid; - CFS_FREE(inp, cfs_root_size); + CODA_FREE(inp, coda_root_size); return error; } @@ -183,22 +183,22 @@ venus_open(void *mdp, ViceFid *fid, int flag, /*out*/ dev_t *dev, ino_t *inode) { int cflag; - DECL(cfs_open); /* sets Isize & Osize */ - ALLOC(cfs_open); /* sets inp & outp */ + DECL(coda_open); /* sets Isize & Osize */ + ALLOC(coda_open); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_OPEN, cred, p); + INIT_IN(&inp->ih, CODA_OPEN, cred, p); inp->VFid = *fid; CNV_OFLAG(cflag, flag); inp->flags = cflag; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *dev = outp->dev; *inode = outp->inode; } - CFS_FREE(inp, cfs_open_size); + CODA_FREE(inp, coda_open_size); return error; } @@ -207,17 +207,17 @@ venus_close(void *mdp, ViceFid *fid, int flag, struct ucred *cred, struct proc *p) { int cflag; - DECL_NO_OUT(cfs_close); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_close); /* sets inp & outp */ + DECL_NO_OUT(coda_close); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_close); /* sets inp & outp */ - INIT_IN(&inp->ih, CFS_CLOSE, cred, p); + INIT_IN(&inp->ih, CODA_CLOSE, cred, p); inp->VFid = *fid; CNV_OFLAG(cflag, flag); inp->flags = cflag; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_close_size); + CODA_FREE(inp, coda_close_size); return error; } @@ -244,14 +244,14 @@ venus_ioctl(void *mdp, ViceFid *fid, int com, int flag, caddr_t data, struct ucred *cred, struct proc *p) { - DECL(cfs_ioctl); /* sets Isize & Osize */ + DECL(coda_ioctl); /* sets Isize & Osize */ struct PioctlData *iap = (struct PioctlData *)data; int tmp; - cfs_ioctl_size = VC_MAXMSGSIZE; - ALLOC(cfs_ioctl); /* sets inp & outp */ + coda_ioctl_size = VC_MAXMSGSIZE; + ALLOC(coda_ioctl); /* sets inp & outp */ - INIT_IN(&inp->ih, CFS_IOCTL, cred, p); + INIT_IN(&inp->ih, CODA_IOCTL, cred, p); inp->VFid = *fid; /* command was mutated by increasing its size field to reflect the @@ -264,17 +264,17 @@ venus_ioctl(void *mdp, ViceFid *fid, inp->rwflag = flag; inp->len = iap->vi.in_size; - inp->data = (char *)(sizeof (struct cfs_ioctl_in)); + inp->data = (char *)(sizeof (struct coda_ioctl_in)); error = copyin(iap->vi.in, (char*)inp + (int)inp->data, iap->vi.in_size); if (error) { - CFS_FREE(inp, cfs_ioctl_size); + CODA_FREE(inp, coda_ioctl_size); return(error); } Osize = VC_MAXMSGSIZE; - error = cfscall(mdp, Isize + iap->vi.in_size, &Osize, (char *)inp); + error = coda_call(mdp, Isize + iap->vi.in_size, &Osize, (char *)inp); /* copy out the out buffer. */ if (!error) { @@ -286,7 +286,7 @@ venus_ioctl(void *mdp, ViceFid *fid, } } - CFS_FREE(inp, cfs_ioctl_size); + CODA_FREE(inp, coda_ioctl_size); return error; } @@ -295,19 +295,19 @@ venus_getattr(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ struct vattr *vap) { - DECL(cfs_getattr); /* sets Isize & Osize */ - ALLOC(cfs_getattr); /* sets inp & outp */ + DECL(coda_getattr); /* sets Isize & Osize */ + ALLOC(coda_getattr); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_GETATTR, cred, p); + INIT_IN(&inp->ih, CODA_GETATTR, cred, p); inp->VFid = *fid; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { CNV_VV2V_ATTR(vap, &outp->attr); } - CFS_FREE(inp, cfs_getattr_size); + CODA_FREE(inp, coda_getattr_size); return error; } @@ -315,17 +315,17 @@ int venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_setattr); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_setattr); /* sets inp & outp */ + DECL_NO_OUT(coda_setattr); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_setattr); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_SETATTR, cred, p); + INIT_IN(&inp->ih, CODA_SETATTR, cred, p); inp->VFid = *fid; CNV_V2VV_ATTR(&inp->attr, vap); - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_setattr_size); + CODA_FREE(inp, coda_setattr_size); return error; } @@ -333,11 +333,11 @@ int venus_access(void *mdp, ViceFid *fid, int mode, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_access); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_access); /* sets inp & outp */ + DECL_NO_OUT(coda_access); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_access); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_ACCESS, cred, p); + INIT_IN(&inp->ih, CODA_ACCESS, cred, p); inp->VFid = *fid; /* NOTE: * NetBSD and Venus internals use the "data" in the low 3 bits. @@ -345,9 +345,9 @@ venus_access(void *mdp, ViceFid *fid, int mode, */ inp->flags = mode>>6; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_access_size); + CODA_FREE(inp, coda_access_size); return error; } @@ -356,23 +356,23 @@ venus_readlink(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ char **str, int *len) { - DECL(cfs_readlink); /* sets Isize & Osize */ - cfs_readlink_size += CFS_MAXPATHLEN; - ALLOC(cfs_readlink); /* sets inp & outp */ + DECL(coda_readlink); /* sets Isize & Osize */ + coda_readlink_size += CODA_MAXPATHLEN; + ALLOC(coda_readlink); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_READLINK, cred, p); + INIT_IN(&inp->ih, CODA_READLINK, cred, p); inp->VFid = *fid; - Osize += CFS_MAXPATHLEN; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + Osize += CODA_MAXPATHLEN; + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { - CFS_ALLOC(*str, char *, outp->count); + CODA_ALLOC(*str, char *, outp->count); *len = outp->count; bcopy((char *)outp + (int)outp->data, *str, *len); } - CFS_FREE(inp, cfs_readlink_size); + CODA_FREE(inp, coda_readlink_size); return error; } @@ -380,16 +380,16 @@ int venus_fsync(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_fsync); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_fsync); /* sets inp & outp */ + DECL_NO_OUT(coda_fsync); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_fsync); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_FSYNC, cred, p); + INIT_IN(&inp->ih, CODA_FSYNC, cred, p); inp->VFid = *fid; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_fsync_size); + CODA_FREE(inp, coda_fsync_size); return error; } @@ -399,24 +399,24 @@ venus_lookup(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, int *vtype) { - DECL(cfs_lookup); /* sets Isize & Osize */ - cfs_lookup_size += len + 1; - ALLOC(cfs_lookup); /* sets inp & outp */ + DECL(coda_lookup); /* sets Isize & Osize */ + coda_lookup_size += len + 1; + ALLOC(coda_lookup); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_LOOKUP, cred, p); + INIT_IN(&inp->ih, CODA_LOOKUP, cred, p); inp->VFid = *fid; inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; *vtype = outp->vtype; } - CFS_FREE(inp, cfs_lookup_size); + CODA_FREE(inp, coda_lookup_size); return error; } @@ -426,12 +426,12 @@ venus_create(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, struct vattr *attr) { - DECL(cfs_create); /* sets Isize & Osize */ - cfs_create_size += len + 1; - ALLOC(cfs_create); /* sets inp & outp */ + DECL(coda_create); /* sets Isize & Osize */ + coda_create_size += len + 1; + ALLOC(coda_create); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_CREATE, cred, p); + INIT_IN(&inp->ih, CODA_CREATE, cred, p); inp->VFid = *fid; inp->excl = exclusive ? C_O_EXCL : 0; inp->mode = mode; @@ -440,13 +440,13 @@ venus_create(void *mdp, ViceFid *fid, inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; CNV_VV2V_ATTR(attr, &outp->attr); } - CFS_FREE(inp, cfs_create_size); + CODA_FREE(inp, coda_create_size); return error; } @@ -455,20 +455,20 @@ venus_remove(void *mdp, ViceFid *fid, const char *nm, int len, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_remove); /* sets Isize & Osize */ - cfs_remove_size += len + 1; - ALLOC_NO_OUT(cfs_remove); /* sets inp & outp */ + DECL_NO_OUT(coda_remove); /* sets Isize & Osize */ + coda_remove_size += len + 1; + ALLOC_NO_OUT(coda_remove); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_REMOVE, cred, p); + INIT_IN(&inp->ih, CODA_REMOVE, cred, p); inp->VFid = *fid; inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_remove_size); + CODA_FREE(inp, coda_remove_size); return error; } @@ -477,21 +477,21 @@ venus_link(void *mdp, ViceFid *fid, ViceFid *tfid, const char *nm, int len, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_link); /* sets Isize & Osize */ - cfs_link_size += len + 1; - ALLOC_NO_OUT(cfs_link); /* sets inp & outp */ + DECL_NO_OUT(coda_link); /* sets Isize & Osize */ + coda_link_size += len + 1; + ALLOC_NO_OUT(coda_link); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_LINK, cred, p); + INIT_IN(&inp->ih, CODA_LINK, cred, p); inp->sourceFid = *fid; inp->destFid = *tfid; inp->tname = Isize; STRCPY(tname, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_link_size); + CODA_FREE(inp, coda_link_size); return error; } @@ -500,12 +500,12 @@ venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid, const char *nm, int len, const char *tnm, int tlen, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_rename); /* sets Isize & Osize */ - cfs_rename_size += len + 1 + tlen + 1; - ALLOC_NO_OUT(cfs_rename); /* sets inp & outp */ + DECL_NO_OUT(coda_rename); /* sets Isize & Osize */ + coda_rename_size += len + 1 + tlen + 1; + ALLOC_NO_OUT(coda_rename); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_RENAME, cred, p); + INIT_IN(&inp->ih, CODA_RENAME, cred, p); inp->sourceFid = *fid; inp->destFid = *tfid; @@ -515,9 +515,9 @@ venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid, inp->destname = Isize; STRCPY(destname, tnm, tlen); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_rename_size); + CODA_FREE(inp, coda_rename_size); return error; } @@ -527,25 +527,25 @@ venus_mkdir(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, struct vattr *ova) { - DECL(cfs_mkdir); /* sets Isize & Osize */ - cfs_mkdir_size += len + 1; - ALLOC(cfs_mkdir); /* sets inp & outp */ + DECL(coda_mkdir); /* sets Isize & Osize */ + coda_mkdir_size += len + 1; + ALLOC(coda_mkdir); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_MKDIR, cred, p); + INIT_IN(&inp->ih, CODA_MKDIR, cred, p); inp->VFid = *fid; CNV_V2VV_ATTR(&inp->attr, va); inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; CNV_VV2V_ATTR(ova, &outp->attr); } - CFS_FREE(inp, cfs_mkdir_size); + CODA_FREE(inp, coda_mkdir_size); return error; } @@ -554,20 +554,20 @@ venus_rmdir(void *mdp, ViceFid *fid, const char *nm, int len, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_rmdir); /* sets Isize & Osize */ - cfs_rmdir_size += len + 1; - ALLOC_NO_OUT(cfs_rmdir); /* sets inp & outp */ + DECL_NO_OUT(coda_rmdir); /* sets Isize & Osize */ + coda_rmdir_size += len + 1; + ALLOC_NO_OUT(coda_rmdir); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_RMDIR, cred, p); + INIT_IN(&inp->ih, CODA_RMDIR, cred, p); inp->VFid = *fid; inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_rmdir_size); + CODA_FREE(inp, coda_rmdir_size); return error; } @@ -576,12 +576,12 @@ venus_symlink(void *mdp, ViceFid *fid, const char *lnm, int llen, const char *nm, int len, struct vattr *va, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_symlink); /* sets Isize & Osize */ - cfs_symlink_size += llen + 1 + len + 1; - ALLOC_NO_OUT(cfs_symlink); /* sets inp & outp */ + DECL_NO_OUT(coda_symlink); /* sets Isize & Osize */ + coda_symlink_size += llen + 1 + len + 1; + ALLOC_NO_OUT(coda_symlink); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_SYMLINK, cred, p); + INIT_IN(&inp->ih, CODA_SYMLINK, cred, p); inp->VFid = *fid; CNV_V2VV_ATTR(&inp->attr, va); @@ -591,9 +591,9 @@ venus_symlink(void *mdp, ViceFid *fid, inp->tname = Isize; STRCPY(tname, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_symlink_size); + CODA_FREE(inp, coda_symlink_size); return error; } @@ -603,24 +603,24 @@ venus_readdir(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ char *buffer, int *len) { - DECL(cfs_readdir); /* sets Isize & Osize */ - cfs_readdir_size = VC_MAXMSGSIZE; - ALLOC(cfs_readdir); /* sets inp & outp */ + DECL(coda_readdir); /* sets Isize & Osize */ + coda_readdir_size = VC_MAXMSGSIZE; + ALLOC(coda_readdir); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_READDIR, cred, p); + INIT_IN(&inp->ih, CODA_READDIR, cred, p); inp->VFid = *fid; inp->count = count; inp->offset = offset; Osize = VC_MAXMSGSIZE; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { bcopy((char *)outp + (int)outp->data, buffer, outp->size); *len = outp->size; } - CFS_FREE(inp, cfs_readdir_size); + CODA_FREE(inp, coda_readdir_size); return error; } @@ -629,19 +629,19 @@ venus_fhtovp(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, int *vtype) { - DECL(cfs_vget); /* sets Isize & Osize */ - ALLOC(cfs_vget); /* sets inp & outp */ + DECL(coda_vget); /* sets Isize & Osize */ + ALLOC(coda_vget); /* sets inp & outp */ /* Send the open to Venus. */ - INIT_IN(&inp->ih, CFS_VGET, cred, p); + INIT_IN(&inp->ih, CODA_VGET, cred, p); inp->VFid = *fid; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; *vtype = outp->vtype; } - CFS_FREE(inp, cfs_vget_size); + CODA_FREE(inp, coda_vget_size); return error; } diff --git a/sys/cfs/cfs_vfsops.c b/sys/cfs/cfs_vfsops.c index 0831e17..0abddd3 100644 --- a/sys/cfs/cfs_vfsops.c +++ b/sys/cfs/cfs_vfsops.c @@ -26,8 +26,8 @@ * improvements or extensions that they make, and to grant Carnegie * Mellon the rights to redistribute these changes without encumbrance. * - * @(#) src/sys/cfs/cfs_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: cfs_vfsops.c,v 1.2 1998/09/02 19:09:53 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.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -46,7 +46,7 @@ /* * HISTORY - * $Log: cfs_vfsops.c,v $ + * $Log: coda_vfsops.c,v $ * Revision 1.2 1998/09/02 19:09:53 rvb * Pass2 complete * @@ -69,13 +69,13 @@ * Fixes up mainly to flush iopen and friends * * Revision 1.7 98/01/23 11:53:45 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.6.2.6 98/01/23 11:21:07 rvb * Sync with 2.2.5 * * Revision 1.6.2.5 98/01/22 13:05:33 rvb - * Move makecfsnode ctlfid later so vfsp is known + * Move make_coda_node ctlfid later so vfsp is known * * Revision 1.6.2.4 97/12/19 14:26:05 rvb * session id @@ -96,7 +96,7 @@ * Final cfs_venus.c w/o macros, but one locking bug * * Revision 1.5.14.7 97/11/21 13:22:03 rvb - * Catch a few cfscalls in cfs_vfsops.c + * Catch a few coda_calls in coda_vfsops.c * * Revision 1.5.14.6 97/11/20 11:46:48 rvb * Capture current cfs_venus @@ -134,7 +134,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:32 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:02 bnoble * Branch for NetBSD port revisions @@ -162,7 +162,7 @@ * merge kernel/latest and alpha/src/cfs * * Revision 2.3 92/09/30 14:16:32 mja - * Added call to cfs_flush to cfs_unmount. + * Added call to coda_flush to coda_unmount. * [90/12/15 dcs] * * Added contributors blurb. @@ -177,7 +177,7 @@ * * */ -#include +#include #include #include @@ -198,56 +198,56 @@ #include -MALLOC_DEFINE(M_CFS, "CFS storage", "Various Coda Structures"); +MALLOC_DEFINE(M_CODA, "CODA storage", "Various Coda Structures"); -int cfsdebug = 0; -int cfs_vfsop_print_entry = 0; -#define ENTRY if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) +int codadebug = 0; +int coda_vfsop_print_entry = 0; +#define ENTRY if(coda_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -struct vnode *cfs_ctlvp; -struct cfs_mntinfo cfs_mnttbl[NVCFS]; /* indexed by minor device number */ +struct vnode *coda_ctlvp; +struct coda_mntinfo coda_mnttbl[NVCODA]; /* indexed by minor device number */ /* structure to keep statistics of internally generated/satisfied calls */ -struct cfs_op_stats cfs_vfsopstats[CFS_VFSOPS_SIZE]; +struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE]; -#define MARK_ENTRY(op) (cfs_vfsopstats[op].entries++) -#define MARK_INT_SAT(op) (cfs_vfsopstats[op].sat_intrn++) -#define MARK_INT_FAIL(op) (cfs_vfsopstats[op].unsat_intrn++) -#define MRAK_INT_GEN(op) (cfs_vfsopstats[op].gen_intrn++) +#define MARK_ENTRY(op) (coda_vfsopstats[op].entries++) +#define MARK_INT_SAT(op) (coda_vfsopstats[op].sat_intrn++) +#define MARK_INT_FAIL(op) (coda_vfsopstats[op].unsat_intrn++) +#define MRAK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++) -extern int cfsnc_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 *)); -struct vfsops cfs_vfsops = { - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, +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, - cfs_init, + coda_init, }; -VFS_SET(cfs_vfsops, cfs, VFCF_NETWORK); +VFS_SET(coda_vfsops, coda, VFCF_NETWORK); int -cfs_vfsopstats_init(void) +coda_vfsopstats_init(void) { register int i; - for (i=0;ini_vp; if (error) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return (error); } if (dvp->v_type != VCHR) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); vrele(dvp); return(ENXIO); } dev = dvp->v_specinfo->si_rdev; vrele(dvp); if (major(dev) >= nchrdev || major(dev) < 0) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENXIO); } @@ -313,22 +313,22 @@ cfs_mount(vfsp, path, data, ndp, p) */ if (cdevsw[major(dev)]->d_open != vc_nb_open) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENXIO); } - if (minor(dev) >= NVCFS || minor(dev) < 0) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + if (minor(dev) >= NVCODA || minor(dev) < 0) { + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENXIO); } /* * Initialize the mount record and link it to the vfs struct */ - mi = &cfs_mnttbl[minor(dev)]; + mi = &coda_mnttbl[minor(dev)]; if (!VC_OPEN(&mi->mi_vcomm)) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENODEV); } @@ -340,27 +340,27 @@ cfs_mount(vfsp, path, data, ndp, p) /* * Make a root vnode to placate the Vnode interface, but don't - * actually make the CFS_ROOT call to venus until the first call - * to cfs_root in case a server is down while venus is starting. + * actually make the CODA_ROOT call to venus until the first call + * to coda_root in case a server is down while venus is starting. */ rootfid.Volume = 0; rootfid.Vnode = 0; rootfid.Unique = 0; - cp = makecfsnode(&rootfid, vfsp, VDIR); + cp = make_coda_node(&rootfid, vfsp, VDIR); rootvp = CTOV(cp); rootvp->v_flag |= VROOT; ctlfid.Volume = CTL_VOL; ctlfid.Vnode = CTL_VNO; ctlfid.Unique = CTL_UNI; -/* cp = makecfsnode(&ctlfid, vfsp, VCHR); +/* cp = make_coda_node(&ctlfid, vfsp, VCHR); The above code seems to cause a loop in the cnode links. I don't totally understand when it happens, it is caught when closing down the system. */ - cp = makecfsnode(&ctlfid, 0, VCHR); + cp = make_coda_node(&ctlfid, 0, VCHR); - cfs_ctlvp = CTOV(cp); + coda_ctlvp = CTOV(cp); /* Add vfs and rootvp to chain of vfs hanging off mntinfo */ mi->mi_vfsp = vfsp; @@ -377,18 +377,18 @@ cfs_mount(vfsp, path, data, ndp, p) /* error is currently guaranteed to be zero, but in case some code changes... */ - CFSDEBUG(1, - myprintf(("cfs_mount returned %d\n",error));); + CODADEBUG(1, + myprintf(("coda_mount returned %d\n",error));); if (error) - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); else - MARK_INT_SAT(CFS_MOUNT_STATS); + MARK_INT_SAT(CODA_MOUNT_STATS); return(error); } int -cfs_start(vfsp, flags, p) +coda_start(vfsp, flags, p) struct mount *vfsp; int flags; struct proc *p; @@ -398,18 +398,18 @@ cfs_start(vfsp, flags, p) } int -cfs_unmount(vfsp, mntflags, p) +coda_unmount(vfsp, mntflags, p) struct mount *vfsp; int mntflags; struct proc *p; { - struct cfs_mntinfo *mi = vftomi(vfsp); + struct coda_mntinfo *mi = vftomi(vfsp); int active, error = 0; ENTRY; - MARK_ENTRY(CFS_UMOUNT_STATS); - if (!CFS_MOUNTED(vfsp)) { - MARK_INT_FAIL(CFS_UMOUNT_STATS); + MARK_ENTRY(CODA_UMOUNT_STATS); + if (!CODA_MOUNTED(vfsp)) { + MARK_INT_FAIL(CODA_UMOUNT_STATS); return(EINVAL); } @@ -418,13 +418,13 @@ cfs_unmount(vfsp, mntflags, p) return (EBUSY); /* Venus is still running */ #ifdef DEBUG - printf("cfs_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp)); + printf("coda_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp)); #endif vrele(mi->mi_rootvp); - active = cfs_kill(vfsp, NOT_DOWNCALL); + active = coda_kill(vfsp, NOT_DOWNCALL); error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE); - printf("cfs_unmount: active = %d, vflush active %d\n", active, error); + printf("coda_unmount: active = %d, vflush active %d\n", active, error); error = 0; /* I'm going to take this out to allow lookups to go through. I'm * not sure it's important anyway. -- DCS 2/2/94 @@ -436,9 +436,9 @@ cfs_unmount(vfsp, mntflags, p) mi->mi_rootvp = NULL; if (error) - MARK_INT_FAIL(CFS_UMOUNT_STATS); + MARK_INT_FAIL(CODA_UMOUNT_STATS); else - MARK_INT_SAT(CFS_UMOUNT_STATS); + MARK_INT_SAT(CODA_UMOUNT_STATS); return(error); } @@ -449,18 +449,18 @@ cfs_unmount(vfsp, mntflags, p) * find root of cfs */ int -cfs_root(vfsp, vpp) +coda_root(vfsp, vpp) struct mount *vfsp; struct vnode **vpp; { - struct cfs_mntinfo *mi = vftomi(vfsp); + struct coda_mntinfo *mi = vftomi(vfsp); struct vnode **result; int error; struct proc *p = curproc; /* XXX - bnoble */ ViceFid VFid; ENTRY; - MARK_ENTRY(CFS_ROOT_STATS); + MARK_ENTRY(CODA_ROOT_STATS); result = NULL; if (vfsp == mi->mi_vfsp) { @@ -476,7 +476,7 @@ cfs_root(vfsp, vpp) #else vget(*vpp, LK_EXCLUSIVE, p); #endif - MARK_INT_SAT(CFS_ROOT_STATS); + MARK_INT_SAT(CODA_ROOT_STATS); return(0); } } @@ -488,9 +488,9 @@ cfs_root(vfsp, vpp) * Save the new rootfid in the cnode, and rehash the cnode into the * cnode hash with the new fid key. */ - cfs_unsave(VTOC(mi->mi_rootvp)); + coda_unsave(VTOC(mi->mi_rootvp)); VTOC(mi->mi_rootvp)->c_fid = VFid; - cfs_save(VTOC(mi->mi_rootvp)); + coda_save(VTOC(mi->mi_rootvp)); *vpp = mi->mi_rootvp; #if 1 @@ -500,16 +500,16 @@ cfs_root(vfsp, vpp) vget(*vpp, LK_EXCLUSIVE, p); #endif - MARK_INT_SAT(CFS_ROOT_STATS); + MARK_INT_SAT(CODA_ROOT_STATS); goto exit; } else if (error == ENODEV) { /* Gross hack here! */ /* - * If Venus fails to respond to the CFS_ROOT call, cfscall returns + * If Venus fails to respond to the CODA_ROOT call, coda_call returns * ENODEV. Return the uninitialized root vnode to allow vfs * operations such as unmount to continue. Without this hack, * there is no way to do an unmount if Venus dies before a - * successful CFS_ROOT call is done. All vnode operations + * successful CODA_ROOT call is done. All vnode operations * will fail. */ *vpp = mi->mi_rootvp; @@ -520,12 +520,12 @@ cfs_root(vfsp, vpp) vget(*vpp, LK_EXCLUSIVE, p); #endif - MARK_INT_FAIL(CFS_ROOT_STATS); + MARK_INT_FAIL(CODA_ROOT_STATS); error = 0; goto exit; } else { - CFSDEBUG( CFS_ROOT, myprintf(("error %d in CFS_ROOT\n", error)); ); - MARK_INT_FAIL(CFS_ROOT_STATS); + CODADEBUG( CODA_ROOT, myprintf(("error %d in CODA_ROOT\n", error)); ); + MARK_INT_FAIL(CODA_ROOT_STATS); goto exit; } @@ -535,7 +535,7 @@ cfs_root(vfsp, vpp) } int -cfs_quotactl(vfsp, cmd, uid, arg, p) +coda_quotactl(vfsp, cmd, uid, arg, p) struct mount *vfsp; int cmd; uid_t uid; @@ -550,15 +550,15 @@ cfs_quotactl(vfsp, cmd, uid, arg, p) * Get file system statistics. */ int -cfs_nb_statfs(vfsp, sbp, p) +coda_nb_statfs(vfsp, sbp, p) register struct mount *vfsp; struct statfs *sbp; struct proc *p; { ENTRY; -/* MARK_ENTRY(CFS_STATFS_STATS); */ - if (!CFS_MOUNTED(vfsp)) { -/* MARK_INT_FAIL(CFS_STATFS_STATS);*/ +/* MARK_ENTRY(CODA_STATFS_STATS); */ + if (!CODA_MOUNTED(vfsp)) { +/* MARK_INT_FAIL(CODA_STATFS_STATS);*/ return(EINVAL); } @@ -579,8 +579,8 @@ cfs_nb_statfs(vfsp, sbp, p) sbp->f_ffree = NB_SFS_SIZ; bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t)); strcpy(sbp->f_mntonname, "/coda"); - strcpy(sbp->f_mntfromname, "CFS"); -/* MARK_INT_SAT(CFS_STATFS_STATS); */ + strcpy(sbp->f_mntfromname, "CODA"); +/* MARK_INT_SAT(CODA_STATFS_STATS); */ return(0); } @@ -588,20 +588,20 @@ cfs_nb_statfs(vfsp, sbp, p) * Flush any pending I/O. */ int -cfs_sync(vfsp, waitfor, cred, p) +coda_sync(vfsp, waitfor, cred, p) struct mount *vfsp; int waitfor; struct ucred *cred; struct proc *p; { ENTRY; - MARK_ENTRY(CFS_SYNC_STATS); - MARK_INT_SAT(CFS_SYNC_STATS); + MARK_ENTRY(CODA_SYNC_STATS); + MARK_INT_SAT(CODA_SYNC_STATS); return(0); } int -cfs_vget(vfsp, ino, vpp) +coda_vget(vfsp, ino, vpp) struct mount *vfsp; ino_t ino; struct vnode **vpp; @@ -616,7 +616,7 @@ cfs_vget(vfsp, ino, vpp) * a type-specific fid. */ int -cfs_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp) +coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp) register struct mount *vfsp; struct fid *fhp; struct mbuf *nam; @@ -633,33 +633,33 @@ cfs_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp) ENTRY; - MARK_ENTRY(CFS_VGET_STATS); + MARK_ENTRY(CODA_VGET_STATS); /* Check for vget of control object. */ if (IS_CTL_FID(&cfid->cfid_fid)) { - *vpp = cfs_ctlvp; - vref(cfs_ctlvp); - MARK_INT_SAT(CFS_VGET_STATS); + *vpp = coda_ctlvp; + vref(coda_ctlvp); + MARK_INT_SAT(CODA_VGET_STATS); return(0); } error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, p->p_cred->pc_ucred, p, &VFid, &vtype); if (error) { - CFSDEBUG(CFS_VGET, myprintf(("vget error %d\n",error));) + CODADEBUG(CODA_VGET, myprintf(("vget error %d\n",error));) *vpp = (struct vnode *)0; } else { - CFSDEBUG(CFS_VGET, + CODADEBUG(CODA_VGET, myprintf(("vget: vol %lx vno %lx uni %lx type %d result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, vtype, error)); ) - cp = makecfsnode(&VFid, vfsp, vtype); + cp = make_coda_node(&VFid, vfsp, vtype); *vpp = CTOV(cp); } return(error); } int -cfs_vptofh(vnp, fidp) +coda_vptofh(vnp, fidp) struct vnode *vnp; struct fid *fidp; { @@ -668,7 +668,7 @@ cfs_vptofh(vnp, fidp) } int -cfs_init(struct vfsconf *vfsp) +coda_init(struct vfsconf *vfsp) { ENTRY; return 0; @@ -685,7 +685,7 @@ getNewVnode(vpp) struct vnode **vpp; { struct cfid cfid; - struct cfs_mntinfo *mi = vftomi((*vpp)->v_mount); + struct coda_mntinfo *mi = vftomi((*vpp)->v_mount); ENTRY; @@ -699,7 +699,7 @@ getNewVnode(vpp) if (mi->mi_vfsp == NULL) return ENODEV; - return cfs_fhtovp(mi->mi_vfsp, (struct fid*)&cfid, NULL, vpp, + return coda_fhtovp(mi->mi_vfsp, (struct fid*)&cfid, NULL, vpp, NULL, NULL); } diff --git a/sys/cfs/cfs_vfsops.h b/sys/cfs/cfs_vfsops.h index 754bbf3..ef23c3f 100644 --- a/sys/cfs/cfs_vfsops.h +++ b/sys/cfs/cfs_vfsops.h @@ -26,8 +26,8 @@ * improvements or extensions that they make, and to grant Carnegie * Mellon the rights to redistribute these changes without encumbrance. * - * @(#) src/sys/cfs/cfs_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * @(#) src/sys/cfs/coda_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: coda_vfsops.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -45,19 +45,19 @@ struct cfid { struct mount; -int cfs_vfsopstats_init(void); -int cfs_mount(struct mount *, char *, caddr_t, struct nameidata *, +int coda_vfsopstats_init(void); +int coda_mount(struct mount *, char *, caddr_t, struct nameidata *, struct proc *); -int cfs_start(struct mount *, int, struct proc *); -int cfs_unmount(struct mount *, int, struct proc *); -int cfs_root(struct mount *, struct vnode **); -int cfs_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *); -int cfs_nb_statfs(struct mount *, struct statfs *, struct proc *); -int cfs_sync(struct mount *, int, struct ucred *, struct proc *); -int cfs_vget(struct mount *, ino_t, struct vnode **); -int cfs_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, +int coda_start(struct mount *, int, struct proc *); +int coda_unmount(struct mount *, int, struct proc *); +int coda_root(struct mount *, struct vnode **); +int coda_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *); +int coda_nb_statfs(struct mount *, struct statfs *, struct proc *); +int coda_sync(struct mount *, int, struct ucred *, struct proc *); +int coda_vget(struct mount *, ino_t, struct vnode **); +int coda_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **); -int cfs_vptofh(struct vnode *, struct fid *); -int cfs_init(struct vfsconf *vfsp); +int coda_vptofh(struct vnode *, struct fid *); +int coda_init(struct vfsconf *vfsp); int getNewVnode(struct vnode **vpp); diff --git a/sys/cfs/cfs_vnodeops.c b/sys/cfs/cfs_vnodeops.c index c5c8203..f505af5 100644 --- a/sys/cfs/cfs_vnodeops.c +++ b/sys/cfs/cfs_vnodeops.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfs_vnodeops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfs_vnodeops.c,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -48,6 +48,9 @@ /* * HISTORY * $Log: cfs_vnodeops.c,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -73,7 +76,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.6 98/01/23 11:53:47 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.5.2.8 98/01/23 11:21:11 rvb * Sync with 2.2.5 @@ -88,7 +91,7 @@ * Sync with 1.3 * * Revision 1.5.2.4 97/12/10 14:08:31 rvb - * Fix O_ flags; check result in cfscall + * Fix O_ flags; check result in coda_call * * Revision 1.5.2.3 97/12/10 11:40:27 rvb * No more ody @@ -134,7 +137,7 @@ * >64Meg; venus can be killed! * * Revision 1.4 1997/02/20 13:54:50 lily - * check for NULL return from cfsnc_lookup before CTOV + * check for NULL return from coda_nc_lookup before CTOV * * Revision 1.3 1996/12/12 22:11:02 bnoble * Fixed the "downcall invokes venus operation" deadlock in all known cases. @@ -144,7 +147,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:34 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:06 bnoble * Branch for NetBSD port revisions @@ -249,76 +252,76 @@ /* * These flags select various performance enhancements. */ -int cfs_attr_cache = 1; /* Set to cache attributes in the kernel */ -int cfs_symlink_cache = 1; /* Set to cache symbolic link information */ -int cfs_access_cache = 1; /* Set to handle some access checks directly */ +int coda_attr_cache = 1; /* Set to cache attributes in the kernel */ +int coda_symlink_cache = 1; /* Set to cache symbolic link information */ +int coda_access_cache = 1; /* Set to handle some access checks directly */ /* structure to keep track of vfs calls */ -struct cfs_op_stats cfs_vnodeopstats[CFS_VNODEOPS_SIZE]; +struct coda_op_stats coda_vnodeopstats[CODA_VNODEOPS_SIZE]; -#define MARK_ENTRY(op) (cfs_vnodeopstats[op].entries++) -#define MARK_INT_SAT(op) (cfs_vnodeopstats[op].sat_intrn++) -#define MARK_INT_FAIL(op) (cfs_vnodeopstats[op].unsat_intrn++) -#define MARK_INT_GEN(op) (cfs_vnodeopstats[op].gen_intrn++) +#define MARK_ENTRY(op) (coda_vnodeopstats[op].entries++) +#define MARK_INT_SAT(op) (coda_vnodeopstats[op].sat_intrn++) +#define MARK_INT_FAIL(op) (coda_vnodeopstats[op].unsat_intrn++) +#define MARK_INT_GEN(op) (coda_vnodeopstats[op].gen_intrn++) /* What we are delaying for in printf */ -int cfs_printf_delay = 0; /* in microseconds */ -int cfs_vnop_print_entry = 0; -static int cfs_lockdebug = 0; +int coda_printf_delay = 0; /* in microseconds */ +int coda_vnop_print_entry = 0; +static int coda_lockdebug = 0; /* Definition of the vfs operation vector */ /* * Some NetBSD details: * - * cfs_start is called at the end of the mount syscall. - * cfs_init is called at boot time. + * coda_start is called at the end of the mount syscall. + * coda_init is called at boot time. */ -#define ENTRY if(cfs_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) +#define ENTRY if(coda_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) /* Definition of the vnode operation vector */ -struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { - { &vop_default_desc, cfs_vop_error }, - { &vop_lookup_desc, cfs_lookup }, /* lookup */ - { &vop_create_desc, cfs_create }, /* create */ - { &vop_mknod_desc, cfs_vop_error }, /* mknod */ - { &vop_open_desc, cfs_open }, /* open */ - { &vop_close_desc, cfs_close }, /* close */ - { &vop_access_desc, cfs_access }, /* access */ - { &vop_getattr_desc, cfs_getattr }, /* getattr */ - { &vop_setattr_desc, cfs_setattr }, /* setattr */ - { &vop_read_desc, cfs_read }, /* read */ - { &vop_write_desc, cfs_write }, /* write */ - { &vop_ioctl_desc, cfs_ioctl }, /* ioctl */ - { &vop_mmap_desc, cfs_vop_error }, /* mmap */ - { &vop_fsync_desc, cfs_fsync }, /* fsync */ - { &vop_remove_desc, cfs_remove }, /* remove */ - { &vop_link_desc, cfs_link }, /* link */ - { &vop_rename_desc, cfs_rename }, /* rename */ - { &vop_mkdir_desc, cfs_mkdir }, /* mkdir */ - { &vop_rmdir_desc, cfs_rmdir }, /* rmdir */ - { &vop_symlink_desc, cfs_symlink }, /* symlink */ - { &vop_readdir_desc, cfs_readdir }, /* readdir */ - { &vop_readlink_desc, cfs_readlink }, /* readlink */ - { &vop_abortop_desc, cfs_abortop }, /* abortop */ - { &vop_inactive_desc, cfs_inactive }, /* inactive */ - { &vop_reclaim_desc, cfs_reclaim }, /* reclaim */ - { &vop_lock_desc, cfs_lock }, /* lock */ - { &vop_unlock_desc, cfs_unlock }, /* unlock */ - { &vop_bmap_desc, cfs_bmap }, /* bmap */ - { &vop_strategy_desc, cfs_strategy }, /* strategy */ - { &vop_print_desc, cfs_vop_error }, /* print */ - { &vop_islocked_desc, cfs_islocked }, /* islocked */ - { &vop_pathconf_desc, cfs_vop_error }, /* pathconf */ - { &vop_advlock_desc, cfs_vop_nop }, /* advlock */ - { &vop_bwrite_desc, cfs_vop_error }, /* bwrite */ - { &vop_lease_desc, cfs_vop_nop }, /* lease */ +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_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_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_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_readlink_desc, coda_readlink }, /* readlink */ + { &vop_abortop_desc, coda_abortop }, /* abortop */ + { &vop_inactive_desc, coda_inactive }, /* inactive */ + { &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_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_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_getpages_desc, cfs_fbsd_getpages }, /* pager intf.*/ - { &vop_putpages_desc, cfs_fbsd_putpages }, /* pager intf.*/ + { &vop_getpages_desc, coda_fbsd_getpages }, /* pager intf.*/ + { &vop_putpages_desc, coda_fbsd_putpages }, /* pager intf.*/ #if 0 @@ -337,28 +340,28 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } }; -static struct vnodeopv_desc cfs_vnodeop_opv_desc = - { &cfs_vnodeop_p, cfs_vnodeop_entries }; +static struct vnodeopv_desc coda_vnodeop_opv_desc = + { &coda_vnodeop_p, coda_vnodeop_entries }; -VNODEOP_SET(cfs_vnodeop_opv_desc); +VNODEOP_SET(coda_vnodeop_opv_desc); /* A generic panic: we were called with something we didn't define yet */ int -cfs_vop_error(void *anon) { +coda_vop_error(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; myprintf(("Vnode operation %s called, but not defined\n", (*desc)->vdesc_name)); - panic("cfs_vop_error"); + panic("coda_vop_error"); return 0; } /* A generic do-nothing. For lease_check, advlock */ int -cfs_vop_nop(void *anon) { +coda_vop_nop(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; - if (cfsdebug) { + if (codadebug) { myprintf(("Vnode operation %s called, but unsupported\n", (*desc)->vdesc_name)); } @@ -366,27 +369,27 @@ cfs_vop_nop(void *anon) { } int -cfs_vnodeopstats_init(void) +coda_vnodeopstats_init(void) { register int i; - for(i=0;i pair for the cache file into an inode pointer. */ - error = cfs_grab_vnode(dev, inode, &vp); + error = coda_grab_vnode(dev, inode, &vp); if (error) return (error); @@ -445,7 +448,7 @@ cfs_open(v) cp->c_ovp = vp; } else { if (cp->c_ovp != vp) - panic("cfs_open: cp->c_ovp != ITOV(ip)"); + panic("coda_open: cp->c_ovp != ITOV(ip)"); } cp->c_ocount++; @@ -463,13 +466,13 @@ cfs_open(v) /* Open the cache file. */ error = VOP_OPEN(vp, flag, cred, p); if (error) { - printf("cfs_open: VOP_OPEN on container failed %d\n", error); + printf("coda_open: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_open: vfs_object_create() returns %d\n", error); + printf("coda_open: vfs_object_create() returns %d\n", error); vput(vp); } } @@ -480,7 +483,7 @@ cfs_open(v) * Close the cache file used for I/O and notify Venus. */ int -cfs_close(v) +coda_close(v) void *v; { /* true args */ @@ -493,21 +496,21 @@ cfs_close(v) /* locals */ int error; - MARK_ENTRY(CFS_CLOSE_STATS); + MARK_ENTRY(CODA_CLOSE_STATS); /* Check for close of control file. */ if (IS_CTL_VP(vp)) { - MARK_INT_SAT(CFS_CLOSE_STATS); + MARK_INT_SAT(CODA_CLOSE_STATS); return(0); } if (IS_UNMOUNTING(cp)) { if (cp->c_ovp) { - printf("cfs_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); vgone(cp->c_ovp); } else { - printf("cfs_close: NO container vp %p/cp %p\n", vp, cp); + printf("coda_close: NO container vp %p/cp %p\n", vp, cp); } return ENODEV; } else { @@ -524,34 +527,34 @@ cfs_close(v) error = venus_close(vtomi(vp), &cp->c_fid, flag, cred, p); vrele(CTOV(cp)); - CFSDEBUG(CFS_CLOSE, myprintf(("close: result %d\n",error)); ) + CODADEBUG(CODA_CLOSE, myprintf(("close: result %d\n",error)); ) return(error); } int -cfs_read(v) +coda_read(v) void *v; { struct vop_read_args *ap = v; ENTRY; - return(cfs_rdwr(ap->a_vp, ap->a_uio, UIO_READ, + return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_READ, ap->a_ioflag, ap->a_cred, ap->a_uio->uio_procp)); } int -cfs_write(v) +coda_write(v) void *v; { struct vop_write_args *ap = v; ENTRY; - return(cfs_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE, + return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE, ap->a_ioflag, ap->a_cred, ap->a_uio->uio_procp)); } int -cfs_rdwr(vp, uiop, rw, ioflag, cred, p) +coda_rdwr(vp, uiop, rw, ioflag, cred, p) struct vnode *vp; struct uio *uiop; enum uio_rw rw; @@ -568,15 +571,15 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) int opened_internally = 0; int error = 0; - MARK_ENTRY(CFS_RDWR_STATS); + MARK_ENTRY(CODA_RDWR_STATS); - CFSDEBUG(CFS_RDWR, myprintf(("cfs_rdwr(%d, %p, %d, %qd, %d)\n", rw, + CODADEBUG(CODA_RDWR, myprintf(("coda_rdwr(%d, %p, %d, %qd, %d)\n", rw, uiop->uio_iov->iov_base, uiop->uio_resid, uiop->uio_offset, uiop->uio_segflg)); ) /* Check for rdwr of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); return(EINVAL); } @@ -595,9 +598,9 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) */ if (cp->c_inode != 0 && !(p && (p->p_acflag & ACORE))) { igot_internally = 1; - error = cfs_grab_vnode(cp->c_device, cp->c_inode, &cfvp); + error = coda_grab_vnode(cp->c_device, cp->c_inode, &cfvp); if (error) { - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); return(error); } /* @@ -608,23 +611,23 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) } else { opened_internally = 1; - MARK_INT_GEN(CFS_OPEN_STATS); + MARK_INT_GEN(CODA_OPEN_STATS); error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p); -printf("cfs_rdwr: Internally Opening %p\n", vp); +printf("coda_rdwr: Internally Opening %p\n", vp); if (error) { - printf("cfs_rdwr: VOP_OPEN on container failed %d\n", error); + printf("coda_rdwr: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_rdwr: vfs_object_create() returns %d\n", error); + printf("coda_rdwr: vfs_object_create() returns %d\n", error); vput(vp); } } if (error) { - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); return(error); } cfvp = cp->c_ovp; @@ -632,7 +635,7 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); } /* Have UFS handle the call. */ - CFSDEBUG(CFS_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n", + CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, CTOV(cp)->v_usecount)); ) @@ -650,13 +653,13 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); } if (error) - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); else - MARK_INT_SAT(CFS_RDWR_STATS); + MARK_INT_SAT(CODA_RDWR_STATS); /* Do an internal close if necessary. */ if (opened_internally) { - MARK_INT_GEN(CFS_CLOSE_STATS); + MARK_INT_GEN(CODA_CLOSE_STATS); (void)VOP_CLOSE(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p); } @@ -667,7 +670,7 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); } int -cfs_ioctl(v) +coda_ioctl(v) void *v; { /* true args */ @@ -684,17 +687,17 @@ cfs_ioctl(v) struct nameidata ndp; struct PioctlData *iap = (struct PioctlData *)data; - MARK_ENTRY(CFS_IOCTL_STATS); + MARK_ENTRY(CODA_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, myprintf(("in cfs_ioctl on %s\n", iap->path));) + CODADEBUG(CODA_IOCTL, myprintf(("in coda_ioctl on %s\n", iap->path));) /* Don't check for operation on a dying object, for ctlvp it shouldn't matter */ /* Must be control object to succeed. */ if (!IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, myprintf(("cfs_ioctl error: vp != ctlvp"));) + MARK_INT_FAIL(CODA_IOCTL_STATS); + CODADEBUG(CODA_IOCTL, myprintf(("coda_ioctl error: vp != ctlvp"));) return (EOPNOTSUPP); } /* Look up the pathname. */ @@ -707,8 +710,8 @@ cfs_ioctl(v) tvp = ndp.ni_vp; if (error) { - MARK_INT_FAIL(CFS_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, myprintf(("cfs_ioctl error: lookup returns %d\n", + MARK_INT_FAIL(CODA_IOCTL_STATS); + CODADEBUG(CODA_IOCTL, myprintf(("coda_ioctl error: lookup returns %d\n", error));) return(error); } @@ -718,11 +721,11 @@ cfs_ioctl(v) * different vfsp */ /* XXX: this totally violates the comment about vtagtype in vnode.h */ - if (tvp->v_tag != VT_CFS) { + if (tvp->v_tag != VT_CODA) { vrele(tvp); - MARK_INT_FAIL(CFS_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, - myprintf(("cfs_ioctl error: %s not a coda object\n", + MARK_INT_FAIL(CODA_IOCTL_STATS); + CODADEBUG(CODA_IOCTL, + myprintf(("coda_ioctl error: %s not a coda object\n", iap->path));) return(EINVAL); } @@ -734,9 +737,9 @@ cfs_ioctl(v) error = venus_ioctl(vtomi(tvp), &((VTOC(tvp))->c_fid), com, flag, data, cred, p); if (error) - MARK_INT_FAIL(CFS_IOCTL_STATS); + MARK_INT_FAIL(CODA_IOCTL_STATS); else - CFSDEBUG(CFS_IOCTL, myprintf(("Ioctl returns %d \n", error)); ) + CODADEBUG(CODA_IOCTL, myprintf(("Ioctl returns %d \n", error)); ) vrele(tvp); return(error); @@ -752,7 +755,7 @@ cfs_ioctl(v) * opened the file, and therefore should already have access. */ int -cfs_getattr(v) +coda_getattr(v) void *v; { /* true args */ @@ -765,41 +768,41 @@ cfs_getattr(v) /* locals */ int error; - MARK_ENTRY(CFS_GETATTR_STATS); + MARK_ENTRY(CODA_GETATTR_STATS); if (IS_UNMOUNTING(cp)) return ENODEV; /* Check for getattr of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_GETATTR_STATS); + MARK_INT_FAIL(CODA_GETATTR_STATS); return(ENOENT); } /* Check to see if the attributes have already been cached */ if (VALID_VATTR(cp)) { - CFSDEBUG(CFS_GETATTR, { myprintf(("attr cache hit: (%lx.%lx.%lx)\n", + CODADEBUG(CODA_GETATTR, { myprintf(("attr cache hit: (%lx.%lx.%lx)\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));}); - CFSDEBUG(CFS_GETATTR, if (!(cfsdebug & ~CFS_GETATTR)) + CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR)) print_vattr(&cp->c_vattr); ); *vap = cp->c_vattr; - MARK_INT_SAT(CFS_GETATTR_STATS); + MARK_INT_SAT(CODA_GETATTR_STATS); return(0); } error = venus_getattr(vtomi(vp), &cp->c_fid, cred, p, vap); if (!error) { - CFSDEBUG(CFS_GETATTR, myprintf(("getattr miss (%lx.%lx.%lx): result %d\n", + CODADEBUG(CODA_GETATTR, myprintf(("getattr miss (%lx.%lx.%lx): result %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, error)); ) - CFSDEBUG(CFS_GETATTR, if (!(cfsdebug & ~CFS_GETATTR)) + CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR)) print_vattr(vap); ); { int size = vap->va_size; @@ -809,7 +812,7 @@ cfs_getattr(v) } } /* If not open for write, store attributes in cnode */ - if ((cp->c_owrite == 0) && (cfs_attr_cache)) { + if ((cp->c_owrite == 0) && (coda_attr_cache)) { cp->c_vattr = *vap; cp->c_flags |= C_VATTR; } @@ -819,7 +822,7 @@ cfs_getattr(v) } int -cfs_setattr(v) +coda_setattr(v) void *v; { /* true args */ @@ -832,15 +835,15 @@ cfs_setattr(v) /* locals */ int error; - MARK_ENTRY(CFS_SETATTR_STATS); + MARK_ENTRY(CODA_SETATTR_STATS); /* Check for setattr of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_SETATTR_STATS); + MARK_INT_FAIL(CODA_SETATTR_STATS); return(ENOENT); } - if (cfsdebug & CFSDBGMSK(CFS_SETATTR)) { + if (codadebug & CODADBGMSK(CODA_SETATTR)) { print_vattr(vap); } error = venus_setattr(vtomi(vp), &cp->c_fid, vap, cred, p); @@ -854,12 +857,12 @@ cfs_setattr(v) vnode_pager_setsize(convp, size); } } - CFSDEBUG(CFS_SETATTR, myprintf(("setattr %d\n", error)); ) + CODADEBUG(CODA_SETATTR, myprintf(("setattr %d\n", error)); ) return(error); } int -cfs_access(v) +coda_access(v) void *v; { /* true args */ @@ -872,13 +875,13 @@ cfs_access(v) /* locals */ int error; - MARK_ENTRY(CFS_ACCESS_STATS); + MARK_ENTRY(CODA_ACCESS_STATS); /* Check for access of control object. Only read access is allowed on it. */ if (IS_CTL_VP(vp)) { /* bogus hack - all will be marked as successes */ - MARK_INT_SAT(CFS_ACCESS_STATS); + MARK_INT_SAT(CODA_ACCESS_STATS); return(((mode & VREAD) && !(mode & (VWRITE | VEXEC))) ? 0 : EACCES); } @@ -888,10 +891,10 @@ cfs_access(v) * access, and the file is in the namecache, then the user must have * lookup access to it. */ - if (cfs_access_cache) { + if (coda_access_cache) { if ((vp->v_type == VDIR) && (mode & VEXEC)) { - if (cfsnc_lookup(cp, ".", 1, cred)) { - MARK_INT_SAT(CFS_ACCESS_STATS); + if (coda_nc_lookup(cp, ".", 1, cred)) { + MARK_INT_SAT(CODA_ACCESS_STATS); return(0); /* it was in the cache */ } } @@ -903,13 +906,13 @@ cfs_access(v) } /* - * CFS abort op, called after namei() when a CREATE/DELETE isn't actually - * done. If a buffer has been saved in anticipation of a cfs_create or - * a cfs_remove, delete it. + * CODA abort op, called after namei() when a CREATE/DELETE isn't actually + * done. If a buffer has been saved in anticipation of a coda_create or + * a coda_remove, delete it. */ /* ARGSUSED */ int -cfs_abortop(v) +coda_abortop(v) void *v; { /* true args */ @@ -926,7 +929,7 @@ cfs_abortop(v) } int -cfs_readlink(v) +coda_readlink(v) void *v; { /* true args */ @@ -941,21 +944,21 @@ cfs_readlink(v) char *str; int len; - MARK_ENTRY(CFS_READLINK_STATS); + MARK_ENTRY(CODA_READLINK_STATS); /* Check for readlink of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_READLINK_STATS); + MARK_INT_FAIL(CODA_READLINK_STATS); return(ENOENT); } - if ((cfs_symlink_cache) && (VALID_SYMLINK(cp))) { /* symlink was cached */ + if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) { /* symlink was cached */ uiop->uio_rw = UIO_READ; error = uiomove(cp->c_symlink, (int)cp->c_symlen, uiop); if (error) - MARK_INT_FAIL(CFS_READLINK_STATS); + MARK_INT_FAIL(CODA_READLINK_STATS); else - MARK_INT_SAT(CFS_READLINK_STATS); + MARK_INT_SAT(CODA_READLINK_STATS); return(error); } @@ -965,20 +968,20 @@ cfs_readlink(v) uiop->uio_rw = UIO_READ; error = uiomove(str, len, uiop); - if (cfs_symlink_cache) { + if (coda_symlink_cache) { cp->c_symlink = str; cp->c_symlen = len; cp->c_flags |= C_SYMLINK; } else - CFS_FREE(str, len); + CODA_FREE(str, len); } - CFSDEBUG(CFS_READLINK, myprintf(("in readlink result %d\n",error));) + CODADEBUG(CODA_READLINK, myprintf(("in readlink result %d\n",error));) return(error); } int -cfs_fsync(v) +coda_fsync(v) void *v; { /* true args */ @@ -991,7 +994,7 @@ cfs_fsync(v) struct vnode *convp = cp->c_ovp; int error; - MARK_ENTRY(CFS_FSYNC_STATS); + MARK_ENTRY(CODA_FSYNC_STATS); /* Check for fsync on an unmounting object */ /* The NetBSD kernel, in it's infinite wisdom, can try to fsync @@ -1004,7 +1007,7 @@ cfs_fsync(v) /* Check for fsync of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_SAT(CFS_FSYNC_STATS); + MARK_INT_SAT(CODA_FSYNC_STATS); return(0); } @@ -1017,7 +1020,7 @@ cfs_fsync(v) */ /* if (!vp->v_usecount) { - printf("cfs_fsync on vnode %p with %d usecount. c_flags = %x (%x)\n", + printf("coda_fsync on vnode %p with %d usecount. c_flags = %x (%x)\n", vp, vp->v_usecount, cp->c_flags, cp->c_flags&C_PURGING); } */ @@ -1037,12 +1040,12 @@ cfs_fsync(v) return 0; error = venus_fsync(vtomi(vp), &cp->c_fid, cred, p); - CFSDEBUG(CFS_FSYNC, myprintf(("in fsync result %d\n",error)); ); + CODADEBUG(CODA_FSYNC, myprintf(("in fsync result %d\n",error)); ); return(error); } int -cfs_inactive(v) +coda_inactive(v) void *v; { /* XXX - at the moment, inactive doesn't look at cred, and doesn't @@ -1057,56 +1060,56 @@ cfs_inactive(v) /* locals */ /* We don't need to send inactive to venus - DCS */ - MARK_ENTRY(CFS_INACTIVE_STATS); + MARK_ENTRY(CODA_INACTIVE_STATS); if (IS_CTL_VP(vp)) { - MARK_INT_SAT(CFS_INACTIVE_STATS); + MARK_INT_SAT(CODA_INACTIVE_STATS); return 0; } - CFSDEBUG(CFS_INACTIVE, myprintf(("in inactive, %lx.%lx.%lx. vfsp %p\n", + CODADEBUG(CODA_INACTIVE, myprintf(("in inactive, %lx.%lx.%lx. vfsp %p\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_mount));) /* If an array has been allocated to hold the symlink, deallocate it */ - if ((cfs_symlink_cache) && (VALID_SYMLINK(cp))) { + if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) { if (cp->c_symlink == NULL) - panic("cfs_inactive: null symlink pointer in cnode"); + panic("coda_inactive: null symlink pointer in cnode"); - CFS_FREE(cp->c_symlink, cp->c_symlen); + CODA_FREE(cp->c_symlink, cp->c_symlen); cp->c_flags &= ~C_SYMLINK; cp->c_symlen = 0; } /* Remove it from the table so it can't be found. */ - cfs_unsave(cp); - if ((struct cfs_mntinfo *)(vp->v_mount->mnt_data) == NULL) { + coda_unsave(cp); + if ((struct coda_mntinfo *)(vp->v_mount->mnt_data) == NULL) { myprintf(("Help! vfsp->vfs_data was NULL, but vnode %p wasn't dying\n", vp)); - panic("badness in cfs_inactive\n"); + panic("badness in coda_inactive\n"); } if (IS_UNMOUNTING(cp)) { #ifdef DEBUG - printf("cfs_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); + printf("coda_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); if (cp->c_ovp != NULL) - printf("cfs_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", + printf("coda_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); #endif lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); } else { #ifdef DIAGNOSTIC if (CTOV(cp)->v_usecount) { - panic("cfs_inactive: nonzero reference count"); + panic("coda_inactive: nonzero reference count"); } if (cp->c_ovp != NULL) { - panic("cfs_inactive: cp->ovp != NULL"); + panic("coda_inactive: cp->ovp != NULL"); } #endif VOP_UNLOCK(vp, 0, p); vgone(vp); } - MARK_INT_SAT(CFS_INACTIVE_STATS); + MARK_INT_SAT(CODA_INACTIVE_STATS); return(0); } @@ -1118,7 +1121,7 @@ cfs_inactive(v) * It appears that in NetBSD, lookup is supposed to return the vnode locked */ int -cfs_lookup(v) +coda_lookup(v) void *v; { /* true args */ @@ -1143,23 +1146,23 @@ cfs_lookup(v) int vtype; int error = 0; - MARK_ENTRY(CFS_LOOKUP_STATS); + MARK_ENTRY(CODA_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, myprintf(("lookup: %s in %lx.%lx.%lx\n", + CODADEBUG(CODA_LOOKUP, myprintf(("lookup: %s in %lx.%lx.%lx\n", nm, dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique));); /* Check for lookup of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { - *vpp = cfs_ctlvp; + *vpp = coda_ctlvp; vref(*vpp); - MARK_INT_SAT(CFS_LOOKUP_STATS); + MARK_INT_SAT(CODA_LOOKUP_STATS); goto exit; } - if (len+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, myprintf(("name too long: lookup, %lx.%lx.%lx(%s)\n", + if (len+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_LOOKUP_STATS); + CODADEBUG(CODA_LOOKUP, myprintf(("name too long: lookup, %lx.%lx.%lx(%s)\n", dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique, nm));); *vpp = (struct vnode *)0; @@ -1168,11 +1171,11 @@ cfs_lookup(v) } /* First try to look the file up in the cfs name cache */ /* lock the parent vnode? */ - cp = cfsnc_lookup(dcp, nm, len, cred); + cp = coda_nc_lookup(dcp, nm, len, cred); if (cp) { *vpp = CTOV(cp); vref(*vpp); - CFSDEBUG(CFS_LOOKUP, + CODADEBUG(CODA_LOOKUP, myprintf(("lookup result %d vpp %p\n",error,*vpp));) } else { @@ -1180,24 +1183,24 @@ cfs_lookup(v) error = venus_lookup(vtomi(dvp), &dcp->c_fid, nm, len, cred, p, &VFid, &vtype); if (error) { - MARK_INT_FAIL(CFS_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, myprintf(("lookup error on %lx.%lx.%lx(%s)%d\n", + MARK_INT_FAIL(CODA_LOOKUP_STATS); + CODADEBUG(CODA_LOOKUP, myprintf(("lookup error on %lx.%lx.%lx(%s)%d\n", dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique, nm, error));) *vpp = (struct vnode *)0; } else { - MARK_INT_SAT(CFS_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, + MARK_INT_SAT(CODA_LOOKUP_STATS); + CODADEBUG(CODA_LOOKUP, myprintf(("lookup: vol %lx vno %lx uni %lx type %o result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, vtype, error)); ) - cp = makecfsnode(&VFid, dvp->v_mount, vtype); + cp = make_coda_node(&VFid, dvp->v_mount, vtype); *vpp = CTOV(cp); /* enter the new vnode in the Name Cache only if the top bit isn't set */ /* And don't enter a new vnode for an invalid one! */ - if (!(vtype & CFS_NOCACHE)) - cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); + if (!(vtype & CODA_NOCACHE)) + coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); } } @@ -1226,8 +1229,8 @@ cfs_lookup(v) * removal will go ahead as planned. Unfortunately, this will * probably also lock the to-be-removed vnode, which may or may * not be a good idea. I'll have to look at the bits of - * cfs_remove to make sure. We'll only save the name if we did in - * fact find the name, otherwise cfs_remove won't have a chance + * coda_remove to make sure. We'll only save the name if we did in + * fact find the name, otherwise coda_remove won't have a chance * to free the pathname. */ if ((cnp->cn_nameiop == DELETE) @@ -1257,7 +1260,7 @@ cfs_lookup(v) */ if (*ap->a_vpp) { if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { - printf("cfs_lookup: "); + printf("coda_lookup: "); panic("unlocked parent but couldn't lock child"); } } @@ -1266,7 +1269,7 @@ cfs_lookup(v) if (*ap->a_vpp && (*ap->a_vpp != dvp)) { /* Different, go ahead and lock it. */ if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { - printf("cfs_lookup: "); + printf("coda_lookup: "); panic("unlocked parent but couldn't lock child"); } } @@ -1281,7 +1284,7 @@ cfs_lookup(v) /*ARGSUSED*/ int -cfs_create(v) +coda_create(v) void *v; { /* true args */ @@ -1303,7 +1306,7 @@ cfs_create(v) ViceFid VFid; struct vattr attr; - MARK_ENTRY(CFS_CREATE_STATS); + MARK_ENTRY(CODA_CREATE_STATS); /* All creates are exclusive XXX */ /* I'm assuming the 'mode' argument is the file mode bits XXX */ @@ -1311,7 +1314,7 @@ cfs_create(v) /* Check for create of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { *vpp = (struct vnode *)0; - MARK_INT_FAIL(CFS_CREATE_STATS); + MARK_INT_FAIL(CODA_CREATE_STATS); return(EACCES); } @@ -1323,17 +1326,17 @@ cfs_create(v) /* Venus should have detected the file and reported EEXIST. */ if ((exclusive == 1) && - (cfs_find(&VFid) != NULL)) + (coda_find(&VFid) != NULL)) panic("cnode existed for newly created file!"); - cp = makecfsnode(&VFid, dvp->v_mount, attr.va_type); + cp = make_coda_node(&VFid, dvp->v_mount, attr.va_type); *vpp = CTOV(cp); /* Update va to reflect the new attributes. */ (*va) = attr; /* Update the attribute cache and mark it as valid */ - if (cfs_attr_cache) { + if (coda_attr_cache) { VTOC(*vpp)->c_vattr = attr; VTOC(*vpp)->c_flags |= C_VATTR; } @@ -1342,26 +1345,26 @@ cfs_create(v) VTOC(dvp)->c_flags &= ~C_VATTR; /* enter the new vnode in the Name Cache */ - cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); + coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); - CFSDEBUG(CFS_CREATE, + CODADEBUG(CODA_CREATE, myprintf(("create: (%lx.%lx.%lx), result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, error)); ) } else { *vpp = (struct vnode *)0; - CFSDEBUG(CFS_CREATE, myprintf(("create error %d\n", error));) + CODADEBUG(CODA_CREATE, myprintf(("create error %d\n", error));) } if (!error) { if (cnp->cn_flags & LOCKLEAF) { if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { - printf("cfs_create: "); + printf("coda_create: "); panic("unlocked parent but couldn't lock child"); } } #ifdef DIAGNOSTIC else { - printf("cfs_create: LOCKLEAF not set!\n"); + printf("coda_create: LOCKLEAF not set!\n"); } #endif /* DIAGNOSTIC */ } @@ -1377,7 +1380,7 @@ cfs_create(v) } int -cfs_remove(v) +coda_remove(v) void *v; { /* true args */ @@ -1393,13 +1396,13 @@ cfs_remove(v) int len = cnp->cn_namelen; struct cnode *tp; - MARK_ENTRY(CFS_REMOVE_STATS); + MARK_ENTRY(CODA_REMOVE_STATS); - CFSDEBUG(CFS_REMOVE, myprintf(("remove: %s in %lx.%lx.%lx\n", + CODADEBUG(CODA_REMOVE, myprintf(("remove: %s in %lx.%lx.%lx\n", nm, cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));); - /* Remove the file's entry from the CFS Name Cache */ + /* Remove the file's entry from the CODA Name Cache */ /* We're being conservative here, it might be that this person * doesn't really have sufficient access to delete the file * but we feel zapping the entry won't really hurt anyone -- dcs @@ -1409,7 +1412,7 @@ cfs_remove(v) * off by 1. We could either invalidate the attrs if cached, or * fix them. I'll try to fix them. DCS 11/8/94 */ - tp = cfsnc_lookup(VTOC(dvp), nm, len, cred); + tp = coda_nc_lookup(VTOC(dvp), nm, len, cred); if (tp) { if (VALID_VATTR(tp)) { /* If attrs are cached */ if (tp->c_vattr.va_nlink > 1) { /* If it's a hard link */ @@ -1417,7 +1420,7 @@ cfs_remove(v) } } - cfsnc_zapfile(VTOC(dvp), nm, len); + coda_nc_zapfile(VTOC(dvp), nm, len); /* No need to flush it if it doesn't exist! */ } /* Invalidate the parent's attr cache, the modification time has changed */ @@ -1425,13 +1428,13 @@ cfs_remove(v) /* Check for remove of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { - MARK_INT_FAIL(CFS_REMOVE_STATS); + MARK_INT_FAIL(CODA_REMOVE_STATS); return(ENOENT); } error = venus_remove(vtomi(dvp), &cp->c_fid, nm, len, cred, p); - CFSDEBUG(CFS_REMOVE, myprintf(("in remove result %d\n",error)); ) + CODADEBUG(CODA_REMOVE, myprintf(("in remove result %d\n",error)); ) if ((cnp->cn_flags & SAVESTART) == 0) { zfree(namei_zone, cnp->cn_pnbuf); @@ -1440,7 +1443,7 @@ cfs_remove(v) } int -cfs_link(v) +coda_link(v) void *v; { /* true args */ @@ -1457,9 +1460,9 @@ cfs_link(v) const char *nm = cnp->cn_nameptr; int len = cnp->cn_namelen; - MARK_ENTRY(CFS_LINK_STATS); + MARK_ENTRY(CODA_LINK_STATS); - if (cfsdebug & CFSDBGMSK(CFS_LINK)) { + if (codadebug & CODADBGMSK(CODA_LINK)) { myprintf(("nb_link: vp fid: (%lx.%lx.%lx)\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); @@ -1467,7 +1470,7 @@ cfs_link(v) tdcp->c_fid.Volume, tdcp->c_fid.Vnode, tdcp->c_fid.Unique)); } - if (cfsdebug & CFSDBGMSK(CFS_LINK)) { + if (codadebug & CODADBGMSK(CODA_LINK)) { myprintf(("link: vp fid: (%lx.%lx.%lx)\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); myprintf(("link: tdvp fid: (%lx.%lx.%lx)\n", @@ -1477,7 +1480,7 @@ cfs_link(v) /* Check for link to/from control object. */ if (IS_CTL_NAME(tdvp, nm, len) || IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_LINK_STATS); + MARK_INT_FAIL(CODA_LINK_STATS); return(EACCES); } @@ -1487,7 +1490,7 @@ cfs_link(v) VTOC(tdvp)->c_flags &= ~C_VATTR; VTOC(vp)->c_flags &= ~C_VATTR; - CFSDEBUG(CFS_LINK, myprintf(("in link result %d\n",error)); ) + CODADEBUG(CODA_LINK, myprintf(("in link result %d\n",error)); ) exit: @@ -1499,7 +1502,7 @@ exit: } int -cfs_rename(v) +coda_rename(v) void *v; { /* true args */ @@ -1519,7 +1522,7 @@ cfs_rename(v) const char *tnm = tcnp->cn_nameptr; int tlen = tcnp->cn_namelen; - MARK_ENTRY(CFS_RENAME_STATS); + MARK_ENTRY(CODA_RENAME_STATS); /* Hmmm. The vnodes are already looked up. Perhaps they are locked? This could be Bad. XXX */ @@ -1527,43 +1530,43 @@ cfs_rename(v) if ((fcnp->cn_cred != tcnp->cn_cred) || (fcnp->cn_proc != tcnp->cn_proc)) { - panic("cfs_rename: component names don't agree"); + panic("coda_rename: component names don't agree"); } #endif DIAGNOSTIC /* Check for rename involving control object. */ if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) { - MARK_INT_FAIL(CFS_RENAME_STATS); + MARK_INT_FAIL(CODA_RENAME_STATS); return(EACCES); } /* Problem with moving directories -- need to flush entry for .. */ if (odvp != ndvp) { - struct cnode *ovcp = cfsnc_lookup(VTOC(odvp), fnm, flen, cred); + struct cnode *ovcp = coda_nc_lookup(VTOC(odvp), fnm, flen, cred); if (ovcp) { struct vnode *ovp = CTOV(ovcp); if ((ovp) && (ovp->v_type == VDIR)) /* If it's a directory */ - cfsnc_zapfile(VTOC(ovp),"..", 2); + coda_nc_zapfile(VTOC(ovp),"..", 2); } } /* Remove the entries for both source and target files */ - cfsnc_zapfile(VTOC(odvp), fnm, flen); - cfsnc_zapfile(VTOC(ndvp), tnm, tlen); + coda_nc_zapfile(VTOC(odvp), fnm, flen); + coda_nc_zapfile(VTOC(ndvp), tnm, tlen); /* Invalidate the parent's attr cache, the modification time has changed */ VTOC(odvp)->c_flags &= ~C_VATTR; VTOC(ndvp)->c_flags &= ~C_VATTR; - if (flen+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_RENAME_STATS); + if (flen+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_RENAME_STATS); error = EINVAL; goto exit; } - if (tlen+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_RENAME_STATS); + if (tlen+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_RENAME_STATS); error = EINVAL; goto exit; } @@ -1571,7 +1574,7 @@ cfs_rename(v) error = venus_rename(vtomi(odvp), &odcp->c_fid, &ndcp->c_fid, fnm, flen, tnm, tlen, cred, p); exit: - CFSDEBUG(CFS_RENAME, myprintf(("in rename result %d\n",error));) + CODADEBUG(CODA_RENAME, myprintf(("in rename result %d\n",error));) /* XXX - do we need to call cache pureg on the moved vnode? */ cache_purge(ap->a_fvp); @@ -1594,7 +1597,7 @@ cfs_rename(v) } int -cfs_mkdir(v) +coda_mkdir(v) void *v; { /* true args */ @@ -1614,39 +1617,39 @@ cfs_mkdir(v) ViceFid VFid; struct vattr ova; - MARK_ENTRY(CFS_MKDIR_STATS); + MARK_ENTRY(CODA_MKDIR_STATS); /* Check for mkdir of target object. */ if (IS_CTL_NAME(dvp, nm, len)) { *vpp = (struct vnode *)0; - MARK_INT_FAIL(CFS_MKDIR_STATS); + MARK_INT_FAIL(CODA_MKDIR_STATS); return(EACCES); } - if (len+1 > CFS_MAXNAMLEN) { + if (len+1 > CODA_MAXNAMLEN) { *vpp = (struct vnode *)0; - MARK_INT_FAIL(CFS_MKDIR_STATS); + MARK_INT_FAIL(CODA_MKDIR_STATS); return(EACCES); } error = venus_mkdir(vtomi(dvp), &dcp->c_fid, nm, len, va, cred, p, &VFid, &ova); if (!error) { - if (cfs_find(&VFid) != NULL) + if (coda_find(&VFid) != NULL) panic("cnode existed for newly created directory!"); - cp = makecfsnode(&VFid, dvp->v_mount, va->va_type); + cp = make_coda_node(&VFid, dvp->v_mount, va->va_type); *vpp = CTOV(cp); /* enter the new vnode in the Name Cache */ - cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); + coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); /* as a side effect, enter "." and ".." for the directory */ - cfsnc_enter(VTOC(*vpp), ".", 1, cred, VTOC(*vpp)); - cfsnc_enter(VTOC(*vpp), "..", 2, cred, VTOC(dvp)); + coda_nc_enter(VTOC(*vpp), ".", 1, cred, VTOC(*vpp)); + coda_nc_enter(VTOC(*vpp), "..", 2, cred, VTOC(dvp)); - if (cfs_attr_cache) { + if (coda_attr_cache) { VTOC(*vpp)->c_vattr = ova; /* update the attr cache */ VTOC(*vpp)->c_flags |= C_VATTR; /* Valid attributes in cnode */ } @@ -1654,11 +1657,11 @@ cfs_mkdir(v) /* Invalidate the parent's attr cache, the modification time has changed */ VTOC(dvp)->c_flags &= ~C_VATTR; - CFSDEBUG( CFS_MKDIR, myprintf(("mkdir: (%lx.%lx.%lx) result %d\n", + CODADEBUG( CODA_MKDIR, myprintf(("mkdir: (%lx.%lx.%lx) result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, error)); ) } else { *vpp = (struct vnode *)0; - CFSDEBUG(CFS_MKDIR, myprintf(("mkdir error %d\n",error));) + CODADEBUG(CODA_MKDIR, myprintf(("mkdir error %d\n",error));) } /* Have to free the previously saved name */ @@ -1673,7 +1676,7 @@ cfs_mkdir(v) } int -cfs_rmdir(v) +coda_rmdir(v) void *v; { /* true args */ @@ -1689,11 +1692,11 @@ cfs_rmdir(v) int len = cnp->cn_namelen; struct cnode *cp; - MARK_ENTRY(CFS_RMDIR_STATS); + MARK_ENTRY(CODA_RMDIR_STATS); /* Check for rmdir of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { - MARK_INT_FAIL(CFS_RMDIR_STATS); + MARK_INT_FAIL(CODA_RMDIR_STATS); return(ENOENT); } @@ -1705,18 +1708,18 @@ cfs_rmdir(v) * As a side effect of the rmdir, remove any entries for children of * the directory, especially "." and "..". */ - cp = cfsnc_lookup(dcp, nm, len, cred); - if (cp) cfsnc_zapParentfid(&(cp->c_fid), NOT_DOWNCALL); + cp = coda_nc_lookup(dcp, nm, len, cred); + if (cp) coda_nc_zapParentfid(&(cp->c_fid), NOT_DOWNCALL); - /* Remove the file's entry from the CFS Name Cache */ - cfsnc_zapfile(dcp, nm, len); + /* Remove the file's entry from the CODA Name Cache */ + coda_nc_zapfile(dcp, nm, len); /* Invalidate the parent's attr cache, the modification time has changed */ dcp->c_flags &= ~C_VATTR; error = venus_rmdir(vtomi(dvp), &dcp->c_fid, nm, len, cred, p); - CFSDEBUG(CFS_RMDIR, myprintf(("in rmdir result %d\n", error)); ) + CODADEBUG(CODA_RMDIR, myprintf(("in rmdir result %d\n", error)); ) if ((cnp->cn_flags & SAVESTART) == 0) { zfree(namei_zone, cnp->cn_pnbuf); @@ -1725,7 +1728,7 @@ cfs_rmdir(v) } int -cfs_symlink(v) +coda_symlink(v) void *v; { /* true args */ @@ -1740,7 +1743,7 @@ cfs_symlink(v) /* locals */ int error; /* - * XXX I'm assuming the following things about cfs_symlink's + * XXX I'm assuming the following things about coda_symlink's * arguments: * t(foo) is the new name/parent/etc being created. * lname is the contents of the new symlink. @@ -1760,21 +1763,21 @@ cfs_symlink(v) * returns the resultant vnode in a vpp argument. */ - MARK_ENTRY(CFS_SYMLINK_STATS); + MARK_ENTRY(CODA_SYMLINK_STATS); /* Check for symlink of control object. */ if (IS_CTL_NAME(tdvp, nm, len)) { - MARK_INT_FAIL(CFS_SYMLINK_STATS); + MARK_INT_FAIL(CODA_SYMLINK_STATS); return(EACCES); } - if (plen+1 > CFS_MAXPATHLEN) { - MARK_INT_FAIL(CFS_SYMLINK_STATS); + if (plen+1 > CODA_MAXPATHLEN) { + MARK_INT_FAIL(CODA_SYMLINK_STATS); return(EINVAL); } - if (len+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_SYMLINK_STATS); + if (len+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_SYMLINK_STATS); error = EINVAL; goto exit; } @@ -1792,7 +1795,7 @@ cfs_symlink(v) } exit: - CFSDEBUG(CFS_SYMLINK, myprintf(("in symlink result %d\n",error)); ) + CODADEBUG(CODA_SYMLINK, myprintf(("in symlink result %d\n",error)); ) return(error); } @@ -1800,7 +1803,7 @@ cfs_symlink(v) * Read directory entries. */ int -cfs_readdir(v) +coda_readdir(v) void *v; { /* true args */ @@ -1817,13 +1820,13 @@ cfs_readdir(v) /* locals */ int error = 0; - MARK_ENTRY(CFS_READDIR_STATS); + MARK_ENTRY(CODA_READDIR_STATS); - CFSDEBUG(CFS_READDIR, myprintf(("cfs_readdir(%p, %d, %qd, %d)\n", uiop->uio_iov->iov_base, uiop->uio_resid, uiop->uio_offset, uiop->uio_segflg)); ) + CODADEBUG(CODA_READDIR, myprintf(("coda_readdir(%p, %d, %qd, %d)\n", uiop->uio_iov->iov_base, uiop->uio_resid, uiop->uio_offset, uiop->uio_segflg)); ) /* Check for readdir of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_READDIR_STATS); + MARK_INT_FAIL(CODA_READDIR_STATS); return(ENOENT); } @@ -1832,17 +1835,17 @@ cfs_readdir(v) int opened_internally = 0; if (cp->c_ovp == NULL) { opened_internally = 1; - MARK_INT_GEN(CFS_OPEN_STATS); + MARK_INT_GEN(CODA_OPEN_STATS); error = VOP_OPEN(vp, FREAD, cred, p); -printf("cfs_readdir: Internally Opening %p\n", vp); +printf("coda_readdir: Internally Opening %p\n", vp); if (error) { - printf("cfs_readdir: VOP_OPEN on container failed %d\n", error); + printf("coda_readdir: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_readdir: vfs_object_create() returns %d\n", error); + printf("coda_readdir: vfs_object_create() returns %d\n", error); vput(vp); } } @@ -1850,18 +1853,18 @@ printf("cfs_readdir: Internally Opening %p\n", vp); } /* Have UFS handle the call. */ - CFSDEBUG(CFS_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) + CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies, cookies); if (error) - MARK_INT_FAIL(CFS_READDIR_STATS); + MARK_INT_FAIL(CODA_READDIR_STATS); else - MARK_INT_SAT(CFS_READDIR_STATS); + MARK_INT_SAT(CODA_READDIR_STATS); /* Do an "internal close" if necessary. */ if (opened_internally) { - MARK_INT_GEN(CFS_CLOSE_STATS); + MARK_INT_GEN(CODA_CLOSE_STATS); (void)VOP_CLOSE(vp, FREAD, cred, p); } } @@ -1873,7 +1876,7 @@ printf("cfs_readdir: Internally Opening %p\n", vp); * Convert from file system blocks to device blocks */ int -cfs_bmap(v) +coda_bmap(v) void *v; { /* XXX on the global proc */ @@ -1892,13 +1895,13 @@ cfs_bmap(v) cp = VTOC(vp); if (cp->c_ovp) { - printf("cfs_bmap: container .. "); + printf("coda_bmap: container .. "); ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb); 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); return ret; } else { - printf("cfs_bmap: no container\n"); + printf("coda_bmap: no container\n"); return(EOPNOTSUPP); } } @@ -1911,7 +1914,7 @@ cfs_bmap(v) * int async_daemon_count; */ int -cfs_strategy(v) +coda_strategy(v) void *v; { /* true args */ @@ -1921,12 +1924,12 @@ cfs_strategy(v) /* upcall decl */ /* locals */ - printf("cfs_strategy: called ???\n"); + printf("coda_strategy: called ???\n"); return(EOPNOTSUPP); } int -cfs_reclaim(v) +coda_reclaim(v) void *v; { /* true args */ @@ -1945,26 +1948,26 @@ cfs_reclaim(v) #ifdef DEBUG if (VTOC(vp)->c_ovp) { if (IS_UNMOUNTING(cp)) - printf("cfs_reclaim: c_ovp not void: vp %p, cp %p\n", vp, cp); + printf("coda_reclaim: c_ovp not void: vp %p, cp %p\n", vp, cp); } #endif } else { #ifdef DIAGNOSTIC if (vp->v_usecount != 0) - vprint("cfs_reclaim: pushing active", vp); + vprint("coda_reclaim: pushing active", vp); if (VTOC(vp)->c_ovp) { - panic("cfs_reclaim: c_ovp not void"); + panic("coda_reclaim: c_ovp not void"); } #endif DIAGNOSTIC } cache_purge(vp); - cfs_free(VTOC(vp)); + coda_free(VTOC(vp)); VTOC(vp) = NULL; return (0); } int -cfs_lock(v) +coda_lock(v) void *v; { /* true args */ @@ -1977,7 +1980,7 @@ cfs_lock(v) ENTRY; - if (cfs_lockdebug) { + if (coda_lockdebug) { myprintf(("Attempting lock on %lx.%lx.%lx\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } @@ -1986,7 +1989,7 @@ cfs_lock(v) } int -cfs_unlock(v) +coda_unlock(v) void *v; { /* true args */ @@ -1998,7 +2001,7 @@ cfs_unlock(v) /* locals */ ENTRY; - if (cfs_lockdebug) { + if (coda_lockdebug) { myprintf(("Attempting unlock on %lx.%lx.%lx\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } @@ -2007,7 +2010,7 @@ cfs_unlock(v) } int -cfs_islocked(v) +coda_islocked(v) void *v; { /* true args */ @@ -2020,21 +2023,21 @@ cfs_islocked(v) /* How one looks up a vnode given a device/inode pair: */ int -cfs_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp) +coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp) { /* This is like VFS_VGET() or igetinode()! */ int error; struct mount *mp; if (!(mp = devtomp(dev))) { - myprintf(("cfs_grab_vnode: devtomp(%d) returns NULL\n", dev)); + myprintf(("coda_grab_vnode: devtomp(%d) returns NULL\n", dev)); return(ENXIO); } /* XXX - ensure that nonzero-return means failure */ error = VFS_VGET(mp,ino,vpp); if (error) { - myprintf(("cfs_grab_vnode: iget/vget(%d, %d) returns %p, err %d\n", + myprintf(("coda_grab_vnode: iget/vget(%d, %d) returns %p, err %d\n", dev, ino, *vpp, error)); return(ENOENT); } @@ -2120,31 +2123,31 @@ print_cred(cred) * If no cnode exists for this fid create one and put it * in a table hashed by fid.Volume and fid.Vnode. If the cnode for * this fid is already in the table return it (ref count is - * incremented by cfs_find. The cnode will be flushed from the - * table when cfs_inactive calls cfs_unsave. + * incremented by coda_find. The cnode will be flushed from the + * table when coda_inactive calls coda_unsave. */ struct cnode * -makecfsnode(fid, vfsp, type) +make_coda_node(fid, vfsp, type) ViceFid *fid; struct mount *vfsp; short type; { struct cnode *cp; int err; - if ((cp = cfs_find(fid)) == NULL) { + if ((cp = coda_find(fid)) == NULL) { struct vnode *vp; - cp = cfs_alloc(); + cp = coda_alloc(); lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); cp->c_fid = *fid; - err = getnewvnode(VT_CFS, vfsp, cfs_vnodeop_p, &vp); + err = getnewvnode(VT_CODA, vfsp, coda_vnodeop_p, &vp); if (err) { - panic("cfs: getnewvnode returned error %d\n", err); + panic("coda: getnewvnode returned error %d\n", err); } vp->v_data = cp; vp->v_type = type; cp->c_vnode = vp; - cfs_save(cp); + coda_save(cp); } else { vref(CTOV(cp)); diff --git a/sys/cfs/cfs_vnodeops.h b/sys/cfs/cfs_vnodeops.h index f965c93..9ed3387 100644 --- a/sys/cfs/cfs_vnodeops.h +++ b/sys/cfs/cfs_vnodeops.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfs_vnodeops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfs_vnodeops.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -48,6 +48,9 @@ /* * HISTORY * $Log: cfs_vnodeops.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -64,7 +67,7 @@ * Sync the code for NetBSD -current; test on 1.3 later * * Revision 1.4 98/01/23 11:53:49 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.3.2.3 98/01/23 11:21:13 rvb * Sync with 2.2.5 @@ -73,7 +76,7 @@ * Sync with 1.3 * * Revision 1.3.2.1 97/12/10 14:08:34 rvb - * Fix O_ flags; check result in cfscall + * Fix O_ flags; check result in coda_call * * Revision 1.3 97/12/05 10:39:25 rvb * Read CHANGES @@ -88,48 +91,48 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:40 bnoble - * Added CFS-specific files + * Added CODA-specific files * */ /* NetBSD interfaces to the vnodeops */ -int cfs_open __P((void *)); -int cfs_close __P((void *)); -int cfs_read __P((void *)); -int cfs_write __P((void *)); -int cfs_ioctl __P((void *)); +int coda_open __P((void *)); +int coda_close __P((void *)); +int coda_read __P((void *)); +int coda_write __P((void *)); +int coda_ioctl __P((void *)); /* 1.3 int cfs_select __P((void *));*/ -int cfs_getattr __P((void *)); -int cfs_setattr __P((void *)); -int cfs_access __P((void *)); -int cfs_abortop __P((void *)); -int cfs_readlink __P((void *)); -int cfs_fsync __P((void *)); -int cfs_inactive __P((void *)); -int cfs_lookup __P((void *)); -int cfs_create __P((void *)); -int cfs_remove __P((void *)); -int cfs_link __P((void *)); -int cfs_rename __P((void *)); -int cfs_mkdir __P((void *)); -int cfs_rmdir __P((void *)); -int cfs_symlink __P((void *)); -int cfs_readdir __P((void *)); -int cfs_bmap __P((void *)); -int cfs_strategy __P((void *)); -int cfs_reclaim __P((void *)); -int cfs_lock __P((void *)); -int cfs_unlock __P((void *)); -int cfs_islocked __P((void *)); -int cfs_vop_error __P((void *)); -int cfs_vop_nop __P((void *)); -int cfs_fbsd_getpages __P((void *)); -int cfs_fbsd_putpages __P((void *)); +int coda_getattr __P((void *)); +int coda_setattr __P((void *)); +int coda_access __P((void *)); +int coda_abortop __P((void *)); +int coda_readlink __P((void *)); +int coda_fsync __P((void *)); +int coda_inactive __P((void *)); +int coda_lookup __P((void *)); +int coda_create __P((void *)); +int coda_remove __P((void *)); +int coda_link __P((void *)); +int coda_rename __P((void *)); +int coda_mkdir __P((void *)); +int coda_rmdir __P((void *)); +int coda_symlink __P((void *)); +int coda_readdir __P((void *)); +int coda_bmap __P((void *)); +int coda_strategy __P((void *)); +int coda_reclaim __P((void *)); +int coda_lock __P((void *)); +int coda_unlock __P((void *)); +int coda_islocked __P((void *)); +int coda_vop_error __P((void *)); +int coda_vop_nop __P((void *)); +int coda_fbsd_getpages __P((void *)); +int coda_fbsd_putpages __P((void *)); -int (**cfs_vnodeop_p)(void *); +int (**coda_vnodeop_p)(void *); -int cfs_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, +int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct proc *p); -int cfs_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); +int coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); void print_vattr(struct vattr *attr); void print_cred(struct ucred *cred); diff --git a/sys/cfs/cfsio.h b/sys/cfs/cfsio.h index 87a0ec3..a41f5ce 100644 --- a/sys/cfs/cfsio.h +++ b/sys/cfs/cfsio.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfsio.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfsio.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -47,6 +47,9 @@ /* * HISTORY * $Log: cfsio.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -57,7 +60,7 @@ * Sync the code for NetBSD -current; test on 1.3 later * * Revision 1.3 98/01/23 11:53:49 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.2.38.1 97/12/16 12:40:22 rvb * Sync with 1.3 @@ -66,7 +69,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:42 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:20 bnoble * Branch for NetBSD port revisions @@ -106,16 +109,16 @@ * */ -#ifndef _CFSIO_H_ -#define _CFSIO_H_ +#ifndef _CODAIO_H_ +#define _CODAIO_H_ /* Define ioctl commands for vcioctl, /dev/cfs */ -#define CFSRESIZE _IOW('c', 1, struct cfs_resize ) /* Resize CFS NameCache */ -#define CFSSTATS _IO('c', 2) /* Collect stats */ -#define CFSPRINT _IO('c', 3) /* Print Cache */ -#define CFSTEST _IO('c', 4) /* Print Cache */ +#define CODARESIZE _IOW('c', 1, struct coda_resize ) /* Resize CODA NameCache */ +#define CODASTATS _IO('c', 2) /* Collect stats */ +#define CODAPRINT _IO('c', 3) /* Print Cache */ +#define CODATEST _IO('c', 4) /* Print Cache */ -struct cfs_resize { int hashsize, heapsize; }; +struct coda_resize { int hashsize, heapsize; }; #endif diff --git a/sys/cfs/cfsnc.h b/sys/cfs/cfsnc.h index d3d8945..8606365 100644 --- a/sys/cfs/cfsnc.h +++ b/sys/cfs/cfsnc.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfsnc.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfsnc.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -47,6 +47,9 @@ /* * HISTORY * $Log: cfsnc.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -63,7 +66,7 @@ * Sync the code for NetBSD -current; test on 1.3 later * * Revision 1.5 98/01/23 11:53:51 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.4.2.1 97/12/16 12:40:23 rvb * Sync with 1.3 @@ -81,7 +84,7 @@ * don't include headers in headers * * Revision 1.3 97/08/05 11:08:19 lily - * Removed cfsnc_replace, replaced it with a cfs_find, unhash, and + * Removed cfsnc_replace, replaced it with a coda_find, unhash, and * rehash. This fixes a cnode leak and a bug in which the fid is * not actually replaced. (cfs_namecache.c, cfsnc.h, cfs_subr.c) * @@ -89,7 +92,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:45 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:22 bnoble * Branch for NetBSD port revisions @@ -98,20 +101,20 @@ * Bump to major revision 3 to prepare for NetBSD port * * Revision 2.2 1994/08/28 19:37:39 luqi - * Add a new CFS_REPLACE call to allow venus to replace a ViceFid in the + * Add a new CODA_REPLACE call to allow venus to replace a ViceFid in the * mini-cache. * * In "cfs.h": - * Add CFS_REPLACE decl. + * Add CODA_REPLACE decl. * * In "cfs_namecache.c": * Add routine cfsnc_replace. * * In "cfs_subr.c": - * Add case-statement to process CFS_REPLACE. + * Add case-statement to process CODA_REPLACE. * * In "cfsnc.h": - * Add decl for CFSNC_REPLACE. + * Add decl for CODA_NC_REPLACE. * * Revision 2.1 94/07/21 16:25:27 satya * Conversion to C++ 3.0; start of Coda Release 2.0 @@ -128,15 +131,15 @@ * * */ -#ifndef _CFSNC_HEADER_ -#define _CFSNC_HEADER_ +#ifndef _CODA_NC_HEADER_ +#define _CODA_NC_HEADER_ /* - * Cfs constants + * Coda constants */ -#define CFSNC_NAMELEN 15 /* longest name stored in cache */ -#define CFSNC_CACHESIZE 256 /* Default cache size */ -#define CFSNC_HASHSIZE 64 /* Must be multiple of 2 */ +#define CODA_NC_NAMELEN 15 /* longest name stored in cache */ +#define CODA_NC_CACHESIZE 256 /* Default cache size */ +#define CODA_NC_HASHSIZE 64 /* Must be multiple of 2 */ /* * Hash function for the primary hash. @@ -148,14 +151,14 @@ */ #ifdef oldhash -#define CFSNC_HASH(name, namelen, cp) \ - ((name[0] + name[namelen-1] + namelen + (int)(cp)) & (cfsnc_hashsize-1)) +#define CODA_NC_HASH(name, namelen, cp) \ + ((name[0] + name[namelen-1] + namelen + (int)(cp)) & (coda_nc_hashsize-1)) #else -#define CFSNC_HASH(name, namelen, cp) \ - ((name[0] + (name[namelen-1]<<4) + namelen + (((int)cp)>>8)) & (cfsnc_hashsize-1)) +#define CODA_NC_HASH(name, namelen, cp) \ + ((name[0] + (name[namelen-1]<<4) + namelen + (((int)cp)>>8)) & (coda_nc_hashsize-1)) #endif -#define CFS_NAMEMATCH(cp, name, namelen, dcp) \ +#define CODA_NAMEMATCH(cp, name, namelen, dcp) \ ((namelen == cp->namelen) && (dcp == cp->dcp) && \ (bcmp(cp->name,name,namelen) == 0)) @@ -165,82 +168,82 @@ * in the list node, thus the trickery for lru. */ -#define CFSNC_HSHINS(elem, pred) insque(elem,pred) -#define CFSNC_HSHREM(elem) remque(elem) -#define CFSNC_HSHNUL(elem) (elem)->hash_next = \ +#define CODA_NC_HSHINS(elem, pred) insque(elem,pred) +#define CODA_NC_HSHREM(elem) remque(elem) +#define CODA_NC_HSHNUL(elem) (elem)->hash_next = \ (elem)->hash_prev = (elem) -#define CFSNC_LRUINS(elem, pred) insque(LRU_PART(elem), LRU_PART(pred)) -#define CFSNC_LRUREM(elem) remque(LRU_PART(elem)); -#define CFSNC_LRUGET(lruhead) LRU_TOP((lruhead).lru_prev) +#define CODA_NC_LRUINS(elem, pred) insque(LRU_PART(elem), LRU_PART(pred)) +#define CODA_NC_LRUREM(elem) remque(LRU_PART(elem)); +#define CODA_NC_LRUGET(lruhead) LRU_TOP((lruhead).lru_prev) -#define CFSNC_VALID(cncp) (cncp->dcp != (struct cnode *)0) +#define CODA_NC_VALID(cncp) (cncp->dcp != (struct cnode *)0) -#define LRU_PART(cncp) (struct cfscache *) \ - ((char *)cncp + (2*sizeof(struct cfscache *))) -#define LRU_TOP(cncp) (struct cfscache *) \ - ((char *)cncp - (2*sizeof(struct cfscache *))) -#define DATA_PART(cncp) (struct cfscache *) \ - ((char *)cncp + (4*sizeof(struct cfscache *))) -#define DATA_SIZE (sizeof(struct cfscache)-(4*sizeof(struct cfscache *))) +#define LRU_PART(cncp) (struct coda_cache *) \ + ((char *)cncp + (2*sizeof(struct coda_cache *))) +#define LRU_TOP(cncp) (struct coda_cache *) \ + ((char *)cncp - (2*sizeof(struct coda_cache *))) +#define DATA_PART(cncp) (struct coda_cache *) \ + ((char *)cncp + (4*sizeof(struct coda_cache *))) +#define DATA_SIZE (sizeof(struct coda_cache)-(4*sizeof(struct coda_cache *))) /* - * Structure for an element in the CFS Name Cache. + * Structure for an element in the CODA Name Cache. * NOTE: I use the position of arguments and their size in the - * implementation of the functions CFSNC_LRUINS, CFSNC_LRUREM, and + * implementation of the functions CODA_NC_LRUINS, CODA_NC_LRUREM, and * DATA_PART. */ -struct cfscache { - struct cfscache *hash_next,*hash_prev; /* Hash list */ - struct cfscache *lru_next, *lru_prev; /* LRU list */ +struct coda_cache { + struct coda_cache *hash_next,*hash_prev; /* Hash list */ + struct coda_cache *lru_next, *lru_prev; /* LRU list */ struct cnode *cp; /* vnode of the file */ struct cnode *dcp; /* parent's cnode */ struct ucred *cred; /* user credentials */ - char name[CFSNC_NAMELEN]; /* segment name */ + char name[CODA_NC_NAMELEN]; /* segment name */ int namelen; /* length of name */ }; -struct cfslru { /* Start of LRU chain */ +struct coda_lru { /* Start of LRU chain */ char *dummy1, *dummy2; /* place holders */ - struct cfscache *lru_next, *lru_prev; /* position of pointers is important */ + struct coda_cache *lru_next, *lru_prev; /* position of pointers is important */ }; -struct cfshash { /* Start of Hash chain */ - struct cfscache *hash_next, *hash_prev; /* NOTE: chain pointers must be first */ +struct coda_hash { /* Start of Hash chain */ + struct coda_cache *hash_next, *hash_prev; /* NOTE: chain pointers must be first */ int length; /* used for tuning purposes */ }; /* * Symbols to aid in debugging the namecache code. Assumes the existence - * of the variable cfsnc_debug, which is defined in cfs_namecache.c + * of the variable coda_nc_debug, which is defined in cfs_namecache.c */ -#define CFSNC_DEBUG(N, STMT) { if (cfsnc_debug & (1 < #include -MALLOC_DECLARE(M_CFS); +MALLOC_DECLARE(M_CODA); /* * tmp below since we need struct queue @@ -161,41 +164,41 @@ MALLOC_DECLARE(M_CFS); /* * Cnode lookup stuff. - * NOTE: CFS_CACHESIZE must be a power of 2 for cfshash to work! + * NOTE: CODA_CACHESIZE must be a power of 2 for cfshash to work! */ -#define CFS_CACHESIZE 512 +#define CODA_CACHESIZE 512 -#define CFS_ALLOC(ptr, cast, size) \ +#define CODA_ALLOC(ptr, cast, size) \ do { \ - ptr = (cast)malloc((unsigned long) size, M_CFS, M_WAITOK); \ + ptr = (cast)malloc((unsigned long) size, M_CODA, M_WAITOK); \ if (ptr == 0) { \ panic("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ } \ } while (0) -#define CFS_FREE(ptr, size) free((ptr), M_CFS) +#define CODA_FREE(ptr, size) free((ptr), M_CODA) /* * global cache state control */ -extern int cfsnc_use; +extern int coda_nc_use; /* * Used to select debugging statements throughout the cfs code. */ -extern int cfsdebug; -extern int cfsnc_debug; -extern int cfs_printf_delay; -extern int cfs_vnop_print_entry; -extern int cfs_psdev_print_entry; -extern int cfs_vfsop_print_entry; +extern int codadebug; +extern int coda_nc_debug; +extern int coda_printf_delay; +extern int coda_vnop_print_entry; +extern int coda_psdev_print_entry; +extern int coda_vfsop_print_entry; -#define CFSDBGMSK(N) (1 << N) -#define CFSDEBUG(N, STMT) { if (cfsdebug & CFSDBGMSK(N)) { STMT } } +#define CODADBGMSK(N) (1 << N) +#define CODADEBUG(N, STMT) { if (codadebug & CODADBGMSK(N)) { STMT } } #define myprintf(args) \ do { \ - if (cfs_printf_delay) \ - DELAY(cfs_printf_delay);\ + if (coda_printf_delay) \ + DELAY(coda_printf_delay);\ printf args ; \ } while (0) @@ -240,42 +243,42 @@ struct vcomm { #define MARK_VC_CLOSED(vcp) (vcp)->vc_requests.forw = NULL; #define MARK_VC_OPEN(vcp) /* MT */ -struct cfs_clstat { +struct coda_clstat { int ncalls; /* client requests */ int nbadcalls; /* upcall failures */ - int reqs[CFS_NCALLS]; /* count of each request */ + int reqs[CODA_NCALLS]; /* count of each request */ }; -extern struct cfs_clstat cfs_clstat; +extern struct coda_clstat coda_clstat; /* - * CFS structure to hold mount/file system information + * CODA structure to hold mount/file system information */ -struct cfs_mntinfo { +struct coda_mntinfo { struct vnode *mi_rootvp; struct mount *mi_vfsp; struct vcomm mi_vcomm; }; -extern struct cfs_mntinfo cfs_mnttbl[]; /* indexed by minor device number */ +extern struct coda_mntinfo coda_mnttbl[]; /* indexed by minor device number */ /* * vfs pointer to mount info */ -#define vftomi(vfsp) ((struct cfs_mntinfo *)(vfsp->mnt_data)) -#define CFS_MOUNTED(vfsp) (vftomi((vfsp)) != (struct cfs_mntinfo *)0) +#define vftomi(vfsp) ((struct coda_mntinfo *)(vfsp->mnt_data)) +#define CODA_MOUNTED(vfsp) (vftomi((vfsp)) != (struct coda_mntinfo *)0) /* * vnode pointer to mount info */ -#define vtomi(vp) ((struct cfs_mntinfo *)(vp->v_mount->mnt_data)) +#define vtomi(vp) ((struct coda_mntinfo *)(vp->v_mount->mnt_data)) /* * Used for identifying usage of "Control" object */ -extern struct vnode *cfs_ctlvp; -#define IS_CTL_VP(vp) ((vp) == cfs_ctlvp) -#define IS_CTL_NAME(vp, name, l)((l == CFS_CONTROLLEN) \ +extern struct vnode *coda_ctlvp; +#define IS_CTL_VP(vp) ((vp) == coda_ctlvp) +#define IS_CTL_NAME(vp, name, l)((l == CODA_CONTROLLEN) \ && ((vp) == vtomi((vp))->mi_rootvp) \ - && strncmp(name, CFS_CONTROL, l) == 0) + && strncmp(name, CODA_CONTROL, l) == 0) /* * An enum to tell us whether something that will remove a reference @@ -287,22 +290,22 @@ enum dc_status { }; /* cfs_psdev.h */ -int cfscall(struct cfs_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); +int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); /* cfs_subr.h */ int handleDownCall(int opcode, union outputArgs *out); -void cfs_unmounting(struct mount *whoIam); -int cfs_vmflush(struct cnode *cp); +void coda_unmounting(struct mount *whoIam); +int coda_vmflush(struct cnode *cp); /* cfs_vnodeops.h */ -struct cnode *makecfsnode(ViceFid *fid, struct mount *vfsp, short type); -int cfs_vnodeopstats_init(void); +struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type); +int coda_vnodeopstats_init(void); -/* cfs_vfsops.h */ +/* coda_vfsops.h */ struct mount *devtomp(dev_t dev); /* sigh */ -#define CFS_RDWR ((u_long) 31) +#define CODA_RDWR ((u_long) 31) #endif /* _CNODE_H_ */ diff --git a/sys/cfs/coda.h b/sys/cfs/coda.h index 09268b6..45a30ba 100644 --- a/sys/cfs/coda.h +++ b/sys/cfs/coda.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/coda.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: coda.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -37,8 +37,8 @@ * Linux modifications by Peter Braam, Aug 1996 */ -#ifndef _CFS_HEADER_ -#define _CFS_HEADER_ +#ifndef _CODA_HEADER_ +#define _CODA_HEADER_ /* Catch new _KERNEL defn for NetBSD */ #ifdef __NetBSD__ @@ -65,11 +65,11 @@ struct timespec { /* - * Cfs constants + * Coda constants */ -#define CFS_MAXNAMLEN 255 -#define CFS_MAXPATHLEN 1024 -#define CFS_MAXSYMLINK 10 +#define CODA_MAXNAMLEN 255 +#define CODA_MAXPATHLEN 1024 +#define CODA_MAXSYMLINK 10 /* these are Coda's version of O_RDONLY etc combinations * to deal with VFS open modes @@ -98,10 +98,10 @@ struct venus_dirent { unsigned short d_reclen; /* length of this record */ char d_type; /* file type, see below */ char d_namlen; /* length of string in d_name */ - char d_name[CFS_MAXNAMLEN + 1];/* name must be no longer than this */ + char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */ }; #undef DIRSIZ -#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CFS_MAXNAMLEN+1)) + \ +#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \ (((dp)->d_namlen+1 + 3) &~ 3)) /* @@ -203,38 +203,38 @@ struct coda_vattr { * Kernel <--> Venus communications. */ -#define CFS_ROOT ((u_long) 2) -#define CFS_SYNC ((u_long) 3) -#define CFS_OPEN ((u_long) 4) -#define CFS_CLOSE ((u_long) 5) -#define CFS_IOCTL ((u_long) 6) -#define CFS_GETATTR ((u_long) 7) -#define CFS_SETATTR ((u_long) 8) -#define CFS_ACCESS ((u_long) 9) -#define CFS_LOOKUP ((u_long) 10) -#define CFS_CREATE ((u_long) 11) -#define CFS_REMOVE ((u_long) 12) -#define CFS_LINK ((u_long) 13) -#define CFS_RENAME ((u_long) 14) -#define CFS_MKDIR ((u_long) 15) -#define CFS_RMDIR ((u_long) 16) -#define CFS_READDIR ((u_long) 17) -#define CFS_SYMLINK ((u_long) 18) -#define CFS_READLINK ((u_long) 19) -#define CFS_FSYNC ((u_long) 20) -#define CFS_INACTIVE ((u_long) 21) -#define CFS_VGET ((u_long) 22) -#define CFS_SIGNAL ((u_long) 23) -#define CFS_REPLACE ((u_long) 24) -#define CFS_FLUSH ((u_long) 25) -#define CFS_PURGEUSER ((u_long) 26) -#define CFS_ZAPFILE ((u_long) 27) -#define CFS_ZAPDIR ((u_long) 28) -#define CFS_ZAPVNODE ((u_long) 29) -#define CFS_PURGEFID ((u_long) 30) -#define CFS_NCALLS 31 - -#define DOWNCALL(opcode) (opcode >= CFS_REPLACE && opcode <= CFS_PURGEFID) +#define CODA_ROOT ((u_long) 2) +#define CODA_SYNC ((u_long) 3) +#define CODA_OPEN ((u_long) 4) +#define CODA_CLOSE ((u_long) 5) +#define CODA_IOCTL ((u_long) 6) +#define CODA_GETATTR ((u_long) 7) +#define CODA_SETATTR ((u_long) 8) +#define CODA_ACCESS ((u_long) 9) +#define CODA_LOOKUP ((u_long) 10) +#define CODA_CREATE ((u_long) 11) +#define CODA_REMOVE ((u_long) 12) +#define CODA_LINK ((u_long) 13) +#define CODA_RENAME ((u_long) 14) +#define CODA_MKDIR ((u_long) 15) +#define CODA_RMDIR ((u_long) 16) +#define CODA_READDIR ((u_long) 17) +#define CODA_SYMLINK ((u_long) 18) +#define CODA_READLINK ((u_long) 19) +#define CODA_FSYNC ((u_long) 20) +#define CODA_INACTIVE ((u_long) 21) +#define CODA_VGET ((u_long) 22) +#define CODA_SIGNAL ((u_long) 23) +#define CODA_REPLACE ((u_long) 24) +#define CODA_FLUSH ((u_long) 25) +#define CODA_PURGEUSER ((u_long) 26) +#define CODA_ZAPFILE ((u_long) 27) +#define CODA_ZAPDIR ((u_long) 28) +#define CODA_ZAPVNODE ((u_long) 29) +#define CODA_PURGEFID ((u_long) 30) +#define CODA_NCALLS 31 + +#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) #define VC_MAXDATASIZE 8192 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\ @@ -245,7 +245,7 @@ struct coda_vattr { /* * Venus <-> Coda RPC arguments */ -struct cfs_in_hdr { +struct coda_in_hdr { unsigned long opcode; unsigned long unique; /* Keep multiple outstanding msgs distinct */ u_short pid; /* Common to all */ @@ -255,53 +255,53 @@ struct cfs_in_hdr { }; /* Really important that opcode and unique are 1st two fields! */ -struct cfs_out_hdr { +struct coda_out_hdr { unsigned long opcode; unsigned long unique; unsigned long result; }; -/* cfs_root: NO_IN */ -struct cfs_root_out { - struct cfs_out_hdr oh; +/* coda_root: NO_IN */ +struct coda_root_out { + struct coda_out_hdr oh; ViceFid VFid; }; -struct cfs_root_in { - struct cfs_in_hdr in; +struct coda_root_in { + struct coda_in_hdr in; }; -/* cfs_sync: */ -/* Nothing needed for cfs_sync */ +/* coda_sync: */ +/* Nothing needed for coda_sync */ -/* cfs_open: */ -struct cfs_open_in { - struct cfs_in_hdr ih; +/* coda_open: */ +struct coda_open_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_open_out { - struct cfs_out_hdr oh; +struct coda_open_out { + struct coda_out_hdr oh; cdev_t dev; ino_t inode; }; -/* cfs_close: */ -struct cfs_close_in { - struct cfs_in_hdr ih; +/* coda_close: */ +struct coda_close_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_close_out { - struct cfs_out_hdr out; +struct coda_close_out { + struct coda_out_hdr out; }; -/* cfs_ioctl: */ -struct cfs_ioctl_in { - struct cfs_in_hdr ih; +/* coda_ioctl: */ +struct coda_ioctl_in { + struct coda_in_hdr ih; ViceFid VFid; int cmd; int len; @@ -309,64 +309,64 @@ struct cfs_ioctl_in { char *data; /* Place holder for data. */ }; -struct cfs_ioctl_out { - struct cfs_out_hdr oh; +struct coda_ioctl_out { + struct coda_out_hdr oh; int len; caddr_t data; /* Place holder for data. */ }; -/* cfs_getattr: */ -struct cfs_getattr_in { - struct cfs_in_hdr ih; +/* coda_getattr: */ +struct coda_getattr_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_getattr_out { - struct cfs_out_hdr oh; +struct coda_getattr_out { + struct coda_out_hdr oh; struct coda_vattr attr; }; -/* cfs_setattr: NO_OUT */ -struct cfs_setattr_in { - struct cfs_in_hdr ih; +/* coda_setattr: NO_OUT */ +struct coda_setattr_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; }; -struct cfs_setattr_out { - struct cfs_out_hdr out; +struct coda_setattr_out { + struct coda_out_hdr out; }; -/* cfs_access: NO_OUT */ -struct cfs_access_in { - struct cfs_in_hdr ih; +/* coda_access: NO_OUT */ +struct coda_access_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_access_out { - struct cfs_out_hdr out; +struct coda_access_out { + struct coda_out_hdr out; }; -/* cfs_lookup: */ -struct cfs_lookup_in { - struct cfs_in_hdr ih; +/* coda_lookup: */ +struct coda_lookup_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_lookup_out { - struct cfs_out_hdr oh; +struct coda_lookup_out { + struct coda_out_hdr oh; ViceFid VFid; int vtype; }; -/* cfs_create: */ -struct cfs_create_in { - struct cfs_in_hdr ih; +/* coda_create: */ +struct coda_create_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; int excl; @@ -374,188 +374,188 @@ struct cfs_create_in { int name; /* Place holder for data. */ }; -struct cfs_create_out { - struct cfs_out_hdr oh; +struct coda_create_out { + struct coda_out_hdr oh; ViceFid VFid; struct coda_vattr attr; }; -/* cfs_remove: NO_OUT */ -struct cfs_remove_in { - struct cfs_in_hdr ih; +/* coda_remove: NO_OUT */ +struct coda_remove_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_remove_out { - struct cfs_out_hdr out; +struct coda_remove_out { + struct coda_out_hdr out; }; -/* cfs_link: NO_OUT */ -struct cfs_link_in { - struct cfs_in_hdr ih; +/* coda_link: NO_OUT */ +struct coda_link_in { + struct coda_in_hdr ih; ViceFid sourceFid; /* cnode to link *to* */ ViceFid destFid; /* Directory in which to place link */ int tname; /* Place holder for data. */ }; -struct cfs_link_out { - struct cfs_out_hdr out; +struct coda_link_out { + struct coda_out_hdr out; }; -/* cfs_rename: NO_OUT */ -struct cfs_rename_in { - struct cfs_in_hdr ih; +/* coda_rename: NO_OUT */ +struct coda_rename_in { + struct coda_in_hdr ih; ViceFid sourceFid; int srcname; ViceFid destFid; int destname; }; -struct cfs_rename_out { - struct cfs_out_hdr out; +struct coda_rename_out { + struct coda_out_hdr out; }; -/* cfs_mkdir: */ -struct cfs_mkdir_in { - struct cfs_in_hdr ih; +/* coda_mkdir: */ +struct coda_mkdir_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; int name; /* Place holder for data. */ }; -struct cfs_mkdir_out { - struct cfs_out_hdr oh; +struct coda_mkdir_out { + struct coda_out_hdr oh; ViceFid VFid; struct coda_vattr attr; }; -/* cfs_rmdir: NO_OUT */ -struct cfs_rmdir_in { - struct cfs_in_hdr ih; +/* coda_rmdir: NO_OUT */ +struct coda_rmdir_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_rmdir_out { - struct cfs_out_hdr out; +struct coda_rmdir_out { + struct coda_out_hdr out; }; -/* cfs_readdir: */ -struct cfs_readdir_in { - struct cfs_in_hdr ih; +/* coda_readdir: */ +struct coda_readdir_in { + struct coda_in_hdr ih; ViceFid VFid; int count; int offset; }; -struct cfs_readdir_out { - struct cfs_out_hdr oh; +struct coda_readdir_out { + struct coda_out_hdr oh; int size; caddr_t data; /* Place holder for data. */ }; -/* cfs_symlink: NO_OUT */ -struct cfs_symlink_in { - struct cfs_in_hdr ih; +/* coda_symlink: NO_OUT */ +struct coda_symlink_in { + struct coda_in_hdr ih; ViceFid VFid; /* Directory to put symlink in */ int srcname; struct coda_vattr attr; int tname; }; -struct cfs_symlink_out { - struct cfs_out_hdr out; +struct coda_symlink_out { + struct coda_out_hdr out; }; -/* cfs_readlink: */ -struct cfs_readlink_in { - struct cfs_in_hdr ih; +/* coda_readlink: */ +struct coda_readlink_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_readlink_out { - struct cfs_out_hdr oh; +struct coda_readlink_out { + struct coda_out_hdr oh; int count; caddr_t data; /* Place holder for data. */ }; -/* cfs_fsync: NO_OUT */ -struct cfs_fsync_in { - struct cfs_in_hdr ih; +/* coda_fsync: NO_OUT */ +struct coda_fsync_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_fsync_out { - struct cfs_out_hdr out; +struct coda_fsync_out { + struct coda_out_hdr out; }; -/* cfs_inactive: NO_OUT */ -struct cfs_inactive_in { - struct cfs_in_hdr ih; +/* coda_inactive: NO_OUT */ +struct coda_inactive_in { + struct coda_in_hdr ih; ViceFid VFid; }; -/* cfs_vget: */ -struct cfs_vget_in { - struct cfs_in_hdr ih; +/* coda_vget: */ +struct coda_vget_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_vget_out { - struct cfs_out_hdr oh; +struct coda_vget_out { + struct coda_out_hdr oh; ViceFid VFid; int vtype; }; -/* CFS_SIGNAL is out-of-band, doesn't need data. */ -/* CFS_INVALIDATE is a venus->kernel call */ -/* CFS_FLUSH is a venus->kernel call */ +/* CODA_SIGNAL is out-of-band, doesn't need data. */ +/* CODA_INVALIDATE is a venus->kernel call */ +/* CODA_FLUSH is a venus->kernel call */ -/* cfs_purgeuser: */ -/* CFS_PURGEUSER is a venus->kernel call */ -struct cfs_purgeuser_out { - struct cfs_out_hdr oh; +/* coda_purgeuser: */ +/* CODA_PURGEUSER is a venus->kernel call */ +struct coda_purgeuser_out { + struct coda_out_hdr oh; struct coda_cred cred; }; -/* cfs_zapfile: */ -/* CFS_ZAPFILE is a venus->kernel call */ -struct cfs_zapfile_out { - struct cfs_out_hdr oh; +/* coda_zapfile: */ +/* CODA_ZAPFILE is a venus->kernel call */ +struct coda_zapfile_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_zapdir: */ -/* CFS_ZAPDIR is a venus->kernel call */ -struct cfs_zapdir_out { - struct cfs_out_hdr oh; +/* coda_zapdir: */ +/* CODA_ZAPDIR is a venus->kernel call */ +struct coda_zapdir_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_zapnode: */ -/* CFS_ZAPVNODE is a venus->kernel call */ -struct cfs_zapvnode_out { - struct cfs_out_hdr oh; +/* coda_zapnode: */ +/* CODA_ZAPVNODE is a venus->kernel call */ +struct coda_zapvnode_out { + struct coda_out_hdr oh; struct coda_cred cred; ViceFid VFid; }; -/* cfs_purgefid: */ -/* CFS_PURGEFID is a venus->kernel call */ -struct cfs_purgefid_out { - struct cfs_out_hdr oh; +/* coda_purgefid: */ +/* CODA_PURGEFID is a venus->kernel call */ +struct coda_purgefid_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_rdwr: */ -struct cfs_rdwr_in { - struct cfs_in_hdr ih; +/* coda_rdwr: */ +struct coda_rdwr_in { + struct coda_in_hdr ih; ViceFid VFid; int rwflag; int count; @@ -564,83 +564,83 @@ struct cfs_rdwr_in { caddr_t data; /* Place holder for data. */ }; -struct cfs_rdwr_out { - struct cfs_out_hdr oh; +struct coda_rdwr_out { + struct coda_out_hdr oh; int rwflag; int count; caddr_t data; /* Place holder for data. */ }; -/* cfs_replace: */ -/* CFS_REPLACE is a venus->kernel call */ -struct cfs_replace_out { /* cfs_replace is a venus->kernel call */ - struct cfs_out_hdr oh; +/* coda_replace: */ +/* CODA_REPLACE is a venus->kernel call */ +struct coda_replace_out { /* coda_replace is a venus->kernel call */ + struct coda_out_hdr oh; ViceFid NewFid; ViceFid OldFid; }; /* - * Occasionally, don't cache the fid returned by CFS_LOOKUP. For instance, if + * Occasionally, don't cache the fid returned by CODA_LOOKUP. For instance, if * the fid is inconsistent. This case is handled by setting the top bit of the * return result parameter. */ -#define CFS_NOCACHE 0x80000000 +#define CODA_NOCACHE 0x80000000 union inputArgs { - struct cfs_in_hdr ih; /* NB: every struct below begins with an ih */ - struct cfs_open_in cfs_open; - struct cfs_close_in cfs_close; - struct cfs_ioctl_in cfs_ioctl; - struct cfs_getattr_in cfs_getattr; - struct cfs_setattr_in cfs_setattr; - struct cfs_access_in cfs_access; - struct cfs_lookup_in cfs_lookup; - struct cfs_create_in cfs_create; - struct cfs_remove_in cfs_remove; - struct cfs_link_in cfs_link; - struct cfs_rename_in cfs_rename; - struct cfs_mkdir_in cfs_mkdir; - struct cfs_rmdir_in cfs_rmdir; - struct cfs_readdir_in cfs_readdir; - struct cfs_symlink_in cfs_symlink; - struct cfs_readlink_in cfs_readlink; - struct cfs_fsync_in cfs_fsync; - struct cfs_inactive_in cfs_inactive; - struct cfs_vget_in cfs_vget; - struct cfs_rdwr_in cfs_rdwr; + struct coda_in_hdr ih; /* NB: every struct below begins with an ih */ + struct coda_open_in coda_open; + struct coda_close_in coda_close; + struct coda_ioctl_in coda_ioctl; + struct coda_getattr_in coda_getattr; + struct coda_setattr_in coda_setattr; + struct coda_access_in coda_access; + struct coda_lookup_in coda_lookup; + struct coda_create_in coda_create; + struct coda_remove_in coda_remove; + struct coda_link_in coda_link; + struct coda_rename_in coda_rename; + struct coda_mkdir_in coda_mkdir; + struct coda_rmdir_in coda_rmdir; + struct coda_readdir_in coda_readdir; + struct coda_symlink_in coda_symlink; + struct coda_readlink_in coda_readlink; + struct coda_fsync_in coda_fsync; + struct coda_inactive_in coda_inactive; + struct coda_vget_in coda_vget; + struct coda_rdwr_in coda_rdwr; }; union outputArgs { - struct cfs_out_hdr oh; /* NB: every struct below begins with an oh */ - struct cfs_root_out cfs_root; - struct cfs_open_out cfs_open; - struct cfs_ioctl_out cfs_ioctl; - struct cfs_getattr_out cfs_getattr; - struct cfs_lookup_out cfs_lookup; - struct cfs_create_out cfs_create; - struct cfs_mkdir_out cfs_mkdir; - struct cfs_readdir_out cfs_readdir; - struct cfs_readlink_out cfs_readlink; - struct cfs_vget_out cfs_vget; - struct cfs_purgeuser_out cfs_purgeuser; - struct cfs_zapfile_out cfs_zapfile; - struct cfs_zapdir_out cfs_zapdir; - struct cfs_zapvnode_out cfs_zapvnode; - struct cfs_purgefid_out cfs_purgefid; - struct cfs_rdwr_out cfs_rdwr; - struct cfs_replace_out cfs_replace; + struct coda_out_hdr oh; /* NB: every struct below begins with an oh */ + struct coda_root_out coda_root; + struct coda_open_out coda_open; + struct coda_ioctl_out coda_ioctl; + struct coda_getattr_out coda_getattr; + struct coda_lookup_out coda_lookup; + struct coda_create_out coda_create; + struct coda_mkdir_out coda_mkdir; + struct coda_readdir_out coda_readdir; + struct coda_readlink_out coda_readlink; + struct coda_vget_out coda_vget; + struct coda_purgeuser_out coda_purgeuser; + struct coda_zapfile_out coda_zapfile; + struct coda_zapdir_out coda_zapdir; + struct coda_zapvnode_out coda_zapvnode; + struct coda_purgefid_out coda_purgefid; + struct coda_rdwr_out coda_rdwr; + struct coda_replace_out coda_replace; }; -union cfs_downcalls { - /* CFS_INVALIDATE is a venus->kernel call */ - /* CFS_FLUSH is a venus->kernel call */ - struct cfs_purgeuser_out purgeuser; - struct cfs_zapfile_out zapfile; - struct cfs_zapdir_out zapdir; - struct cfs_zapvnode_out zapvnode; - struct cfs_purgefid_out purgefid; - struct cfs_replace_out replace; +union coda_downcalls { + /* CODA_INVALIDATE is a venus->kernel call */ + /* CODA_FLUSH is a venus->kernel call */ + struct coda_purgeuser_out purgeuser; + struct coda_zapfile_out zapfile; + struct coda_zapdir_out zapdir; + struct coda_zapvnode_out zapvnode; + struct coda_purgefid_out purgefid; + struct coda_replace_out replace; }; @@ -661,8 +661,8 @@ struct PioctlData { struct ViceIoctl vi; }; -#define CFS_CONTROL ".CONTROL" -#define CFS_CONTROLLEN 8 +#define CODA_CONTROL ".CONTROL" +#define CODA_CONTROLLEN 8 #define CTL_VOL -1 #define CTL_VNO -1 #define CTL_UNI -1 diff --git a/sys/cfs/coda_opstats.h b/sys/cfs/coda_opstats.h index 5f528ec..bb1b4f2 100644 --- a/sys/cfs/coda_opstats.h +++ b/sys/cfs/coda_opstats.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/coda_opstats.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: coda_opstats.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -46,13 +46,13 @@ * vget: all */ -#define CFS_MOUNT_STATS 0 -#define CFS_UMOUNT_STATS 1 -#define CFS_ROOT_STATS 2 -#define CFS_STATFS_STATS 3 -#define CFS_SYNC_STATS 4 -#define CFS_VGET_STATS 5 -#define CFS_VFSOPS_SIZE 6 +#define CODA_MOUNT_STATS 0 +#define CODA_UMOUNT_STATS 1 +#define CODA_ROOT_STATS 2 +#define CODA_STATFS_STATS 3 +#define CODA_SYNC_STATS 4 +#define CODA_VGET_STATS 5 +#define CODA_VFSOPS_SIZE 6 /* vnodeops: * open: all to venus @@ -81,33 +81,33 @@ * may cause an "internal" open/close */ -#define CFS_OPEN_STATS 0 -#define CFS_CLOSE_STATS 1 -#define CFS_RDWR_STATS 2 -#define CFS_IOCTL_STATS 3 -#define CFS_SELECT_STATS 4 -#define CFS_GETATTR_STATS 5 -#define CFS_SETATTR_STATS 6 -#define CFS_ACCESS_STATS 7 -#define CFS_READLINK_STATS 8 -#define CFS_FSYNC_STATS 9 -#define CFS_INACTIVE_STATS 10 -#define CFS_LOOKUP_STATS 11 -#define CFS_CREATE_STATS 12 -#define CFS_REMOVE_STATS 13 -#define CFS_LINK_STATS 14 -#define CFS_RENAME_STATS 15 -#define CFS_MKDIR_STATS 16 -#define CFS_RMDIR_STATS 17 -#define CFS_SYMLINK_STATS 18 -#define CFS_READDIR_STATS 19 -#define CFS_VNODEOPS_SIZE 20 +#define CODA_OPEN_STATS 0 +#define CODA_CLOSE_STATS 1 +#define CODA_RDWR_STATS 2 +#define CODA_IOCTL_STATS 3 +#define CODA_SELECT_STATS 4 +#define CODA_GETATTR_STATS 5 +#define CODA_SETATTR_STATS 6 +#define CODA_ACCESS_STATS 7 +#define CODA_READLINK_STATS 8 +#define CODA_FSYNC_STATS 9 +#define CODA_INACTIVE_STATS 10 +#define CODA_LOOKUP_STATS 11 +#define CODA_CREATE_STATS 12 +#define CODA_REMOVE_STATS 13 +#define CODA_LINK_STATS 14 +#define CODA_RENAME_STATS 15 +#define CODA_MKDIR_STATS 16 +#define CODA_RMDIR_STATS 17 +#define CODA_SYMLINK_STATS 18 +#define CODA_READDIR_STATS 19 +#define CODA_VNODEOPS_SIZE 20 /* * I propose the following structres: */ -struct cfs_op_stats { +struct coda_op_stats { int opcode; /* vfs opcode */ long entries; /* number of times call attempted */ long sat_intrn; /* number of times call satisfied by cache */ diff --git a/sys/cfs/pioctl.h b/sys/cfs/pioctl.h index c6fcc6fe..aa18e66 100644 --- a/sys/cfs/pioctl.h +++ b/sys/cfs/pioctl.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/pioctl.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: pioctl.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -43,6 +43,9 @@ /* * HISTORY * $Log: pioctl.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -59,7 +62,7 @@ * Sync the code for NetBSD -current; test on 1.3 later * * Revision 1.4 98/01/23 11:53:54 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.3.2.1 97/12/06 17:41:29 rvb * Sync with peters coda.h @@ -77,7 +80,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:54 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 2.4 90/08/30 11:51:12 bohman * Ioctl changes for STDC. diff --git a/sys/coda/cnode.h b/sys/coda/cnode.h index 9f29ca9..cefc6a8 100644 --- a/sys/coda/cnode.h +++ b/sys/coda/cnode.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cnode.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cnode.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -47,6 +47,9 @@ /* * HISTORY * $Log: cnode.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -69,7 +72,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.5 98/01/23 11:53:51 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.4.2.5 98/01/23 11:21:14 rvb * Sync with 2.2.5 @@ -103,7 +106,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:53 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:23 bnoble * Branch for NetBSD port revisions @@ -152,7 +155,7 @@ #include #include -MALLOC_DECLARE(M_CFS); +MALLOC_DECLARE(M_CODA); /* * tmp below since we need struct queue @@ -161,41 +164,41 @@ MALLOC_DECLARE(M_CFS); /* * Cnode lookup stuff. - * NOTE: CFS_CACHESIZE must be a power of 2 for cfshash to work! + * NOTE: CODA_CACHESIZE must be a power of 2 for cfshash to work! */ -#define CFS_CACHESIZE 512 +#define CODA_CACHESIZE 512 -#define CFS_ALLOC(ptr, cast, size) \ +#define CODA_ALLOC(ptr, cast, size) \ do { \ - ptr = (cast)malloc((unsigned long) size, M_CFS, M_WAITOK); \ + ptr = (cast)malloc((unsigned long) size, M_CODA, M_WAITOK); \ if (ptr == 0) { \ panic("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ } \ } while (0) -#define CFS_FREE(ptr, size) free((ptr), M_CFS) +#define CODA_FREE(ptr, size) free((ptr), M_CODA) /* * global cache state control */ -extern int cfsnc_use; +extern int coda_nc_use; /* * Used to select debugging statements throughout the cfs code. */ -extern int cfsdebug; -extern int cfsnc_debug; -extern int cfs_printf_delay; -extern int cfs_vnop_print_entry; -extern int cfs_psdev_print_entry; -extern int cfs_vfsop_print_entry; +extern int codadebug; +extern int coda_nc_debug; +extern int coda_printf_delay; +extern int coda_vnop_print_entry; +extern int coda_psdev_print_entry; +extern int coda_vfsop_print_entry; -#define CFSDBGMSK(N) (1 << N) -#define CFSDEBUG(N, STMT) { if (cfsdebug & CFSDBGMSK(N)) { STMT } } +#define CODADBGMSK(N) (1 << N) +#define CODADEBUG(N, STMT) { if (codadebug & CODADBGMSK(N)) { STMT } } #define myprintf(args) \ do { \ - if (cfs_printf_delay) \ - DELAY(cfs_printf_delay);\ + if (coda_printf_delay) \ + DELAY(coda_printf_delay);\ printf args ; \ } while (0) @@ -240,42 +243,42 @@ struct vcomm { #define MARK_VC_CLOSED(vcp) (vcp)->vc_requests.forw = NULL; #define MARK_VC_OPEN(vcp) /* MT */ -struct cfs_clstat { +struct coda_clstat { int ncalls; /* client requests */ int nbadcalls; /* upcall failures */ - int reqs[CFS_NCALLS]; /* count of each request */ + int reqs[CODA_NCALLS]; /* count of each request */ }; -extern struct cfs_clstat cfs_clstat; +extern struct coda_clstat coda_clstat; /* - * CFS structure to hold mount/file system information + * CODA structure to hold mount/file system information */ -struct cfs_mntinfo { +struct coda_mntinfo { struct vnode *mi_rootvp; struct mount *mi_vfsp; struct vcomm mi_vcomm; }; -extern struct cfs_mntinfo cfs_mnttbl[]; /* indexed by minor device number */ +extern struct coda_mntinfo coda_mnttbl[]; /* indexed by minor device number */ /* * vfs pointer to mount info */ -#define vftomi(vfsp) ((struct cfs_mntinfo *)(vfsp->mnt_data)) -#define CFS_MOUNTED(vfsp) (vftomi((vfsp)) != (struct cfs_mntinfo *)0) +#define vftomi(vfsp) ((struct coda_mntinfo *)(vfsp->mnt_data)) +#define CODA_MOUNTED(vfsp) (vftomi((vfsp)) != (struct coda_mntinfo *)0) /* * vnode pointer to mount info */ -#define vtomi(vp) ((struct cfs_mntinfo *)(vp->v_mount->mnt_data)) +#define vtomi(vp) ((struct coda_mntinfo *)(vp->v_mount->mnt_data)) /* * Used for identifying usage of "Control" object */ -extern struct vnode *cfs_ctlvp; -#define IS_CTL_VP(vp) ((vp) == cfs_ctlvp) -#define IS_CTL_NAME(vp, name, l)((l == CFS_CONTROLLEN) \ +extern struct vnode *coda_ctlvp; +#define IS_CTL_VP(vp) ((vp) == coda_ctlvp) +#define IS_CTL_NAME(vp, name, l)((l == CODA_CONTROLLEN) \ && ((vp) == vtomi((vp))->mi_rootvp) \ - && strncmp(name, CFS_CONTROL, l) == 0) + && strncmp(name, CODA_CONTROL, l) == 0) /* * An enum to tell us whether something that will remove a reference @@ -287,22 +290,22 @@ enum dc_status { }; /* cfs_psdev.h */ -int cfscall(struct cfs_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); +int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); /* cfs_subr.h */ int handleDownCall(int opcode, union outputArgs *out); -void cfs_unmounting(struct mount *whoIam); -int cfs_vmflush(struct cnode *cp); +void coda_unmounting(struct mount *whoIam); +int coda_vmflush(struct cnode *cp); /* cfs_vnodeops.h */ -struct cnode *makecfsnode(ViceFid *fid, struct mount *vfsp, short type); -int cfs_vnodeopstats_init(void); +struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type); +int coda_vnodeopstats_init(void); -/* cfs_vfsops.h */ +/* coda_vfsops.h */ struct mount *devtomp(dev_t dev); /* sigh */ -#define CFS_RDWR ((u_long) 31) +#define CODA_RDWR ((u_long) 31) #endif /* _CNODE_H_ */ diff --git a/sys/coda/coda.h b/sys/coda/coda.h index 09268b6..45a30ba 100644 --- a/sys/coda/coda.h +++ b/sys/coda/coda.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/coda.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: coda.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -37,8 +37,8 @@ * Linux modifications by Peter Braam, Aug 1996 */ -#ifndef _CFS_HEADER_ -#define _CFS_HEADER_ +#ifndef _CODA_HEADER_ +#define _CODA_HEADER_ /* Catch new _KERNEL defn for NetBSD */ #ifdef __NetBSD__ @@ -65,11 +65,11 @@ struct timespec { /* - * Cfs constants + * Coda constants */ -#define CFS_MAXNAMLEN 255 -#define CFS_MAXPATHLEN 1024 -#define CFS_MAXSYMLINK 10 +#define CODA_MAXNAMLEN 255 +#define CODA_MAXPATHLEN 1024 +#define CODA_MAXSYMLINK 10 /* these are Coda's version of O_RDONLY etc combinations * to deal with VFS open modes @@ -98,10 +98,10 @@ struct venus_dirent { unsigned short d_reclen; /* length of this record */ char d_type; /* file type, see below */ char d_namlen; /* length of string in d_name */ - char d_name[CFS_MAXNAMLEN + 1];/* name must be no longer than this */ + char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */ }; #undef DIRSIZ -#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CFS_MAXNAMLEN+1)) + \ +#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \ (((dp)->d_namlen+1 + 3) &~ 3)) /* @@ -203,38 +203,38 @@ struct coda_vattr { * Kernel <--> Venus communications. */ -#define CFS_ROOT ((u_long) 2) -#define CFS_SYNC ((u_long) 3) -#define CFS_OPEN ((u_long) 4) -#define CFS_CLOSE ((u_long) 5) -#define CFS_IOCTL ((u_long) 6) -#define CFS_GETATTR ((u_long) 7) -#define CFS_SETATTR ((u_long) 8) -#define CFS_ACCESS ((u_long) 9) -#define CFS_LOOKUP ((u_long) 10) -#define CFS_CREATE ((u_long) 11) -#define CFS_REMOVE ((u_long) 12) -#define CFS_LINK ((u_long) 13) -#define CFS_RENAME ((u_long) 14) -#define CFS_MKDIR ((u_long) 15) -#define CFS_RMDIR ((u_long) 16) -#define CFS_READDIR ((u_long) 17) -#define CFS_SYMLINK ((u_long) 18) -#define CFS_READLINK ((u_long) 19) -#define CFS_FSYNC ((u_long) 20) -#define CFS_INACTIVE ((u_long) 21) -#define CFS_VGET ((u_long) 22) -#define CFS_SIGNAL ((u_long) 23) -#define CFS_REPLACE ((u_long) 24) -#define CFS_FLUSH ((u_long) 25) -#define CFS_PURGEUSER ((u_long) 26) -#define CFS_ZAPFILE ((u_long) 27) -#define CFS_ZAPDIR ((u_long) 28) -#define CFS_ZAPVNODE ((u_long) 29) -#define CFS_PURGEFID ((u_long) 30) -#define CFS_NCALLS 31 - -#define DOWNCALL(opcode) (opcode >= CFS_REPLACE && opcode <= CFS_PURGEFID) +#define CODA_ROOT ((u_long) 2) +#define CODA_SYNC ((u_long) 3) +#define CODA_OPEN ((u_long) 4) +#define CODA_CLOSE ((u_long) 5) +#define CODA_IOCTL ((u_long) 6) +#define CODA_GETATTR ((u_long) 7) +#define CODA_SETATTR ((u_long) 8) +#define CODA_ACCESS ((u_long) 9) +#define CODA_LOOKUP ((u_long) 10) +#define CODA_CREATE ((u_long) 11) +#define CODA_REMOVE ((u_long) 12) +#define CODA_LINK ((u_long) 13) +#define CODA_RENAME ((u_long) 14) +#define CODA_MKDIR ((u_long) 15) +#define CODA_RMDIR ((u_long) 16) +#define CODA_READDIR ((u_long) 17) +#define CODA_SYMLINK ((u_long) 18) +#define CODA_READLINK ((u_long) 19) +#define CODA_FSYNC ((u_long) 20) +#define CODA_INACTIVE ((u_long) 21) +#define CODA_VGET ((u_long) 22) +#define CODA_SIGNAL ((u_long) 23) +#define CODA_REPLACE ((u_long) 24) +#define CODA_FLUSH ((u_long) 25) +#define CODA_PURGEUSER ((u_long) 26) +#define CODA_ZAPFILE ((u_long) 27) +#define CODA_ZAPDIR ((u_long) 28) +#define CODA_ZAPVNODE ((u_long) 29) +#define CODA_PURGEFID ((u_long) 30) +#define CODA_NCALLS 31 + +#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) #define VC_MAXDATASIZE 8192 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\ @@ -245,7 +245,7 @@ struct coda_vattr { /* * Venus <-> Coda RPC arguments */ -struct cfs_in_hdr { +struct coda_in_hdr { unsigned long opcode; unsigned long unique; /* Keep multiple outstanding msgs distinct */ u_short pid; /* Common to all */ @@ -255,53 +255,53 @@ struct cfs_in_hdr { }; /* Really important that opcode and unique are 1st two fields! */ -struct cfs_out_hdr { +struct coda_out_hdr { unsigned long opcode; unsigned long unique; unsigned long result; }; -/* cfs_root: NO_IN */ -struct cfs_root_out { - struct cfs_out_hdr oh; +/* coda_root: NO_IN */ +struct coda_root_out { + struct coda_out_hdr oh; ViceFid VFid; }; -struct cfs_root_in { - struct cfs_in_hdr in; +struct coda_root_in { + struct coda_in_hdr in; }; -/* cfs_sync: */ -/* Nothing needed for cfs_sync */ +/* coda_sync: */ +/* Nothing needed for coda_sync */ -/* cfs_open: */ -struct cfs_open_in { - struct cfs_in_hdr ih; +/* coda_open: */ +struct coda_open_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_open_out { - struct cfs_out_hdr oh; +struct coda_open_out { + struct coda_out_hdr oh; cdev_t dev; ino_t inode; }; -/* cfs_close: */ -struct cfs_close_in { - struct cfs_in_hdr ih; +/* coda_close: */ +struct coda_close_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_close_out { - struct cfs_out_hdr out; +struct coda_close_out { + struct coda_out_hdr out; }; -/* cfs_ioctl: */ -struct cfs_ioctl_in { - struct cfs_in_hdr ih; +/* coda_ioctl: */ +struct coda_ioctl_in { + struct coda_in_hdr ih; ViceFid VFid; int cmd; int len; @@ -309,64 +309,64 @@ struct cfs_ioctl_in { char *data; /* Place holder for data. */ }; -struct cfs_ioctl_out { - struct cfs_out_hdr oh; +struct coda_ioctl_out { + struct coda_out_hdr oh; int len; caddr_t data; /* Place holder for data. */ }; -/* cfs_getattr: */ -struct cfs_getattr_in { - struct cfs_in_hdr ih; +/* coda_getattr: */ +struct coda_getattr_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_getattr_out { - struct cfs_out_hdr oh; +struct coda_getattr_out { + struct coda_out_hdr oh; struct coda_vattr attr; }; -/* cfs_setattr: NO_OUT */ -struct cfs_setattr_in { - struct cfs_in_hdr ih; +/* coda_setattr: NO_OUT */ +struct coda_setattr_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; }; -struct cfs_setattr_out { - struct cfs_out_hdr out; +struct coda_setattr_out { + struct coda_out_hdr out; }; -/* cfs_access: NO_OUT */ -struct cfs_access_in { - struct cfs_in_hdr ih; +/* coda_access: NO_OUT */ +struct coda_access_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_access_out { - struct cfs_out_hdr out; +struct coda_access_out { + struct coda_out_hdr out; }; -/* cfs_lookup: */ -struct cfs_lookup_in { - struct cfs_in_hdr ih; +/* coda_lookup: */ +struct coda_lookup_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_lookup_out { - struct cfs_out_hdr oh; +struct coda_lookup_out { + struct coda_out_hdr oh; ViceFid VFid; int vtype; }; -/* cfs_create: */ -struct cfs_create_in { - struct cfs_in_hdr ih; +/* coda_create: */ +struct coda_create_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; int excl; @@ -374,188 +374,188 @@ struct cfs_create_in { int name; /* Place holder for data. */ }; -struct cfs_create_out { - struct cfs_out_hdr oh; +struct coda_create_out { + struct coda_out_hdr oh; ViceFid VFid; struct coda_vattr attr; }; -/* cfs_remove: NO_OUT */ -struct cfs_remove_in { - struct cfs_in_hdr ih; +/* coda_remove: NO_OUT */ +struct coda_remove_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_remove_out { - struct cfs_out_hdr out; +struct coda_remove_out { + struct coda_out_hdr out; }; -/* cfs_link: NO_OUT */ -struct cfs_link_in { - struct cfs_in_hdr ih; +/* coda_link: NO_OUT */ +struct coda_link_in { + struct coda_in_hdr ih; ViceFid sourceFid; /* cnode to link *to* */ ViceFid destFid; /* Directory in which to place link */ int tname; /* Place holder for data. */ }; -struct cfs_link_out { - struct cfs_out_hdr out; +struct coda_link_out { + struct coda_out_hdr out; }; -/* cfs_rename: NO_OUT */ -struct cfs_rename_in { - struct cfs_in_hdr ih; +/* coda_rename: NO_OUT */ +struct coda_rename_in { + struct coda_in_hdr ih; ViceFid sourceFid; int srcname; ViceFid destFid; int destname; }; -struct cfs_rename_out { - struct cfs_out_hdr out; +struct coda_rename_out { + struct coda_out_hdr out; }; -/* cfs_mkdir: */ -struct cfs_mkdir_in { - struct cfs_in_hdr ih; +/* coda_mkdir: */ +struct coda_mkdir_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; int name; /* Place holder for data. */ }; -struct cfs_mkdir_out { - struct cfs_out_hdr oh; +struct coda_mkdir_out { + struct coda_out_hdr oh; ViceFid VFid; struct coda_vattr attr; }; -/* cfs_rmdir: NO_OUT */ -struct cfs_rmdir_in { - struct cfs_in_hdr ih; +/* coda_rmdir: NO_OUT */ +struct coda_rmdir_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_rmdir_out { - struct cfs_out_hdr out; +struct coda_rmdir_out { + struct coda_out_hdr out; }; -/* cfs_readdir: */ -struct cfs_readdir_in { - struct cfs_in_hdr ih; +/* coda_readdir: */ +struct coda_readdir_in { + struct coda_in_hdr ih; ViceFid VFid; int count; int offset; }; -struct cfs_readdir_out { - struct cfs_out_hdr oh; +struct coda_readdir_out { + struct coda_out_hdr oh; int size; caddr_t data; /* Place holder for data. */ }; -/* cfs_symlink: NO_OUT */ -struct cfs_symlink_in { - struct cfs_in_hdr ih; +/* coda_symlink: NO_OUT */ +struct coda_symlink_in { + struct coda_in_hdr ih; ViceFid VFid; /* Directory to put symlink in */ int srcname; struct coda_vattr attr; int tname; }; -struct cfs_symlink_out { - struct cfs_out_hdr out; +struct coda_symlink_out { + struct coda_out_hdr out; }; -/* cfs_readlink: */ -struct cfs_readlink_in { - struct cfs_in_hdr ih; +/* coda_readlink: */ +struct coda_readlink_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_readlink_out { - struct cfs_out_hdr oh; +struct coda_readlink_out { + struct coda_out_hdr oh; int count; caddr_t data; /* Place holder for data. */ }; -/* cfs_fsync: NO_OUT */ -struct cfs_fsync_in { - struct cfs_in_hdr ih; +/* coda_fsync: NO_OUT */ +struct coda_fsync_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_fsync_out { - struct cfs_out_hdr out; +struct coda_fsync_out { + struct coda_out_hdr out; }; -/* cfs_inactive: NO_OUT */ -struct cfs_inactive_in { - struct cfs_in_hdr ih; +/* coda_inactive: NO_OUT */ +struct coda_inactive_in { + struct coda_in_hdr ih; ViceFid VFid; }; -/* cfs_vget: */ -struct cfs_vget_in { - struct cfs_in_hdr ih; +/* coda_vget: */ +struct coda_vget_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_vget_out { - struct cfs_out_hdr oh; +struct coda_vget_out { + struct coda_out_hdr oh; ViceFid VFid; int vtype; }; -/* CFS_SIGNAL is out-of-band, doesn't need data. */ -/* CFS_INVALIDATE is a venus->kernel call */ -/* CFS_FLUSH is a venus->kernel call */ +/* CODA_SIGNAL is out-of-band, doesn't need data. */ +/* CODA_INVALIDATE is a venus->kernel call */ +/* CODA_FLUSH is a venus->kernel call */ -/* cfs_purgeuser: */ -/* CFS_PURGEUSER is a venus->kernel call */ -struct cfs_purgeuser_out { - struct cfs_out_hdr oh; +/* coda_purgeuser: */ +/* CODA_PURGEUSER is a venus->kernel call */ +struct coda_purgeuser_out { + struct coda_out_hdr oh; struct coda_cred cred; }; -/* cfs_zapfile: */ -/* CFS_ZAPFILE is a venus->kernel call */ -struct cfs_zapfile_out { - struct cfs_out_hdr oh; +/* coda_zapfile: */ +/* CODA_ZAPFILE is a venus->kernel call */ +struct coda_zapfile_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_zapdir: */ -/* CFS_ZAPDIR is a venus->kernel call */ -struct cfs_zapdir_out { - struct cfs_out_hdr oh; +/* coda_zapdir: */ +/* CODA_ZAPDIR is a venus->kernel call */ +struct coda_zapdir_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_zapnode: */ -/* CFS_ZAPVNODE is a venus->kernel call */ -struct cfs_zapvnode_out { - struct cfs_out_hdr oh; +/* coda_zapnode: */ +/* CODA_ZAPVNODE is a venus->kernel call */ +struct coda_zapvnode_out { + struct coda_out_hdr oh; struct coda_cred cred; ViceFid VFid; }; -/* cfs_purgefid: */ -/* CFS_PURGEFID is a venus->kernel call */ -struct cfs_purgefid_out { - struct cfs_out_hdr oh; +/* coda_purgefid: */ +/* CODA_PURGEFID is a venus->kernel call */ +struct coda_purgefid_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_rdwr: */ -struct cfs_rdwr_in { - struct cfs_in_hdr ih; +/* coda_rdwr: */ +struct coda_rdwr_in { + struct coda_in_hdr ih; ViceFid VFid; int rwflag; int count; @@ -564,83 +564,83 @@ struct cfs_rdwr_in { caddr_t data; /* Place holder for data. */ }; -struct cfs_rdwr_out { - struct cfs_out_hdr oh; +struct coda_rdwr_out { + struct coda_out_hdr oh; int rwflag; int count; caddr_t data; /* Place holder for data. */ }; -/* cfs_replace: */ -/* CFS_REPLACE is a venus->kernel call */ -struct cfs_replace_out { /* cfs_replace is a venus->kernel call */ - struct cfs_out_hdr oh; +/* coda_replace: */ +/* CODA_REPLACE is a venus->kernel call */ +struct coda_replace_out { /* coda_replace is a venus->kernel call */ + struct coda_out_hdr oh; ViceFid NewFid; ViceFid OldFid; }; /* - * Occasionally, don't cache the fid returned by CFS_LOOKUP. For instance, if + * Occasionally, don't cache the fid returned by CODA_LOOKUP. For instance, if * the fid is inconsistent. This case is handled by setting the top bit of the * return result parameter. */ -#define CFS_NOCACHE 0x80000000 +#define CODA_NOCACHE 0x80000000 union inputArgs { - struct cfs_in_hdr ih; /* NB: every struct below begins with an ih */ - struct cfs_open_in cfs_open; - struct cfs_close_in cfs_close; - struct cfs_ioctl_in cfs_ioctl; - struct cfs_getattr_in cfs_getattr; - struct cfs_setattr_in cfs_setattr; - struct cfs_access_in cfs_access; - struct cfs_lookup_in cfs_lookup; - struct cfs_create_in cfs_create; - struct cfs_remove_in cfs_remove; - struct cfs_link_in cfs_link; - struct cfs_rename_in cfs_rename; - struct cfs_mkdir_in cfs_mkdir; - struct cfs_rmdir_in cfs_rmdir; - struct cfs_readdir_in cfs_readdir; - struct cfs_symlink_in cfs_symlink; - struct cfs_readlink_in cfs_readlink; - struct cfs_fsync_in cfs_fsync; - struct cfs_inactive_in cfs_inactive; - struct cfs_vget_in cfs_vget; - struct cfs_rdwr_in cfs_rdwr; + struct coda_in_hdr ih; /* NB: every struct below begins with an ih */ + struct coda_open_in coda_open; + struct coda_close_in coda_close; + struct coda_ioctl_in coda_ioctl; + struct coda_getattr_in coda_getattr; + struct coda_setattr_in coda_setattr; + struct coda_access_in coda_access; + struct coda_lookup_in coda_lookup; + struct coda_create_in coda_create; + struct coda_remove_in coda_remove; + struct coda_link_in coda_link; + struct coda_rename_in coda_rename; + struct coda_mkdir_in coda_mkdir; + struct coda_rmdir_in coda_rmdir; + struct coda_readdir_in coda_readdir; + struct coda_symlink_in coda_symlink; + struct coda_readlink_in coda_readlink; + struct coda_fsync_in coda_fsync; + struct coda_inactive_in coda_inactive; + struct coda_vget_in coda_vget; + struct coda_rdwr_in coda_rdwr; }; union outputArgs { - struct cfs_out_hdr oh; /* NB: every struct below begins with an oh */ - struct cfs_root_out cfs_root; - struct cfs_open_out cfs_open; - struct cfs_ioctl_out cfs_ioctl; - struct cfs_getattr_out cfs_getattr; - struct cfs_lookup_out cfs_lookup; - struct cfs_create_out cfs_create; - struct cfs_mkdir_out cfs_mkdir; - struct cfs_readdir_out cfs_readdir; - struct cfs_readlink_out cfs_readlink; - struct cfs_vget_out cfs_vget; - struct cfs_purgeuser_out cfs_purgeuser; - struct cfs_zapfile_out cfs_zapfile; - struct cfs_zapdir_out cfs_zapdir; - struct cfs_zapvnode_out cfs_zapvnode; - struct cfs_purgefid_out cfs_purgefid; - struct cfs_rdwr_out cfs_rdwr; - struct cfs_replace_out cfs_replace; + struct coda_out_hdr oh; /* NB: every struct below begins with an oh */ + struct coda_root_out coda_root; + struct coda_open_out coda_open; + struct coda_ioctl_out coda_ioctl; + struct coda_getattr_out coda_getattr; + struct coda_lookup_out coda_lookup; + struct coda_create_out coda_create; + struct coda_mkdir_out coda_mkdir; + struct coda_readdir_out coda_readdir; + struct coda_readlink_out coda_readlink; + struct coda_vget_out coda_vget; + struct coda_purgeuser_out coda_purgeuser; + struct coda_zapfile_out coda_zapfile; + struct coda_zapdir_out coda_zapdir; + struct coda_zapvnode_out coda_zapvnode; + struct coda_purgefid_out coda_purgefid; + struct coda_rdwr_out coda_rdwr; + struct coda_replace_out coda_replace; }; -union cfs_downcalls { - /* CFS_INVALIDATE is a venus->kernel call */ - /* CFS_FLUSH is a venus->kernel call */ - struct cfs_purgeuser_out purgeuser; - struct cfs_zapfile_out zapfile; - struct cfs_zapdir_out zapdir; - struct cfs_zapvnode_out zapvnode; - struct cfs_purgefid_out purgefid; - struct cfs_replace_out replace; +union coda_downcalls { + /* CODA_INVALIDATE is a venus->kernel call */ + /* CODA_FLUSH is a venus->kernel call */ + struct coda_purgeuser_out purgeuser; + struct coda_zapfile_out zapfile; + struct coda_zapdir_out zapdir; + struct coda_zapvnode_out zapvnode; + struct coda_purgefid_out purgefid; + struct coda_replace_out replace; }; @@ -661,8 +661,8 @@ struct PioctlData { struct ViceIoctl vi; }; -#define CFS_CONTROL ".CONTROL" -#define CFS_CONTROLLEN 8 +#define CODA_CONTROL ".CONTROL" +#define CODA_CONTROLLEN 8 #define CTL_VOL -1 #define CTL_VNO -1 #define CTL_UNI -1 diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index f137ff5..4c49386 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfs_fbsd.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfs_fbsd.c,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -99,7 +99,7 @@ vcattach(void) VCDEBUG("makedev OK.\n"); cdevsw_add(&vccdev, &vccdevsw, NULL); - VCDEBUG("cfs: vccdevsw entry installed at %d.\n", major(vccdev)); + VCDEBUG("coda: vccdevsw entry installed at %d.\n", major(vccdev)); } static vc_devsw_installed = 0; @@ -118,7 +118,7 @@ vc_drvinit(void *unused) } int -cfs_fbsd_getpages(v) +coda_fbsd_getpages(v) void *v; { struct vop_getpages_args *ap = v; @@ -151,16 +151,16 @@ cfs_fbsd_getpages(v) opened_internally = 1; error = VOP_OPEN(vp, FREAD, cred, p); -printf("cfs_getp: Internally Opening %p\n", vp); +printf("coda_getp: Internally Opening %p\n", vp); if (error) { - printf("cfs_getpage: VOP_OPEN on container failed %d\n", error); + printf("coda_getpage: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_getpage: vfs_object_create() returns %d\n", error); + printf("coda_getpage: vfs_object_create() returns %d\n", error); vput(vp); return(error); } @@ -168,10 +168,10 @@ printf("cfs_getp: Internally Opening %p\n", vp); cfvp = cp->c_ovp; } else { -printf("cfs_getp: has container %p\n", cfvp); +printf("coda_getp: has container %p\n", cfvp); } -printf("cfs_fbsd_getpages: using container "); +printf("coda_fbsd_getpages: using container "); /* error = vnode_pager_generic_getpages(cfvp, ap->a_m, ap->a_count, ap->a_reqpage); @@ -191,7 +191,7 @@ printf("error = %d\n", error); } int -cfs_fbsd_putpages(v) +coda_fbsd_putpages(v) void *v; { struct vop_putpages_args *ap = v; diff --git a/sys/coda/coda_io.h b/sys/coda/coda_io.h index 87a0ec3..a41f5ce 100644 --- a/sys/coda/coda_io.h +++ b/sys/coda/coda_io.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfsio.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfsio.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -47,6 +47,9 @@ /* * HISTORY * $Log: cfsio.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -57,7 +60,7 @@ * Sync the code for NetBSD -current; test on 1.3 later * * Revision 1.3 98/01/23 11:53:49 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.2.38.1 97/12/16 12:40:22 rvb * Sync with 1.3 @@ -66,7 +69,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:42 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:20 bnoble * Branch for NetBSD port revisions @@ -106,16 +109,16 @@ * */ -#ifndef _CFSIO_H_ -#define _CFSIO_H_ +#ifndef _CODAIO_H_ +#define _CODAIO_H_ /* Define ioctl commands for vcioctl, /dev/cfs */ -#define CFSRESIZE _IOW('c', 1, struct cfs_resize ) /* Resize CFS NameCache */ -#define CFSSTATS _IO('c', 2) /* Collect stats */ -#define CFSPRINT _IO('c', 3) /* Print Cache */ -#define CFSTEST _IO('c', 4) /* Print Cache */ +#define CODARESIZE _IOW('c', 1, struct coda_resize ) /* Resize CODA NameCache */ +#define CODASTATS _IO('c', 2) /* Collect stats */ +#define CODAPRINT _IO('c', 3) /* Print Cache */ +#define CODATEST _IO('c', 4) /* Print Cache */ -struct cfs_resize { int hashsize, heapsize; }; +struct coda_resize { int hashsize, heapsize; }; #endif diff --git a/sys/coda/coda_namecache.c b/sys/coda/coda_namecache.c index 2a079e5..1a88346 100644 --- a/sys/coda/coda_namecache.c +++ b/sys/coda/coda_namecache.c @@ -69,7 +69,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.7 98/01/23 11:53:39 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.6.2.4 98/01/23 11:21:02 rvb * Sync with 2.2.5 @@ -109,7 +109,7 @@ * >64Meg; venus can be killed! * * Revision 1.5 97/08/05 11:08:01 lily - * Removed cfsnc_replace, replaced it with a cfs_find, unhash, and + * Removed cfsnc_replace, replaced it with a coda_find, unhash, and * rehash. This fixes a cnode leak and a bug in which the fid is * not actually replaced. (cfs_namecache.c, cfsnc.h, cfs_subr.c) * @@ -125,7 +125,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:15 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:07:57 bnoble * Branch for NetBSD port revisions @@ -137,20 +137,20 @@ * Made changes 'cause sun4s have braindead compilers * * Revision 2.2 94/08/28 19:37:35 luqi - * Add a new CFS_REPLACE call to allow venus to replace a ViceFid in the + * Add a new CODA_REPLACE call to allow venus to replace a ViceFid in the * mini-cache. * * In "cfs.h": - * Add CFS_REPLACE decl. + * Add CODA_REPLACE decl. * * In "cfs_namecache.c": * Add routine cfsnc_replace. * * In "cfs_subr.c": - * Add case-statement to process CFS_REPLACE. + * Add case-statement to process CODA_REPLACE. * * In "cfsnc.h": - * Add decl for CFSNC_REPLACE. + * Add decl for CODA_NC_REPLACE. * * * Revision 2.1 94/07/21 16:25:15 satya @@ -160,7 +160,7 @@ * merge kernel/latest and alpha/src/cfs * * Revision 2.3 92/09/30 14:16:20 mja - * call cfs_flush instead of calling inode_uncache_try directly + * call coda_flush instead of calling inode_uncache_try directly * (from dcs). Also... * * Substituted rvb's history blurb so that we agree with Mach 2.5 sources. @@ -180,7 +180,7 @@ */ /* - * This module contains the routines to implement the CFS name cache. The + * This module contains the routines to implement the CODA name cache. The * purpose of this cache is to reduce the cost of translating pathnames * into Vice FIDs. Each entry in the cache contains the name of the file, * the vnode (FID) of the parent directory, and the cred structure of the @@ -203,8 +203,8 @@ * NOTES: rvb@cs * 1. The name cache holds a reference to every vnode in it. Hence files can not be * closed or made inactive until they are released. - * 2. cfsnc_name(cp) was added to get a name for a cnode pointer for debugging. - * 3. cfsnc_find() has debug code to detect when entries are stored with different + * 2. coda_nc_name(cp) was added to get a name for a cnode pointer for debugging. + * 3. coda_nc_find() has debug code to detect when entries are stored with different * credentials. We don't understand yet, if/how entries are NOT EQ but still * EQUAL * 4. I wonder if this name cache could be replace by the vnode name cache. @@ -227,82 +227,78 @@ #include #include #include -#ifdef DEBUG -/* for printcred */ -#include -#endif /* * Declaration of the name cache data structure. */ -int cfsnc_use = 1; /* Indicate use of CFS Name Cache */ -int cfsnc_size = CFSNC_CACHESIZE; /* size of the cache */ -int cfsnc_hashsize = CFSNC_HASHSIZE; /* size of the primary hash */ +int coda_nc_use = 1; /* Indicate use of CODA Name Cache */ +int coda_nc_size = CODA_NC_CACHESIZE; /* size of the cache */ +int coda_nc_hashsize = CODA_NC_HASHSIZE; /* size of the primary hash */ -struct cfscache *cfsncheap; /* pointer to the cache entries */ -struct cfshash *cfsnchash; /* hash table of cfscache pointers */ -struct cfslru cfsnc_lru; /* head of lru chain */ +struct coda_cache *coda_nc_heap; /* pointer to the cache entries */ +struct coda_hash *coda_nc_hash; /* hash table of coda_cache pointers */ +struct coda_lru coda_nc_lru; /* head of lru chain */ -struct cfsnc_statistics cfsnc_stat; /* Keep various stats */ +struct coda_nc_statistics coda_nc_stat; /* Keep various stats */ /* * for testing purposes */ -int cfsnc_debug = 0; +int coda_nc_debug = 0; /* - * Entry points for the CFS Name Cache + * Entry points for the CODA Name Cache */ -static struct cfscache *cfsnc_find(struct cnode *dcp, const char *name, int namelen, +static struct coda_cache *coda_nc_find(struct cnode *dcp, const char *name, int namelen, struct ucred *cred, int hash); -static void cfsnc_remove(struct cfscache *cncp, enum dc_status dcstat); +static void coda_nc_remove(struct coda_cache *cncp, enum dc_status dcstat); /* * Initialize the cache, the LRU structure and the Hash structure(s) */ -#define TOTAL_CACHE_SIZE (sizeof(struct cfscache) * cfsnc_size) -#define TOTAL_HASH_SIZE (sizeof(struct cfshash) * cfsnc_hashsize) +#define TOTAL_CACHE_SIZE (sizeof(struct coda_cache) * coda_nc_size) +#define TOTAL_HASH_SIZE (sizeof(struct coda_hash) * coda_nc_hashsize) -int cfsnc_initialized = 0; /* Initially the cache has not been initialized */ +int coda_nc_initialized = 0; /* Initially the cache has not been initialized */ void -cfsnc_init(void) +coda_nc_init(void) { int i; /* zero the statistics structure */ - bzero(&cfsnc_stat, (sizeof(struct cfsnc_statistics))); + bzero(&coda_nc_stat, (sizeof(struct coda_nc_statistics))); - printf("CFS NAME CACHE: CACHE %d, HASH TBL %d\n", CFSNC_CACHESIZE, CFSNC_HASHSIZE); - CFS_ALLOC(cfsncheap, struct cfscache *, TOTAL_CACHE_SIZE); - CFS_ALLOC(cfsnchash, struct cfshash *, TOTAL_HASH_SIZE); + printf("CODA NAME CACHE: CACHE %d, HASH TBL %d\n", CODA_NC_CACHESIZE, CODA_NC_HASHSIZE); + CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE); + CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE); - cfsnc_lru.lru_next = - cfsnc_lru.lru_prev = (struct cfscache *)LRU_PART(&cfsnc_lru); + coda_nc_lru.lru_next = + coda_nc_lru.lru_prev = (struct coda_cache *)LRU_PART(&coda_nc_lru); - for (i=0; i < cfsnc_size; i++) { /* initialize the heap */ - CFSNC_LRUINS(&cfsncheap[i], &cfsnc_lru); - CFSNC_HSHNUL(&cfsncheap[i]); - cfsncheap[i].cp = cfsncheap[i].dcp = (struct cnode *)0; + for (i=0; i < coda_nc_size; i++) { /* initialize the heap */ + CODA_NC_LRUINS(&coda_nc_heap[i], &coda_nc_lru); + CODA_NC_HSHNUL(&coda_nc_heap[i]); + coda_nc_heap[i].cp = coda_nc_heap[i].dcp = (struct cnode *)0; } - for (i=0; i < cfsnc_hashsize; i++) { /* initialize the hashtable */ - CFSNC_HSHNUL((struct cfscache *)&cfsnchash[i]); + for (i=0; i < coda_nc_hashsize; i++) { /* initialize the hashtable */ + CODA_NC_HSHNUL((struct coda_cache *)&coda_nc_hash[i]); } - cfsnc_initialized++; + coda_nc_initialized++; } /* * Auxillary routines -- shouldn't be entry points */ -static struct cfscache * -cfsnc_find(dcp, name, namelen, cred, hash) +static struct coda_cache * +coda_nc_find(dcp, name, namelen, cred, hash) struct cnode *dcp; const char *name; int namelen; @@ -313,28 +309,28 @@ cfsnc_find(dcp, name, namelen, cred, hash) * hash to find the appropriate bucket, look through the chain * for the right entry (especially right cred, unless cred == 0) */ - struct cfscache *cncp; + struct coda_cache *cncp; int count = 1; - CFSNC_DEBUG(CFSNC_FIND, - myprintf(("cfsnc_find(dcp %p, name %s, len %d, cred %p, hash %d\n", + CODA_NC_DEBUG(CODA_NC_FIND, + myprintf(("coda_nc_find(dcp %p, name %s, len %d, cred %p, hash %d\n", dcp, name, namelen, cred, hash));) - for (cncp = cfsnchash[hash].hash_next; - cncp != (struct cfscache *)&cfsnchash[hash]; + for (cncp = coda_nc_hash[hash].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[hash]; cncp = cncp->hash_next, count++) { - if ((CFS_NAMEMATCH(cncp, name, namelen, dcp)) && + if ((CODA_NAMEMATCH(cncp, name, namelen, dcp)) && ((cred == 0) || (cncp->cred == cred))) { /* compare cr_uid instead */ - cfsnc_stat.Search_len += count; + coda_nc_stat.Search_len += count; return(cncp); } #ifdef DEBUG - else if (CFS_NAMEMATCH(cncp, name, namelen, dcp)) { - printf("cfsnc_find: name %s, new cred = %p, cred = %p\n", + else if (CODA_NAMEMATCH(cncp, name, namelen, dcp)) { + printf("coda_nc_find: name %s, new cred = %p, cred = %p\n", name, cred, cncp->cred); printf("nref %d, nuid %d, ngid %d // oref %d, ocred %d, ogid %d\n", cred->cr_ref, cred->cr_uid, cred->cr_gid, @@ -345,7 +341,7 @@ cfsnc_find(dcp, name, namelen, cred, hash) #endif } - return((struct cfscache *)0); + return((struct coda_cache *)0); } /* @@ -353,52 +349,52 @@ cfsnc_find(dcp, name, namelen, cred, hash) * LRU and Hash as needed. */ void -cfsnc_enter(dcp, name, namelen, cred, cp) +coda_nc_enter(dcp, name, namelen, cred, cp) struct cnode *dcp; const char *name; int namelen; struct ucred *cred; struct cnode *cp; { - struct cfscache *cncp; + struct coda_cache *cncp; int hash; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ENTER, + CODA_NC_DEBUG(CODA_NC_ENTER, myprintf(("Enter: dcp %p cp %p name %s cred %p \n", dcp, cp, name, cred)); ) - if (namelen > CFSNC_NAMELEN) { - CFSNC_DEBUG(CFSNC_ENTER, + if (namelen > CODA_NC_NAMELEN) { + CODA_NC_DEBUG(CODA_NC_ENTER, myprintf(("long name enter %s\n",name));) - cfsnc_stat.long_name_enters++; /* record stats */ + coda_nc_stat.long_name_enters++; /* record stats */ return; } - hash = CFSNC_HASH(name, namelen, dcp); - cncp = cfsnc_find(dcp, name, namelen, cred, hash); - if (cncp != (struct cfscache *) 0) { - cfsnc_stat.dbl_enters++; /* duplicate entry */ + hash = CODA_NC_HASH(name, namelen, dcp); + cncp = coda_nc_find(dcp, name, namelen, cred, hash); + if (cncp != (struct coda_cache *) 0) { + coda_nc_stat.dbl_enters++; /* duplicate entry */ return; } - cfsnc_stat.enters++; /* record the enters statistic */ + coda_nc_stat.enters++; /* record the enters statistic */ /* Grab the next element in the lru chain */ - cncp = CFSNC_LRUGET(cfsnc_lru); + cncp = CODA_NC_LRUGET(coda_nc_lru); - CFSNC_LRUREM(cncp); /* remove it from the lists */ + CODA_NC_LRUREM(cncp); /* remove it from the lists */ - if (CFSNC_VALID(cncp)) { + if (CODA_NC_VALID(cncp)) { /* Seems really ugly, but we have to decrement the appropriate hash bucket length here, so we have to find the hash bucket */ - cfsnchash[CFSNC_HASH(cncp->name, cncp->namelen, cncp->dcp)].length--; + coda_nc_hash[CODA_NC_HASH(cncp->name, cncp->namelen, cncp->dcp)].length--; - cfsnc_stat.lru_rm++; /* zapped a valid entry */ - CFSNC_HSHREM(cncp); + coda_nc_stat.lru_rm++; /* zapped a valid entry */ + CODA_NC_HSHREM(cncp); vrele(CTOV(cncp->dcp)); vrele(CTOV(cncp->cp)); crfree(cncp->cred); @@ -419,11 +415,11 @@ cfsnc_enter(dcp, name, namelen, cred, cp) /* Insert into the lru and hash chains. */ - CFSNC_LRUINS(cncp, &cfsnc_lru); - CFSNC_HSHINS(cncp, &cfsnchash[hash]); - cfsnchash[hash].length++; /* Used for tuning */ + CODA_NC_LRUINS(cncp, &coda_nc_lru); + CODA_NC_HSHINS(cncp, &coda_nc_hash[hash]); + coda_nc_hash[hash].length++; /* Used for tuning */ - CFSNC_DEBUG(CFSNC_PRINTCFSNC, print_cfsnc(); ) + CODA_NC_DEBUG(CODA_NC_PRINTCODA_NC, print_coda_nc(); ) } /* @@ -431,22 +427,22 @@ cfsnc_enter(dcp, name, namelen, cred, cp) * matches the input, return it, otherwise return 0 */ struct cnode * -cfsnc_lookup(dcp, name, namelen, cred) +coda_nc_lookup(dcp, name, namelen, cred) struct cnode *dcp; const char *name; int namelen; struct ucred *cred; { int hash; - struct cfscache *cncp; + struct coda_cache *cncp; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return((struct cnode *) 0); - if (namelen > CFSNC_NAMELEN) { - CFSNC_DEBUG(CFSNC_LOOKUP, + if (namelen > CODA_NC_NAMELEN) { + CODA_NC_DEBUG(CODA_NC_LOOKUP, myprintf(("long name lookup %s\n",name));) - cfsnc_stat.long_name_lookups++; /* record stats */ + coda_nc_stat.long_name_lookups++; /* record stats */ return((struct cnode *) 0); } @@ -455,25 +451,25 @@ cfsnc_lookup(dcp, name, namelen, cred) the correct cred. */ - hash = CFSNC_HASH(name, namelen, dcp); - cncp = cfsnc_find(dcp, name, namelen, cred, hash); - if (cncp == (struct cfscache *) 0) { - cfsnc_stat.misses++; /* record miss */ + hash = CODA_NC_HASH(name, namelen, dcp); + cncp = coda_nc_find(dcp, name, namelen, cred, hash); + if (cncp == (struct coda_cache *) 0) { + coda_nc_stat.misses++; /* record miss */ return((struct cnode *) 0); } - cfsnc_stat.hits++; + coda_nc_stat.hits++; /* put this entry at the end of the LRU */ - CFSNC_LRUREM(cncp); - CFSNC_LRUINS(cncp, &cfsnc_lru); + CODA_NC_LRUREM(cncp); + CODA_NC_LRUINS(cncp, &coda_nc_lru); /* move it to the front of the hash chain */ /* don't need to change the hash bucket length */ - CFSNC_HSHREM(cncp); - CFSNC_HSHINS(cncp, &cfsnchash[hash]); + CODA_NC_HSHREM(cncp); + CODA_NC_HSHINS(cncp, &coda_nc_hash[hash]); - CFSNC_DEBUG(CFSNC_LOOKUP, + CODA_NC_DEBUG(CODA_NC_LOOKUP, printf("lookup: dcp %p, name %s, cred %p = cp %p\n", dcp, name, cred, cncp->cp); ) @@ -481,8 +477,8 @@ cfsnc_lookup(dcp, name, namelen, cred) } static void -cfsnc_remove(cncp, dcstat) - struct cfscache *cncp; +coda_nc_remove(cncp, dcstat) + struct coda_cache *cncp; enum dc_status dcstat; { /* @@ -490,14 +486,14 @@ cfsnc_remove(cncp, dcstat) * remove it from it's hash chain, and * place it at the head of the lru list. */ - CFSNC_DEBUG(CFSNC_REMOVE, - myprintf(("cfsnc_remove %s from parent %lx.%lx.%lx\n", + CODA_NC_DEBUG(CODA_NC_REMOVE, + myprintf(("coda_nc_remove %s from parent %lx.%lx.%lx\n", cncp->name, (cncp->dcp)->c_fid.Volume, (cncp->dcp)->c_fid.Vnode, (cncp->dcp)->c_fid.Unique));) - CFSNC_HSHREM(cncp); + CODA_NC_HSHREM(cncp); - CFSNC_HSHNUL(cncp); /* have it be a null chain */ + CODA_NC_HSHNUL(cncp); /* have it be a null chain */ if ((dcstat == IS_DOWNCALL) && (CTOV(cncp->dcp)->v_usecount == 1)) { cncp->dcp->c_flags |= C_PURGING; } @@ -513,15 +509,15 @@ cfsnc_remove(cncp, dcstat) /* Put the null entry just after the least-recently-used entry */ /* LRU_TOP adjusts the pointer to point to the top of the structure. */ - CFSNC_LRUREM(cncp); - CFSNC_LRUINS(cncp, LRU_TOP(cfsnc_lru.lru_prev)); + CODA_NC_LRUREM(cncp); + CODA_NC_LRUINS(cncp, LRU_TOP(coda_nc_lru.lru_prev)); } /* * Remove all entries with a parent which has the input fid. */ void -cfsnc_zapParentfid(fid, dcstat) +coda_nc_zapParentfid(fid, dcstat) ViceFid *fid; enum dc_status dcstat; { @@ -530,34 +526,34 @@ cfsnc_zapParentfid(fid, dcstat) appropriate entries. The later may be acceptable since I don't think callbacks or whatever Case 1 covers are frequent occurences. */ - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPPFID, + CODA_NC_DEBUG(CODA_NC_ZAPPFID, myprintf(("ZapParent: fid 0x%lx, 0x%lx, 0x%lx \n", fid->Volume, fid->Vnode, fid->Unique)); ) - cfsnc_stat.zapPfids++; + coda_nc_stat.zapPfids++; - for (i = 0; i < cfsnc_hashsize; i++) { + for (i = 0; i < coda_nc_hashsize; i++) { /* * Need to save the hash_next pointer in case we remove the * entry. remove causes hash_next to point to itself. */ - for (cncp = cfsnchash[i].hash_next; - cncp != (struct cfscache *)&cfsnchash[i]; + for (cncp = coda_nc_hash[i].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[i]; cncp = ncncp) { ncncp = cncp->hash_next; if ((cncp->dcp->c_fid.Volume == fid->Volume) && (cncp->dcp->c_fid.Vnode == fid->Vnode) && (cncp->dcp->c_fid.Unique == fid->Unique)) { - cfsnchash[i].length--; /* Used for tuning */ - cfsnc_remove(cncp, dcstat); + coda_nc_hash[i].length--; /* Used for tuning */ + coda_nc_remove(cncp, dcstat); } } } @@ -568,35 +564,35 @@ cfsnc_zapParentfid(fid, dcstat) * Remove all entries which have the same fid as the input */ void -cfsnc_zapfid(fid, dcstat) +coda_nc_zapfid(fid, dcstat) ViceFid *fid; enum dc_status dcstat; { /* See comment for zapParentfid. This routine will be used if attributes are being cached. */ - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPFID, + CODA_NC_DEBUG(CODA_NC_ZAPFID, myprintf(("Zapfid: fid 0x%lx, 0x%lx, 0x%lx \n", fid->Volume, fid->Vnode, fid->Unique)); ) - cfsnc_stat.zapFids++; + coda_nc_stat.zapFids++; - for (i = 0; i < cfsnc_hashsize; i++) { - for (cncp = cfsnchash[i].hash_next; - cncp != (struct cfscache *)&cfsnchash[i]; + for (i = 0; i < coda_nc_hashsize; i++) { + for (cncp = coda_nc_hash[i].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[i]; cncp = ncncp) { ncncp = cncp->hash_next; if ((cncp->cp->c_fid.Volume == fid->Volume) && (cncp->cp->c_fid.Vnode == fid->Vnode) && (cncp->cp->c_fid.Unique == fid->Unique)) { - cfsnchash[i].length--; /* Used for tuning */ - cfsnc_remove(cncp, dcstat); + coda_nc_hash[i].length--; /* Used for tuning */ + coda_nc_remove(cncp, dcstat); } } } @@ -606,7 +602,7 @@ cfsnc_zapfid(fid, dcstat) * Remove all entries which match the fid and the cred */ void -cfsnc_zapvnode(fid, cred, dcstat) +coda_nc_zapvnode(fid, cred, dcstat) ViceFid *fid; struct ucred *cred; enum dc_status dcstat; @@ -615,10 +611,10 @@ cfsnc_zapvnode(fid, cred, dcstat) want to zap a file with a specific cred from the kernel. We'll leave this one unimplemented. */ - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPVNODE, + CODA_NC_DEBUG(CODA_NC_ZAPVNODE, myprintf(("Zapvnode: fid 0x%lx, 0x%lx, 0x%lx cred %p\n", fid->Volume, fid->Vnode, fid->Unique, cred)); ) @@ -628,7 +624,7 @@ cfsnc_zapvnode(fid, cred, dcstat) * Remove all entries which have the (dir vnode, name) pair */ void -cfsnc_zapfile(dcp, name, namelen) +coda_nc_zapfile(dcp, name, namelen) struct cnode *dcp; const char *name; int namelen; @@ -636,31 +632,31 @@ cfsnc_zapfile(dcp, name, namelen) /* use the hash function to locate the file, then zap all entries of it regardless of the cred. */ - struct cfscache *cncp; + struct coda_cache *cncp; int hash; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPFILE, + CODA_NC_DEBUG(CODA_NC_ZAPFILE, myprintf(("Zapfile: dcp %p name %s \n", dcp, name)); ) - if (namelen > CFSNC_NAMELEN) { - cfsnc_stat.long_remove++; /* record stats */ + if (namelen > CODA_NC_NAMELEN) { + coda_nc_stat.long_remove++; /* record stats */ return; } - cfsnc_stat.zapFile++; + coda_nc_stat.zapFile++; - hash = CFSNC_HASH(name, namelen, dcp); - cncp = cfsnc_find(dcp, name, namelen, 0, hash); + hash = CODA_NC_HASH(name, namelen, dcp); + cncp = coda_nc_find(dcp, name, namelen, 0, hash); while (cncp) { - cfsnchash[hash].length--; /* Used for tuning */ + coda_nc_hash[hash].length--; /* Used for tuning */ - cfsnc_remove(cncp, NOT_DOWNCALL); - cncp = cfsnc_find(dcp, name, namelen, 0, hash); + coda_nc_remove(cncp, NOT_DOWNCALL); + cncp = coda_nc_find(dcp, name, namelen, 0, hash); } } @@ -669,7 +665,7 @@ cfsnc_zapfile(dcp, name, namelen) * A user is determined by his/her effective user id (id_uid). */ void -cfsnc_purge_user(uid, dcstat) +coda_nc_purge_user(uid, dcstat) vuid_t uid; enum dc_status dcstat; { @@ -681,30 +677,30 @@ cfsnc_purge_user(uid, dcstat) * always be full and LRU is more straightforward. */ - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int hash; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_PURGEUSER, + CODA_NC_DEBUG(CODA_NC_PURGEUSER, myprintf(("ZapDude: uid %lx\n", uid)); ) - cfsnc_stat.zapUsers++; + coda_nc_stat.zapUsers++; - for (cncp = CFSNC_LRUGET(cfsnc_lru); - cncp != (struct cfscache *)(&cfsnc_lru); + for (cncp = CODA_NC_LRUGET(coda_nc_lru); + cncp != (struct coda_cache *)(&coda_nc_lru); cncp = ncncp) { - ncncp = CFSNC_LRUGET(*cncp); + ncncp = CODA_NC_LRUGET(*cncp); - if ((CFSNC_VALID(cncp)) && + if ((CODA_NC_VALID(cncp)) && ((cncp->cred)->cr_uid == uid)) { /* Seems really ugly, but we have to decrement the appropriate hash bucket length here, so we have to find the hash bucket */ - hash = CFSNC_HASH(cncp->name, cncp->namelen, cncp->dcp); - cfsnchash[hash].length--; /* For performance tuning */ + hash = CODA_NC_HASH(cncp->name, cncp->namelen, cncp->dcp); + coda_nc_hash[hash].length--; /* For performance tuning */ - cfsnc_remove(cncp, dcstat); + coda_nc_remove(cncp, dcstat); } } } @@ -713,7 +709,7 @@ cfsnc_purge_user(uid, dcstat) * Flush the entire name cache. In response to a flush of the Venus cache. */ void -cfsnc_flush(dcstat) +coda_nc_flush(dcstat) enum dc_status dcstat; { /* One option is to deallocate the current name cache and @@ -727,21 +723,21 @@ cfsnc_flush(dcstat) * I don't use remove since that would rebuild the lru chain * as it went and that seemed unneccesary. */ - struct cfscache *cncp; + struct coda_cache *cncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - cfsnc_stat.Flushes++; + coda_nc_stat.Flushes++; - for (cncp = CFSNC_LRUGET(cfsnc_lru); - cncp != (struct cfscache *)&cfsnc_lru; - cncp = CFSNC_LRUGET(*cncp)) { - if (CFSNC_VALID(cncp)) { + for (cncp = CODA_NC_LRUGET(coda_nc_lru); + cncp != (struct coda_cache *)&coda_nc_lru; + cncp = CODA_NC_LRUGET(*cncp)) { + if (CODA_NC_VALID(cncp)) { - CFSNC_HSHREM(cncp); /* only zero valid nodes */ - CFSNC_HSHNUL(cncp); + CODA_NC_HSHREM(cncp); /* only zero valid nodes */ + CODA_NC_HSHNUL(cncp); if ((dcstat == IS_DOWNCALL) && (CTOV(cncp->dcp)->v_usecount == 1)) { @@ -750,9 +746,9 @@ cfsnc_flush(dcstat) vrele(CTOV(cncp->dcp)); if (CTOV(cncp->cp)->v_flag & VTEXT) { - if (cfs_vmflush(cncp->cp)) - CFSDEBUG(CFS_FLUSH, - myprintf(("cfsnc_flush: (%lx.%lx.%lx) busy\n", cncp->cp->c_fid.Volume, cncp->cp->c_fid.Vnode, cncp->cp->c_fid.Unique)); ) + if (coda_vmflush(cncp->cp)) + CODADEBUG(CODA_FLUSH, + myprintf(("coda_nc_flush: (%lx.%lx.%lx) busy\n", cncp->cp->c_fid.Volume, cncp->cp->c_fid.Vnode, cncp->cp->c_fid.Unique)); ) } if ((dcstat == IS_DOWNCALL) @@ -767,8 +763,8 @@ cfsnc_flush(dcstat) } } - for (i = 0; i < cfsnc_hashsize; i++) - cfsnchash[i].length = 0; + for (i = 0; i < coda_nc_hashsize; i++) + coda_nc_hash[i].length = 0; } /* @@ -779,16 +775,16 @@ cfsnc_flush(dcstat) * This routine should print out all the hash chains to the console. */ void -print_cfsnc(void) +print_coda_nc(void) { int hash; - struct cfscache *cncp; + struct coda_cache *cncp; - for (hash = 0; hash < cfsnc_hashsize; hash++) { + for (hash = 0; hash < coda_nc_hashsize; hash++) { myprintf(("\nhash %d\n",hash)); - for (cncp = cfsnchash[hash].hash_next; - cncp != (struct cfscache *)&cfsnchash[hash]; + for (cncp = coda_nc_hash[hash].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[hash]; cncp = cncp->hash_next) { myprintf(("cp %p dcp %p cred %p name %s\n", cncp->cp, cncp->dcp, @@ -798,42 +794,42 @@ print_cfsnc(void) } void -cfsnc_gather_stats(void) +coda_nc_gather_stats(void) { int i, max = 0, sum = 0, temp, zeros = 0, ave, n; - for (i = 0; i < cfsnc_hashsize; i++) { - if (cfsnchash[i].length) { - sum += cfsnchash[i].length; + for (i = 0; i < coda_nc_hashsize; i++) { + if (coda_nc_hash[i].length) { + sum += coda_nc_hash[i].length; } else { zeros++; } - if (cfsnchash[i].length > max) - max = cfsnchash[i].length; + if (coda_nc_hash[i].length > max) + max = coda_nc_hash[i].length; } /* * When computing the Arithmetic mean, only count slots which * are not empty in the distribution. */ - cfsnc_stat.Sum_bucket_len = sum; - cfsnc_stat.Num_zero_len = zeros; - cfsnc_stat.Max_bucket_len = max; + coda_nc_stat.Sum_bucket_len = sum; + coda_nc_stat.Num_zero_len = zeros; + coda_nc_stat.Max_bucket_len = max; - if ((n = cfsnc_hashsize - zeros) > 0) + if ((n = coda_nc_hashsize - zeros) > 0) ave = sum / n; else ave = 0; sum = 0; - for (i = 0; i < cfsnc_hashsize; i++) { - if (cfsnchash[i].length) { - temp = cfsnchash[i].length - ave; + for (i = 0; i < coda_nc_hashsize; i++) { + if (coda_nc_hash[i].length) { + temp = coda_nc_hash[i].length - ave; sum += temp * temp; } } - cfsnc_stat.Sum2_bucket_len = sum; + coda_nc_stat.Sum2_bucket_len = sum; } /* @@ -843,7 +839,7 @@ cfsnc_gather_stats(void) * is in an improper state (except by turning the cache off). */ int -cfsnc_resize(hashsize, heapsize, dcstat) +coda_nc_resize(hashsize, heapsize, dcstat) int hashsize, heapsize; enum dc_status dcstat; { @@ -851,46 +847,49 @@ cfsnc_resize(hashsize, heapsize, dcstat) return(EINVAL); } - cfsnc_use = 0; /* Turn the cache off */ + coda_nc_use = 0; /* Turn the cache off */ - cfsnc_flush(dcstat); /* free any cnodes in the cache */ + coda_nc_flush(dcstat); /* free any cnodes in the cache */ /* WARNING: free must happen *before* size is reset */ - CFS_FREE(cfsncheap,TOTAL_CACHE_SIZE); - CFS_FREE(cfsnchash,TOTAL_HASH_SIZE); + CODA_FREE(coda_nc_heap,TOTAL_CACHE_SIZE); + CODA_FREE(coda_nc_hash,TOTAL_HASH_SIZE); - cfsnc_hashsize = hashsize; - cfsnc_size = heapsize; + coda_nc_hashsize = hashsize; + coda_nc_size = heapsize; - cfsnc_init(); /* Set up a cache with the new size */ + coda_nc_init(); /* Set up a cache with the new size */ - cfsnc_use = 1; /* Turn the cache back on */ + coda_nc_use = 1; /* Turn the cache back on */ return(0); } -char cfsnc_name_buf[CFS_MAXNAMLEN+1]; +#define DEBUG +#ifdef DEBUG +char coda_nc_name_buf[CODA_MAXNAMLEN+1]; void -cfsnc_name(struct cnode *cp) +coda_nc_name(struct cnode *cp) { - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - for (i = 0; i < cfsnc_hashsize; i++) { - for (cncp = cfsnchash[i].hash_next; - cncp != (struct cfscache *)&cfsnchash[i]; + for (i = 0; i < coda_nc_hashsize; i++) { + for (cncp = coda_nc_hash[i].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[i]; cncp = ncncp) { ncncp = cncp->hash_next; if (cncp->cp == cp) { - bcopy(cncp->name, cfsnc_name_buf, cncp->namelen); - cfsnc_name_buf[cncp->namelen] = 0; + bcopy(cncp->name, coda_nc_name_buf, cncp->namelen); + coda_nc_name_buf[cncp->namelen] = 0; printf(" is %s (%p,%p)@%p", - cfsnc_name_buf, cncp->cp, cncp->dcp, cncp); + coda_nc_name_buf, cncp->cp, cncp->dcp, cncp); } } } } +#endif diff --git a/sys/coda/coda_namecache.h b/sys/coda/coda_namecache.h index d3d8945..8606365 100644 --- a/sys/coda/coda_namecache.h +++ b/sys/coda/coda_namecache.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfsnc.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfsnc.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -47,6 +47,9 @@ /* * HISTORY * $Log: cfsnc.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -63,7 +66,7 @@ * Sync the code for NetBSD -current; test on 1.3 later * * Revision 1.5 98/01/23 11:53:51 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.4.2.1 97/12/16 12:40:23 rvb * Sync with 1.3 @@ -81,7 +84,7 @@ * don't include headers in headers * * Revision 1.3 97/08/05 11:08:19 lily - * Removed cfsnc_replace, replaced it with a cfs_find, unhash, and + * Removed cfsnc_replace, replaced it with a coda_find, unhash, and * rehash. This fixes a cnode leak and a bug in which the fid is * not actually replaced. (cfs_namecache.c, cfsnc.h, cfs_subr.c) * @@ -89,7 +92,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:45 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:22 bnoble * Branch for NetBSD port revisions @@ -98,20 +101,20 @@ * Bump to major revision 3 to prepare for NetBSD port * * Revision 2.2 1994/08/28 19:37:39 luqi - * Add a new CFS_REPLACE call to allow venus to replace a ViceFid in the + * Add a new CODA_REPLACE call to allow venus to replace a ViceFid in the * mini-cache. * * In "cfs.h": - * Add CFS_REPLACE decl. + * Add CODA_REPLACE decl. * * In "cfs_namecache.c": * Add routine cfsnc_replace. * * In "cfs_subr.c": - * Add case-statement to process CFS_REPLACE. + * Add case-statement to process CODA_REPLACE. * * In "cfsnc.h": - * Add decl for CFSNC_REPLACE. + * Add decl for CODA_NC_REPLACE. * * Revision 2.1 94/07/21 16:25:27 satya * Conversion to C++ 3.0; start of Coda Release 2.0 @@ -128,15 +131,15 @@ * * */ -#ifndef _CFSNC_HEADER_ -#define _CFSNC_HEADER_ +#ifndef _CODA_NC_HEADER_ +#define _CODA_NC_HEADER_ /* - * Cfs constants + * Coda constants */ -#define CFSNC_NAMELEN 15 /* longest name stored in cache */ -#define CFSNC_CACHESIZE 256 /* Default cache size */ -#define CFSNC_HASHSIZE 64 /* Must be multiple of 2 */ +#define CODA_NC_NAMELEN 15 /* longest name stored in cache */ +#define CODA_NC_CACHESIZE 256 /* Default cache size */ +#define CODA_NC_HASHSIZE 64 /* Must be multiple of 2 */ /* * Hash function for the primary hash. @@ -148,14 +151,14 @@ */ #ifdef oldhash -#define CFSNC_HASH(name, namelen, cp) \ - ((name[0] + name[namelen-1] + namelen + (int)(cp)) & (cfsnc_hashsize-1)) +#define CODA_NC_HASH(name, namelen, cp) \ + ((name[0] + name[namelen-1] + namelen + (int)(cp)) & (coda_nc_hashsize-1)) #else -#define CFSNC_HASH(name, namelen, cp) \ - ((name[0] + (name[namelen-1]<<4) + namelen + (((int)cp)>>8)) & (cfsnc_hashsize-1)) +#define CODA_NC_HASH(name, namelen, cp) \ + ((name[0] + (name[namelen-1]<<4) + namelen + (((int)cp)>>8)) & (coda_nc_hashsize-1)) #endif -#define CFS_NAMEMATCH(cp, name, namelen, dcp) \ +#define CODA_NAMEMATCH(cp, name, namelen, dcp) \ ((namelen == cp->namelen) && (dcp == cp->dcp) && \ (bcmp(cp->name,name,namelen) == 0)) @@ -165,82 +168,82 @@ * in the list node, thus the trickery for lru. */ -#define CFSNC_HSHINS(elem, pred) insque(elem,pred) -#define CFSNC_HSHREM(elem) remque(elem) -#define CFSNC_HSHNUL(elem) (elem)->hash_next = \ +#define CODA_NC_HSHINS(elem, pred) insque(elem,pred) +#define CODA_NC_HSHREM(elem) remque(elem) +#define CODA_NC_HSHNUL(elem) (elem)->hash_next = \ (elem)->hash_prev = (elem) -#define CFSNC_LRUINS(elem, pred) insque(LRU_PART(elem), LRU_PART(pred)) -#define CFSNC_LRUREM(elem) remque(LRU_PART(elem)); -#define CFSNC_LRUGET(lruhead) LRU_TOP((lruhead).lru_prev) +#define CODA_NC_LRUINS(elem, pred) insque(LRU_PART(elem), LRU_PART(pred)) +#define CODA_NC_LRUREM(elem) remque(LRU_PART(elem)); +#define CODA_NC_LRUGET(lruhead) LRU_TOP((lruhead).lru_prev) -#define CFSNC_VALID(cncp) (cncp->dcp != (struct cnode *)0) +#define CODA_NC_VALID(cncp) (cncp->dcp != (struct cnode *)0) -#define LRU_PART(cncp) (struct cfscache *) \ - ((char *)cncp + (2*sizeof(struct cfscache *))) -#define LRU_TOP(cncp) (struct cfscache *) \ - ((char *)cncp - (2*sizeof(struct cfscache *))) -#define DATA_PART(cncp) (struct cfscache *) \ - ((char *)cncp + (4*sizeof(struct cfscache *))) -#define DATA_SIZE (sizeof(struct cfscache)-(4*sizeof(struct cfscache *))) +#define LRU_PART(cncp) (struct coda_cache *) \ + ((char *)cncp + (2*sizeof(struct coda_cache *))) +#define LRU_TOP(cncp) (struct coda_cache *) \ + ((char *)cncp - (2*sizeof(struct coda_cache *))) +#define DATA_PART(cncp) (struct coda_cache *) \ + ((char *)cncp + (4*sizeof(struct coda_cache *))) +#define DATA_SIZE (sizeof(struct coda_cache)-(4*sizeof(struct coda_cache *))) /* - * Structure for an element in the CFS Name Cache. + * Structure for an element in the CODA Name Cache. * NOTE: I use the position of arguments and their size in the - * implementation of the functions CFSNC_LRUINS, CFSNC_LRUREM, and + * implementation of the functions CODA_NC_LRUINS, CODA_NC_LRUREM, and * DATA_PART. */ -struct cfscache { - struct cfscache *hash_next,*hash_prev; /* Hash list */ - struct cfscache *lru_next, *lru_prev; /* LRU list */ +struct coda_cache { + struct coda_cache *hash_next,*hash_prev; /* Hash list */ + struct coda_cache *lru_next, *lru_prev; /* LRU list */ struct cnode *cp; /* vnode of the file */ struct cnode *dcp; /* parent's cnode */ struct ucred *cred; /* user credentials */ - char name[CFSNC_NAMELEN]; /* segment name */ + char name[CODA_NC_NAMELEN]; /* segment name */ int namelen; /* length of name */ }; -struct cfslru { /* Start of LRU chain */ +struct coda_lru { /* Start of LRU chain */ char *dummy1, *dummy2; /* place holders */ - struct cfscache *lru_next, *lru_prev; /* position of pointers is important */ + struct coda_cache *lru_next, *lru_prev; /* position of pointers is important */ }; -struct cfshash { /* Start of Hash chain */ - struct cfscache *hash_next, *hash_prev; /* NOTE: chain pointers must be first */ +struct coda_hash { /* Start of Hash chain */ + struct coda_cache *hash_next, *hash_prev; /* NOTE: chain pointers must be first */ int length; /* used for tuning purposes */ }; /* * Symbols to aid in debugging the namecache code. Assumes the existence - * of the variable cfsnc_debug, which is defined in cfs_namecache.c + * of the variable coda_nc_debug, which is defined in cfs_namecache.c */ -#define CFSNC_DEBUG(N, STMT) { if (cfsnc_debug & (1 < +#include #include #include @@ -171,11 +174,11 @@ extern int cfsnc_initialized; /* Set if cache has been initialized */ #define CTL_C -int cfs_psdev_print_entry = 0; +int coda_psdev_print_entry = 0; -#define ENTRY if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) +#define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -void vcfsattach(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); @@ -198,9 +201,9 @@ struct vmsg { #define VM_WRITE 2 #define VM_INTR 4 -/* vcfsattach: do nothing */ +/* vcodaattach: do nothing */ void -vcfsattach(n) +vcodaattach(n) int n; { } @@ -216,13 +219,13 @@ vc_nb_open(dev, flag, mode, p) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - if (!cfsnc_initialized) - cfsnc_init(); + if (!coda_nc_initialized) + coda_nc_init(); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; if (VC_OPEN(vcp)) return(EBUSY); @@ -231,8 +234,8 @@ vc_nb_open(dev, flag, mode, p) INIT_QUEUE(vcp->vc_replys); MARK_VC_OPEN(vcp); - cfs_mnttbl[minor(dev)].mi_vfsp = NULL; - cfs_mnttbl[minor(dev)].mi_rootvp = NULL; + coda_mnttbl[minor(dev)].mi_vfsp = NULL; + coda_mnttbl[minor(dev)].mi_rootvp = NULL; return(0); } @@ -246,15 +249,15 @@ vc_nb_close (dev, flag, mode, p) { register struct vcomm *vcp; register struct vmsg *vmp; - struct cfs_mntinfo *mi; + struct coda_mntinfo *mi; int err; ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - mi = &cfs_mnttbl[minor(dev)]; + mi = &coda_mnttbl[minor(dev)]; vcp = &(mi->mi_vcomm); if (!VC_OPEN(vcp)) @@ -269,7 +272,7 @@ vc_nb_close (dev, flag, mode, p) if (mi->mi_rootvp) { /* Let unmount know this is for real */ VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING; - cfs_unmounting(mi->mi_vfsp); + coda_unmounting(mi->mi_vfsp); err = dounmount(mi->mi_vfsp, flag, p); if (err) myprintf(("Error %d unmounting vfs in vcclose(%d)\n", @@ -283,9 +286,9 @@ vc_nb_close (dev, flag, mode, p) { /* Free signal request messages and don't wakeup cause no one is waiting. */ - if (vmp->vm_opcode == CFS_SIGNAL) { - CFS_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); - CFS_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); + if (vmp->vm_opcode == CODA_SIGNAL) { + CODA_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); + CODA_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); continue; } @@ -315,10 +318,10 @@ vc_nb_read(dev, uiop, flag) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; /* Get message at head of request queue. */ if (EMPTY(vcp->vc_requests)) return(0); /* Nothing to read */ @@ -342,12 +345,12 @@ vc_nb_read(dev, uiop, flag) /* If request was a signal, free up the message and don't enqueue it in the reply queue. */ - if (vmp->vm_opcode == CFS_SIGNAL) { - if (cfsdebug) + if (vmp->vm_opcode == CODA_SIGNAL) { + if (codadebug) myprintf(("vcread: signal msg (%d, %d)\n", vmp->vm_opcode, vmp->vm_unique)); - CFS_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); - CFS_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); + CODA_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); + CODA_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); return(error); } @@ -365,7 +368,7 @@ vc_nb_write(dev, uiop, flag) { register struct vcomm * vcp; register struct vmsg *vmp; - struct cfs_out_hdr *out; + struct coda_out_hdr *out; u_long seq; u_long opcode; int buf[2]; @@ -373,10 +376,10 @@ vc_nb_write(dev, uiop, flag) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; /* Peek at the opcode, unique without transfering the data. */ uiop->uio_rw = UIO_WRITE; @@ -389,7 +392,7 @@ vc_nb_write(dev, uiop, flag) opcode = buf[0]; seq = buf[1]; - if (cfsdebug) + if (codadebug) myprintf(("vcwrite got a call for %ld.%ld\n", opcode, seq)); if (DOWNCALL(opcode)) { @@ -397,7 +400,7 @@ vc_nb_write(dev, uiop, flag) /* get the rest of the data. */ uiop->uio_rw = UIO_WRITE; - error = uiomove((caddr_t)&pbuf.cfs_purgeuser.oh.result, sizeof(pbuf) - (sizeof(int)*2), uiop); + error = uiomove((caddr_t)&pbuf.coda_purgeuser.oh.result, sizeof(pbuf) - (sizeof(int)*2), uiop); if (error) { myprintf(("vcwrite: error (%d) on uiomove (Op %ld seq %ld)\n", error, opcode, seq)); @@ -416,7 +419,7 @@ vc_nb_write(dev, uiop, flag) } if (EOQ(vmp, vcp->vc_replys)) { - if (cfsdebug) + if (codadebug) myprintf(("vcwrite: msg (%ld, %ld) not found\n", opcode, seq)); return(ESRCH); @@ -426,7 +429,7 @@ vc_nb_write(dev, uiop, flag) REMQUE(vmp->vm_chain); /* move data into response buffer. */ - out = (struct cfs_out_hdr *)vmp->vm_data; + out = (struct coda_out_hdr *)vmp->vm_data; /* Don't need to copy opcode and uniquifier. */ /* get the rest of the data. */ @@ -468,22 +471,22 @@ vc_nb_ioctl(dev, cmd, addr, flag, p) ENTRY; switch(cmd) { - case CFSRESIZE: { - struct cfs_resize *data = (struct cfs_resize *)addr; - return(cfsnc_resize(data->hashsize, data->heapsize, IS_DOWNCALL)); + case CODARESIZE: { + struct coda_resize *data = (struct coda_resize *)addr; + return(coda_nc_resize(data->hashsize, data->heapsize, IS_DOWNCALL)); break; } - case CFSSTATS: - if (cfsnc_use) { - cfsnc_gather_stats(); + case CODASTATS: + if (coda_nc_use) { + coda_nc_gather_stats(); return(0); } else { return(ENODEV); } break; - case CFSPRINT: - if (cfsnc_use) { - print_cfsnc(); + case CODAPRINT: + if (coda_nc_use) { + print_coda_nc(); return(0); } else { return(ENODEV); @@ -506,10 +509,10 @@ vc_nb_poll(dev, events, p) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; event_msk = events & (POLLIN|POLLRDNORM); if (!event_msk) @@ -526,7 +529,7 @@ vc_nb_poll(dev, events, p) /* * Statistics */ -struct cfs_clstat cfs_clstat; +struct coda_clstat coda_clstat; /* * Key question: whether to sleep interuptably or uninteruptably when @@ -537,15 +540,15 @@ struct cfs_clstat cfs_clstat; * (e.g. kill -9). */ -int cfscall_sleep = PZERO - 1; +int coda_call_sleep = PZERO - 1; #ifdef CTL_C -int cfs_pcatch = PCATCH; +int coda_pcatch = PCATCH; #else #endif int -cfscall(mntinfo, inSize, outSize, buffer) - struct cfs_mntinfo *mntinfo; int inSize; int *outSize; caddr_t buffer; +coda_call(mntinfo, inSize, outSize, buffer) + struct coda_mntinfo *mntinfo; int inSize; int *outSize; caddr_t buffer; { struct vcomm *vcp; struct vmsg *vmp; @@ -562,27 +565,27 @@ cfscall(mntinfo, inSize, outSize, buffer) vcp = &(mntinfo->mi_vcomm); - cfs_clstat.ncalls++; - cfs_clstat.reqs[((struct cfs_in_hdr *)buffer)->opcode]++; + coda_clstat.ncalls++; + coda_clstat.reqs[((struct coda_in_hdr *)buffer)->opcode]++; if (!VC_OPEN(vcp)) return(ENODEV); - CFS_ALLOC(vmp,struct vmsg *,sizeof(struct vmsg)); + CODA_ALLOC(vmp,struct vmsg *,sizeof(struct vmsg)); /* Format the request message. */ vmp->vm_data = buffer; vmp->vm_flags = 0; vmp->vm_inSize = inSize; vmp->vm_outSize = *outSize ? *outSize : inSize; /* |buffer| >= inSize */ - vmp->vm_opcode = ((struct cfs_in_hdr *)buffer)->opcode; + vmp->vm_opcode = ((struct coda_in_hdr *)buffer)->opcode; vmp->vm_unique = ++vcp->vc_seq; - if (cfsdebug) + if (codadebug) myprintf(("Doing a call for %d.%d\n", vmp->vm_opcode, vmp->vm_unique)); /* Fill in the common input args. */ - ((struct cfs_in_hdr *)buffer)->unique = vmp->vm_unique; + ((struct coda_in_hdr *)buffer)->unique = vmp->vm_unique; /* Append msg to request queue and poke Venus. */ INSQUE(vmp->vm_chain, vcp->vc_requests); @@ -599,7 +602,7 @@ cfscall(mntinfo, inSize, outSize, buffer) /* Ignore return, We have to check anyway */ #ifdef CTL_C - /* This is work in progress. Setting cfs_pcatch lets tsleep reawaken + /* This is work in progress. Setting coda_pcatch lets tsleep reawaken on a ^c or ^z. The problem is that emacs sets certain interrupts as SA_RESTART. This means that we should exit sleep handle the "signal" and then go to sleep again. Mostly this is done by letting @@ -608,29 +611,29 @@ cfscall(mntinfo, inSize, outSize, buffer) */ i = 0; do { - error = tsleep(&vmp->vm_sleep, (cfscall_sleep|cfs_pcatch), "cfscall", hz*2); + error = tsleep(&vmp->vm_sleep, (coda_call_sleep|coda_pcatch), "coda_call", hz*2); if (error == 0) break; else if (error == EWOULDBLOCK) { - printf("cfscall: tsleep TIMEOUT %d sec\n", 2+2*i); + printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i); } else if (p->p_siglist == sigmask(SIGIO)) { p->p_sigmask |= p->p_siglist; - printf("cfscall: tsleep returns %d SIGIO, cnt %d\n", error, i); + printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); } else { - printf("cfscall: tsleep returns %d, cnt %d\n", error, i); - printf("cfscall: siglist = %x, sigmask = %x, mask %x\n", + 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; p->p_sigmask |= p->p_siglist; - printf("cfscall: 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); } } while (error && i++ < 128); p->p_sigmask = psig_omask; #else - (void) tsleep(&vmp->vm_sleep, cfscall_sleep, "cfscall", 0); + (void) tsleep(&vmp->vm_sleep, coda_call_sleep, "coda_call", 0); #endif if (VC_OPEN(vcp)) { /* Venus is still alive */ /* Op went through, interrupt or not... */ @@ -641,7 +644,7 @@ cfscall(mntinfo, inSize, outSize, buffer) else if (!(vmp->vm_flags & VM_READ)) { /* Interrupted before venus read it. */ - if (cfsdebug||1) + if (codadebug||1) myprintf(("interrupted before read: op = %d.%d, flags = %x\n", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); REMQUE(vmp->vm_chain); @@ -652,29 +655,29 @@ cfscall(mntinfo, inSize, outSize, buffer) /* (!(vmp->vm_flags & VM_WRITE)) means interrupted after upcall started */ /* Interrupted after start of upcall, send venus a signal */ - struct cfs_in_hdr *dog; + struct coda_in_hdr *dog; struct vmsg *svmp; - if (cfsdebug||1) + if (codadebug||1) myprintf(("Sending Venus a signal: op = %d.%d, flags = %x\n", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); REMQUE(vmp->vm_chain); error = EINTR; - CFS_ALLOC(svmp, struct vmsg *, sizeof (struct vmsg)); + CODA_ALLOC(svmp, struct vmsg *, sizeof (struct vmsg)); - CFS_ALLOC((svmp->vm_data), char *, sizeof (struct cfs_in_hdr)); - dog = (struct cfs_in_hdr *)svmp->vm_data; + CODA_ALLOC((svmp->vm_data), char *, sizeof (struct coda_in_hdr)); + dog = (struct coda_in_hdr *)svmp->vm_data; svmp->vm_flags = 0; - dog->opcode = svmp->vm_opcode = CFS_SIGNAL; + dog->opcode = svmp->vm_opcode = CODA_SIGNAL; dog->unique = svmp->vm_unique = vmp->vm_unique; - svmp->vm_inSize = sizeof (struct cfs_in_hdr); -/*??? rvb */ svmp->vm_outSize = sizeof (struct cfs_in_hdr); + svmp->vm_inSize = sizeof (struct coda_in_hdr); +/*??? rvb */ svmp->vm_outSize = sizeof (struct coda_in_hdr); - if (cfsdebug) - myprintf(("cfscall: enqueing signal msg (%d, %d)\n", + if (codadebug) + myprintf(("coda_call: enqueing signal msg (%d, %d)\n", svmp->vm_opcode, svmp->vm_unique)); /* insert at head of queue! */ @@ -684,16 +687,16 @@ cfscall(mntinfo, inSize, outSize, buffer) } else { /* If venus died (!VC_OPEN(vcp)) */ - if (cfsdebug) + if (codadebug) myprintf(("vcclose woke op %d.%d flags %d\n", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); error = ENODEV; } - CFS_FREE(vmp, sizeof(struct vmsg)); + CODA_FREE(vmp, sizeof(struct vmsg)); if (!error) - error = ((struct cfs_out_hdr *)buffer)->result; + error = ((struct coda_out_hdr *)buffer)->result; return(error); } diff --git a/sys/coda/coda_subr.c b/sys/coda/coda_subr.c index 5a55e8a..3e6472d 100644 --- a/sys/coda/coda_subr.c +++ b/sys/coda/coda_subr.c @@ -68,7 +68,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.7 98/01/23 11:53:42 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.6.2.3 98/01/23 11:21:05 rvb * Sync with 2.2.5 @@ -108,7 +108,7 @@ * >64Meg; venus can be killed! * * Revision 1.5 97/08/05 11:08:17 lily - * Removed cfsnc_replace, replaced it with a cfs_find, unhash, and + * Removed cfsnc_replace, replaced it with a coda_find, unhash, and * rehash. This fixes a cnode leak and a bug in which the fid is * not actually replaced. (cfs_namecache.c, cfsnc.h, cfs_subr.c) * @@ -123,7 +123,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:27 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:07:59 bnoble * Branch for NetBSD port revisions @@ -161,7 +161,7 @@ * * Revision 2.4 92/09/30 14:16:26 mja * Incorporated Dave Steere's fix for the GNU-Emacs bug. - * Also, included his cfs_flush routine in place of the former cfsnc_flush. + * Also, included his coda_flush routine in place of the former coda_nc_flush. * [91/02/07 jjk] * * Added contributors blurb. @@ -196,17 +196,17 @@ */ /* NOTES: rvb - * 1. Added cfs_unmounting to mark all cnodes as being UNMOUNTING. This has to + * 1. Added coda_unmounting to mark all cnodes as being UNMOUNTING. This has to * be done before dounmount is called. Because some of the routines that - * dounmount calls before cfs_unmounted might try to force flushes to venus. + * dounmount calls before coda_unmounted might try to force flushes to venus. * The vnode pager does this. - * 2. cfs_unmounting marks all cnodes scanning cfs_cache. + * 2. coda_unmounting marks all cnodes scanning coda_cache. * 3. cfs_checkunmounting (under DEBUG) checks all cnodes by chasing the vnodes * under the /coda mount point. - * 4. cfs_cacheprint (under DEBUG) prints names with vnode/cnode address + * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address */ -#include +#include #include #include @@ -220,14 +220,14 @@ #include #include -int cfs_active = 0; -int cfs_reuse = 0; -int cfs_new = 0; +int coda_active = 0; +int coda_reuse = 0; +int coda_new = 0; -struct cnode *cfs_freelist = NULL; -struct cnode *cfs_cache[CFS_CACHESIZE]; +struct cnode *coda_freelist = NULL; +struct cnode *coda_cache[CODA_CACHESIZE]; -#define cfshash(fid) (((fid)->Volume + (fid)->Vnode) & (CFS_CACHESIZE-1)) +#define coda_hash(fid) (((fid)->Volume + (fid)->Vnode) & (CODA_CACHESIZE-1)) #define CNODE_NEXT(cp) ((cp)->c_next) #define ODD(vnode) ((vnode) & 0x1) @@ -235,22 +235,22 @@ struct cnode *cfs_cache[CFS_CACHESIZE]; * Allocate a cnode. */ struct cnode * -cfs_alloc(void) +coda_alloc(void) { struct cnode *cp; - if (cfs_freelist) { - cp = cfs_freelist; - cfs_freelist = CNODE_NEXT(cp); - cfs_reuse++; + if (coda_freelist) { + cp = coda_freelist; + coda_freelist = CNODE_NEXT(cp); + coda_reuse++; } else { - CFS_ALLOC(cp, struct cnode *, sizeof(struct cnode)); + CODA_ALLOC(cp, struct cnode *, sizeof(struct cnode)); /* NetBSD vnodes don't have any Pager info in them ('cause there are no external pagers, duh!) */ #define VNODE_VM_INFO_INIT(vp) /* MT */ VNODE_VM_INFO_INIT(CTOV(cp)); - cfs_new++; + coda_new++; } bzero(cp, sizeof (struct cnode)); @@ -261,40 +261,40 @@ cfs_alloc(void) * Deallocate a cnode. */ void -cfs_free(cp) +coda_free(cp) register struct cnode *cp; { - CNODE_NEXT(cp) = cfs_freelist; - cfs_freelist = cp; + CNODE_NEXT(cp) = coda_freelist; + coda_freelist = cp; } /* * Put a cnode in the hash table */ void -cfs_save(cp) +coda_save(cp) struct cnode *cp; { - CNODE_NEXT(cp) = cfs_cache[cfshash(&cp->c_fid)]; - cfs_cache[cfshash(&cp->c_fid)] = cp; + CNODE_NEXT(cp) = coda_cache[coda_hash(&cp->c_fid)]; + coda_cache[coda_hash(&cp->c_fid)] = cp; } /* * Remove a cnode from the hash table */ void -cfs_unsave(cp) +coda_unsave(cp) struct cnode *cp; { struct cnode *ptr; struct cnode *ptrprev = NULL; - ptr = cfs_cache[cfshash(&cp->c_fid)]; + ptr = coda_cache[coda_hash(&cp->c_fid)]; while (ptr != NULL) { if (ptr == cp) { if (ptrprev == NULL) { - cfs_cache[cfshash(&cp->c_fid)] + coda_cache[coda_hash(&cp->c_fid)] = CNODE_NEXT(ptr); } else { CNODE_NEXT(ptrprev) = CNODE_NEXT(ptr); @@ -313,19 +313,19 @@ cfs_unsave(cp) * NOTE: this allows multiple cnodes with same fid -- dcs 1/25/95 */ struct cnode * -cfs_find(fid) +coda_find(fid) ViceFid *fid; { struct cnode *cp; - cp = cfs_cache[cfshash(fid)]; + cp = coda_cache[coda_hash(fid)]; while (cp) { if ((cp->c_fid.Vnode == fid->Vnode) && (cp->c_fid.Volume == fid->Volume) && (cp->c_fid.Unique == fid->Unique) && (!IS_UNMOUNTING(cp))) { - cfs_active++; + coda_active++; return(cp); } cp = CNODE_NEXT(cp); @@ -334,16 +334,16 @@ cfs_find(fid) } /* - * cfs_kill is called as a side effect to vcopen. To prevent any + * coda_kill is called as a side effect to vcopen. To prevent any * cnodes left around from an earlier run of a venus or warden from * causing problems with the new instance, mark any outstanding cnodes * as dying. Future operations on these cnodes should fail (excepting - * cfs_inactive of course!). Since multiple venii/wardens can be + * coda_inactive of course!). Since multiple venii/wardens can be * running, only kill the cnodes for a particular entry in the - * cfs_mnttbl. -- DCS 12/1/94 */ + * coda_mnttbl. -- DCS 12/1/94 */ int -cfs_kill(whoIam, dcstat) +coda_kill(whoIam, dcstat) struct mount *whoIam; enum dc_status dcstat; { @@ -361,16 +361,16 @@ cfs_kill(whoIam, dcstat) /* This is slightly overkill, but should work. Eventually it'd be * nice to only flush those entries from the namecache that * reference a vnode in this vfs. */ - cfsnc_flush(dcstat); + coda_nc_flush(dcstat); - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (CTOV(cp)->v_mount == whoIam) { #ifdef DEBUG - printf("cfs_kill: vp %p, cp %p\n", CTOV(cp), cp); + printf("coda_kill: vp %p, cp %p\n", CTOV(cp), cp); #endif count++; - CFSDEBUG(CFS_FLUSH, + CODADEBUG(CODA_FLUSH, myprintf(("Live cnode fid %lx.%lx.%lx flags %d count %d\n", (cp->c_fid).Volume, (cp->c_fid).Vnode, @@ -388,21 +388,21 @@ cfs_kill(whoIam, dcstat) * name cache or it may be executing. */ void -cfs_flush(dcstat) +coda_flush(dcstat) enum dc_status dcstat; { int hash; struct cnode *cp; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_FLUSH]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_FLUSH]++; - cfsnc_flush(dcstat); /* flush files from the name cache */ + coda_nc_flush(dcstat); /* flush files from the name cache */ - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (!ODD(cp->c_fid.Vnode)) /* only files can be executed */ - cfs_vmflush(cp); + coda_vmflush(cp); } } } @@ -412,13 +412,13 @@ cfs_flush(dcstat) * name cache flush. */ void -cfs_testflush(void) +coda_testflush(void) { int hash; struct cnode *cp; - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { myprintf(("Live cnode fid %lx.%lx.%lx count %d\n", @@ -435,17 +435,17 @@ cfs_testflush(void) * */ void -cfs_unmounting(whoIam) +coda_unmounting(whoIam) struct mount *whoIam; { int hash; struct cnode *cp; - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (CTOV(cp)->v_mount == whoIam) { if (cp->c_flags & (C_LOCKED|C_WANTED)) { - printf("cfs_unmounting: Unlocking %p\n", cp); + printf("coda_unmounting: Unlocking %p\n", cp); cp->c_flags &= ~(C_LOCKED|C_WANTED); wakeup((caddr_t) cp); } @@ -456,8 +456,7 @@ cfs_unmounting(whoIam) } #ifdef DEBUG -void -cfs_checkunmounting(mp) +coda_checkunmounting(mp) struct mount *mp; { register struct vnode *vp, *nvp; @@ -478,29 +477,29 @@ loop: } } -void -cfs_cacheprint(whoIam) +int +coda_cacheprint(whoIam) struct mount *whoIam; { int hash; struct cnode *cp; int count = 0; - printf("cfs_cacheprint: cfs_ctlvp %p, cp %p", cfs_ctlvp, VTOC(cfs_ctlvp)); - cfsnc_name(VTOC(cfs_ctlvp)); + printf("coda_cacheprint: coda_ctlvp %p, cp %p", coda_ctlvp, VTOC(coda_ctlvp)); + coda_nc_name(coda_ctlvp); printf("\n"); - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (CTOV(cp)->v_mount == whoIam) { - printf("cfs_cacheprint: vp %p, cp %p", CTOV(cp), cp); - cfsnc_name(cp); + printf("coda_cacheprint: vp %p, cp %p", CTOV(cp), cp); + coda_nc_name(cp); printf("\n"); count++; } } } - printf("cfs_cacheprint: count %d\n", count); + printf("coda_cacheprint: count %d\n", count); } #endif @@ -508,17 +507,17 @@ cfs_cacheprint(whoIam) * There are 6 cases where invalidations occur. The semantics of each * is listed here. * - * CFS_FLUSH -- flush all entries from the name cache and the cnode cache. - * CFS_PURGEUSER -- flush all entries from the name cache for a specific user + * CODA_FLUSH -- flush all entries from the name cache and the cnode cache. + * CODA_PURGEUSER -- flush all entries from the name cache for a specific user * This call is a result of token expiration. * * The next two are the result of callbacks on a file or directory. - * CFS_ZAPDIR -- flush the attributes for the dir from its cnode. + * CODA_ZAPDIR -- flush the attributes for the dir from its cnode. * Zap all children of this directory from the namecache. - * CFS_ZAPFILE -- flush the attributes for a file. + * CODA_ZAPFILE -- flush the attributes for a file. * * The fifth is a result of Venus detecting an inconsistent file. - * CFS_PURGEFID -- flush the attribute for the file + * CODA_PURGEFID -- flush the attribute for the file * If it is a dir (odd vnode), purge its * children from the namecache * remove the file from the namecache. @@ -526,7 +525,7 @@ cfs_cacheprint(whoIam) * The sixth allows Venus to replace local fids with global ones * during reintegration. * - * CFS_REPLACE -- replace one ViceFid with another throughout the name cache + * CODA_REPLACE -- replace one ViceFid with another throughout the name cache */ int handleDownCall(opcode, out) @@ -536,38 +535,38 @@ int handleDownCall(opcode, out) /* Handle invalidate requests. */ switch (opcode) { - case CFS_FLUSH : { + case CODA_FLUSH : { - cfs_flush(IS_DOWNCALL); + coda_flush(IS_DOWNCALL); - CFSDEBUG(CFS_FLUSH,cfs_testflush();) /* print remaining cnodes */ + CODADEBUG(CODA_FLUSH,coda_testflush();) /* print remaining cnodes */ return(0); } - case CFS_PURGEUSER : { - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_PURGEUSER]++; + case CODA_PURGEUSER : { + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_PURGEUSER]++; /* XXX - need to prevent fsync's */ - cfsnc_purge_user(out->cfs_purgeuser.cred.cr_uid, IS_DOWNCALL); + coda_nc_purge_user(out->coda_purgeuser.cred.cr_uid, IS_DOWNCALL); return(0); } - case CFS_ZAPFILE : { + case CODA_ZAPFILE : { struct cnode *cp; error = 0; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_ZAPFILE]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_ZAPFILE]++; - cp = cfs_find(&out->cfs_zapfile.CodaFid); + cp = coda_find(&out->coda_zapfile.CodaFid); if (cp != NULL) { vref(CTOV(cp)); cp->c_flags &= ~C_VATTR; if (CTOV(cp)->v_flag & VTEXT) - error = cfs_vmflush(cp); - CFSDEBUG(CFS_ZAPFILE, myprintf(("zapfile: fid = (%lx.%lx.%lx), + error = coda_vmflush(cp); + CODADEBUG(CODA_ZAPFILE, myprintf(("zapfile: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, @@ -582,20 +581,20 @@ int handleDownCall(opcode, out) return(error); } - case CFS_ZAPDIR : { + case CODA_ZAPDIR : { struct cnode *cp; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_ZAPDIR]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_ZAPDIR]++; - cp = cfs_find(&out->cfs_zapdir.CodaFid); + cp = coda_find(&out->coda_zapdir.CodaFid); if (cp != NULL) { vref(CTOV(cp)); cp->c_flags &= ~C_VATTR; - cfsnc_zapParentfid(&out->cfs_zapdir.CodaFid, IS_DOWNCALL); + coda_nc_zapParentfid(&out->coda_zapdir.CodaFid, IS_DOWNCALL); - CFSDEBUG(CFS_ZAPDIR, myprintf(("zapdir: fid = (%lx.%lx.%lx), + CODADEBUG(CODA_ZAPDIR, myprintf(("zapdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, @@ -609,44 +608,44 @@ int handleDownCall(opcode, out) return(0); } - case CFS_ZAPVNODE : { - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_ZAPVNODE]++; + case CODA_ZAPVNODE : { + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_ZAPVNODE]++; - myprintf(("CFS_ZAPVNODE: Called, but uniplemented\n")); + myprintf(("CODA_ZAPVNODE: Called, but uniplemented\n")); /* * Not that below we must really translate the returned coda_cred to * a netbsd cred. This is a bit muddled at present and the cfsnc_zapnode * is further unimplemented, so punt! * I suppose we could use just the uid. */ - /* cfsnc_zapvnode(&out->cfs_zapvnode.VFid, &out->cfs_zapvnode.cred, + /* coda_nc_zapvnode(&out->coda_zapvnode.VFid, &out->coda_zapvnode.cred, IS_DOWNCALL); */ return(0); } - case CFS_PURGEFID : { + case CODA_PURGEFID : { struct cnode *cp; error = 0; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_PURGEFID]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_PURGEFID]++; - cp = cfs_find(&out->cfs_purgefid.CodaFid); + cp = coda_find(&out->coda_purgefid.CodaFid); if (cp != NULL) { vref(CTOV(cp)); - if (ODD(out->cfs_purgefid.CodaFid.Vnode)) { /* Vnode is a directory */ - cfsnc_zapParentfid(&out->cfs_purgefid.CodaFid, + if (ODD(out->coda_purgefid.CodaFid.Vnode)) { /* Vnode is a directory */ + coda_nc_zapParentfid(&out->coda_purgefid.CodaFid, IS_DOWNCALL); } cp->c_flags &= ~C_VATTR; - cfsnc_zapfid(&out->cfs_purgefid.CodaFid, IS_DOWNCALL); - if (!(ODD(out->cfs_purgefid.CodaFid.Vnode)) + coda_nc_zapfid(&out->coda_purgefid.CodaFid, IS_DOWNCALL); + if (!(ODD(out->coda_purgefid.CodaFid.Vnode)) && (CTOV(cp)->v_flag & VTEXT)) { - error = cfs_vmflush(cp); + error = coda_vmflush(cp); } - CFSDEBUG(CFS_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", + CODADEBUG(CODA_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, CTOV(cp)->v_usecount - 1, error));); @@ -658,24 +657,24 @@ int handleDownCall(opcode, out) return(error); } - case CFS_REPLACE : { + case CODA_REPLACE : { struct cnode *cp = NULL; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_REPLACE]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_REPLACE]++; - cp = cfs_find(&out->cfs_replace.OldFid); + cp = coda_find(&out->coda_replace.OldFid); if (cp != NULL) { /* remove the cnode from the hash table, replace the fid, and reinsert */ vref(CTOV(cp)); - cfs_unsave(cp); - cp->c_fid = out->cfs_replace.NewFid; - cfs_save(cp); - - CFSDEBUG(CFS_REPLACE, myprintf(("replace: oldfid = (%lx.%lx.%lx), newfid = (%lx.%lx.%lx), cp = %p\n", - out->cfs_replace.OldFid.Volume, - out->cfs_replace.OldFid.Vnode, - out->cfs_replace.OldFid.Unique, + coda_unsave(cp); + cp->c_fid = out->coda_replace.NewFid; + coda_save(cp); + + CODADEBUG(CODA_REPLACE, myprintf(("replace: oldfid = (%lx.%lx.%lx), newfid = (%lx.%lx.%lx), cp = %p\n", + out->coda_replace.OldFid.Volume, + out->coda_replace.OldFid.Vnode, + out->coda_replace.OldFid.Unique, cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, cp));) vrele(CTOV(cp)); @@ -688,10 +687,10 @@ int handleDownCall(opcode, out) } } -/* cfs_grab_vnode: lives in either cfs_mach.c or cfs_nbsd.c */ +/* coda_grab_vnode: lives in either cfs_mach.c or cfs_nbsd.c */ int -cfs_vmflush(cp) +coda_vmflush(cp) struct cnode *cp; { return 0; @@ -701,22 +700,22 @@ cfs_vmflush(cp) /* * kernel-internal debugging switches */ -void cfs_debugon(void) +void coda_debugon(void) { - cfsdebug = -1; - cfsnc_debug = -1; - cfs_vnop_print_entry = 1; - cfs_psdev_print_entry = 1; - cfs_vfsop_print_entry = 1; + codadebug = -1; + coda_nc_debug = -1; + coda_vnop_print_entry = 1; + coda_psdev_print_entry = 1; + coda_vfsop_print_entry = 1; } -void cfs_debugoff(void) +void coda_debugoff(void) { - cfsdebug = 0; - cfsnc_debug = 0; - cfs_vnop_print_entry = 0; - cfs_psdev_print_entry = 0; - cfs_vfsop_print_entry = 0; + codadebug = 0; + coda_nc_debug = 0; + coda_vnop_print_entry = 0; + coda_psdev_print_entry = 0; + coda_vfsop_print_entry = 0; } /* diff --git a/sys/coda/coda_subr.h b/sys/coda/coda_subr.h index 0263432..7a68e58 100644 --- a/sys/coda/coda_subr.h +++ b/sys/coda/coda_subr.h @@ -31,15 +31,15 @@ * */ -struct cnode *cfs_alloc(void); -void cfs_free(struct cnode *cp); -struct cnode *cfs_find(ViceFid *fid); -void cfs_flush(enum dc_status dcstat); -void cfs_testflush(void); -void cfs_checkunmounting(struct mount *mp); -void cfs_cacheprint(struct mount *whoIam); -void cfs_debugon(void); -void cfs_debugoff(void); -int cfs_kill(struct mount *whoIam, enum dc_status dcstat); -void cfs_save(struct cnode *cp); -void cfs_unsave(struct cnode *cp); +struct cnode *coda_alloc(void); +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_debugon(void); +void coda_debugoff(void); +int coda_kill(struct mount *whoIam, enum dc_status dcstat); +void coda_save(struct cnode *cp); +void coda_unsave(struct cnode *cp); diff --git a/sys/coda/coda_venus.c b/sys/coda/coda_venus.c index 7f7b30b..586d30d 100644 --- a/sys/coda/coda_venus.c +++ b/sys/coda/coda_venus.c @@ -26,8 +26,8 @@ * improvements or extensions that they make, and to grant Carnegie * Mellon the rights to redistribute these changes without encumbrance. * - * @(#) src/sys/cfs/cfs_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * @(#) src/sys/cfs/coda_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: coda_venus.c,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -45,10 +45,10 @@ #include #define DECL_NO_IN(name) \ - struct cfs_in_hdr *inp; \ + struct coda_in_hdr *inp; \ struct name ## _out *outp; \ - int name ## _size = sizeof (struct cfs_in_hdr); \ - int Isize = sizeof (struct cfs_in_hdr); \ + int name ## _size = sizeof (struct coda_in_hdr); \ + int Isize = sizeof (struct coda_in_hdr); \ int Osize = sizeof (struct name ## _out); \ int error @@ -62,29 +62,29 @@ #define DECL_NO_OUT(name) \ struct name ## _in *inp; \ - struct cfs_out_hdr *outp; \ + struct coda_out_hdr *outp; \ int name ## _size = sizeof (struct name ## _in); \ int Isize = sizeof (struct name ## _in); \ - int Osize = sizeof (struct cfs_out_hdr); \ + int Osize = sizeof (struct coda_out_hdr); \ int error #define ALLOC_NO_IN(name) \ if (Osize > name ## _size) \ name ## _size = Osize; \ - CFS_ALLOC(inp, struct cfs_in_hdr *, name ## _size);\ + CODA_ALLOC(inp, struct coda_in_hdr *, name ## _size);\ outp = (struct name ## _out *) inp #define ALLOC(name) \ if (Osize > name ## _size) \ name ## _size = Osize; \ - CFS_ALLOC(inp, struct name ## _in *, name ## _size);\ + CODA_ALLOC(inp, struct name ## _in *, name ## _size);\ outp = (struct name ## _out *) inp #define ALLOC_NO_OUT(name) \ if (Osize > name ## _size) \ name ## _size = Osize; \ - CFS_ALLOC(inp, struct name ## _in *, name ## _size);\ - outp = (struct cfs_out_hdr *) inp + CODA_ALLOC(inp, struct name ## _in *, name ## _size);\ + outp = (struct coda_out_hdr *) inp #define STRCPY(struc, name, len) \ bcopy(name, (char *)inp + (int)inp->struc, len); \ @@ -163,17 +163,17 @@ venus_root(void *mdp, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid) { - DECL_NO_IN(cfs_root); /* sets Isize & Osize */ - ALLOC_NO_IN(cfs_root); /* sets inp & outp */ + DECL_NO_IN(coda_root); /* sets Isize & Osize */ + ALLOC_NO_IN(coda_root); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(inp, CFS_ROOT, cred, p); + INIT_IN(inp, CODA_ROOT, cred, p); - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) *VFid = outp->VFid; - CFS_FREE(inp, cfs_root_size); + CODA_FREE(inp, coda_root_size); return error; } @@ -183,22 +183,22 @@ venus_open(void *mdp, ViceFid *fid, int flag, /*out*/ dev_t *dev, ino_t *inode) { int cflag; - DECL(cfs_open); /* sets Isize & Osize */ - ALLOC(cfs_open); /* sets inp & outp */ + DECL(coda_open); /* sets Isize & Osize */ + ALLOC(coda_open); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_OPEN, cred, p); + INIT_IN(&inp->ih, CODA_OPEN, cred, p); inp->VFid = *fid; CNV_OFLAG(cflag, flag); inp->flags = cflag; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *dev = outp->dev; *inode = outp->inode; } - CFS_FREE(inp, cfs_open_size); + CODA_FREE(inp, coda_open_size); return error; } @@ -207,17 +207,17 @@ venus_close(void *mdp, ViceFid *fid, int flag, struct ucred *cred, struct proc *p) { int cflag; - DECL_NO_OUT(cfs_close); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_close); /* sets inp & outp */ + DECL_NO_OUT(coda_close); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_close); /* sets inp & outp */ - INIT_IN(&inp->ih, CFS_CLOSE, cred, p); + INIT_IN(&inp->ih, CODA_CLOSE, cred, p); inp->VFid = *fid; CNV_OFLAG(cflag, flag); inp->flags = cflag; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_close_size); + CODA_FREE(inp, coda_close_size); return error; } @@ -244,14 +244,14 @@ venus_ioctl(void *mdp, ViceFid *fid, int com, int flag, caddr_t data, struct ucred *cred, struct proc *p) { - DECL(cfs_ioctl); /* sets Isize & Osize */ + DECL(coda_ioctl); /* sets Isize & Osize */ struct PioctlData *iap = (struct PioctlData *)data; int tmp; - cfs_ioctl_size = VC_MAXMSGSIZE; - ALLOC(cfs_ioctl); /* sets inp & outp */ + coda_ioctl_size = VC_MAXMSGSIZE; + ALLOC(coda_ioctl); /* sets inp & outp */ - INIT_IN(&inp->ih, CFS_IOCTL, cred, p); + INIT_IN(&inp->ih, CODA_IOCTL, cred, p); inp->VFid = *fid; /* command was mutated by increasing its size field to reflect the @@ -264,17 +264,17 @@ venus_ioctl(void *mdp, ViceFid *fid, inp->rwflag = flag; inp->len = iap->vi.in_size; - inp->data = (char *)(sizeof (struct cfs_ioctl_in)); + inp->data = (char *)(sizeof (struct coda_ioctl_in)); error = copyin(iap->vi.in, (char*)inp + (int)inp->data, iap->vi.in_size); if (error) { - CFS_FREE(inp, cfs_ioctl_size); + CODA_FREE(inp, coda_ioctl_size); return(error); } Osize = VC_MAXMSGSIZE; - error = cfscall(mdp, Isize + iap->vi.in_size, &Osize, (char *)inp); + error = coda_call(mdp, Isize + iap->vi.in_size, &Osize, (char *)inp); /* copy out the out buffer. */ if (!error) { @@ -286,7 +286,7 @@ venus_ioctl(void *mdp, ViceFid *fid, } } - CFS_FREE(inp, cfs_ioctl_size); + CODA_FREE(inp, coda_ioctl_size); return error; } @@ -295,19 +295,19 @@ venus_getattr(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ struct vattr *vap) { - DECL(cfs_getattr); /* sets Isize & Osize */ - ALLOC(cfs_getattr); /* sets inp & outp */ + DECL(coda_getattr); /* sets Isize & Osize */ + ALLOC(coda_getattr); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_GETATTR, cred, p); + INIT_IN(&inp->ih, CODA_GETATTR, cred, p); inp->VFid = *fid; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { CNV_VV2V_ATTR(vap, &outp->attr); } - CFS_FREE(inp, cfs_getattr_size); + CODA_FREE(inp, coda_getattr_size); return error; } @@ -315,17 +315,17 @@ int venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_setattr); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_setattr); /* sets inp & outp */ + DECL_NO_OUT(coda_setattr); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_setattr); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_SETATTR, cred, p); + INIT_IN(&inp->ih, CODA_SETATTR, cred, p); inp->VFid = *fid; CNV_V2VV_ATTR(&inp->attr, vap); - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_setattr_size); + CODA_FREE(inp, coda_setattr_size); return error; } @@ -333,11 +333,11 @@ int venus_access(void *mdp, ViceFid *fid, int mode, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_access); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_access); /* sets inp & outp */ + DECL_NO_OUT(coda_access); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_access); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_ACCESS, cred, p); + INIT_IN(&inp->ih, CODA_ACCESS, cred, p); inp->VFid = *fid; /* NOTE: * NetBSD and Venus internals use the "data" in the low 3 bits. @@ -345,9 +345,9 @@ venus_access(void *mdp, ViceFid *fid, int mode, */ inp->flags = mode>>6; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_access_size); + CODA_FREE(inp, coda_access_size); return error; } @@ -356,23 +356,23 @@ venus_readlink(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ char **str, int *len) { - DECL(cfs_readlink); /* sets Isize & Osize */ - cfs_readlink_size += CFS_MAXPATHLEN; - ALLOC(cfs_readlink); /* sets inp & outp */ + DECL(coda_readlink); /* sets Isize & Osize */ + coda_readlink_size += CODA_MAXPATHLEN; + ALLOC(coda_readlink); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_READLINK, cred, p); + INIT_IN(&inp->ih, CODA_READLINK, cred, p); inp->VFid = *fid; - Osize += CFS_MAXPATHLEN; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + Osize += CODA_MAXPATHLEN; + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { - CFS_ALLOC(*str, char *, outp->count); + CODA_ALLOC(*str, char *, outp->count); *len = outp->count; bcopy((char *)outp + (int)outp->data, *str, *len); } - CFS_FREE(inp, cfs_readlink_size); + CODA_FREE(inp, coda_readlink_size); return error; } @@ -380,16 +380,16 @@ int venus_fsync(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_fsync); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_fsync); /* sets inp & outp */ + DECL_NO_OUT(coda_fsync); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_fsync); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_FSYNC, cred, p); + INIT_IN(&inp->ih, CODA_FSYNC, cred, p); inp->VFid = *fid; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_fsync_size); + CODA_FREE(inp, coda_fsync_size); return error; } @@ -399,24 +399,24 @@ venus_lookup(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, int *vtype) { - DECL(cfs_lookup); /* sets Isize & Osize */ - cfs_lookup_size += len + 1; - ALLOC(cfs_lookup); /* sets inp & outp */ + DECL(coda_lookup); /* sets Isize & Osize */ + coda_lookup_size += len + 1; + ALLOC(coda_lookup); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_LOOKUP, cred, p); + INIT_IN(&inp->ih, CODA_LOOKUP, cred, p); inp->VFid = *fid; inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; *vtype = outp->vtype; } - CFS_FREE(inp, cfs_lookup_size); + CODA_FREE(inp, coda_lookup_size); return error; } @@ -426,12 +426,12 @@ venus_create(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, struct vattr *attr) { - DECL(cfs_create); /* sets Isize & Osize */ - cfs_create_size += len + 1; - ALLOC(cfs_create); /* sets inp & outp */ + DECL(coda_create); /* sets Isize & Osize */ + coda_create_size += len + 1; + ALLOC(coda_create); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_CREATE, cred, p); + INIT_IN(&inp->ih, CODA_CREATE, cred, p); inp->VFid = *fid; inp->excl = exclusive ? C_O_EXCL : 0; inp->mode = mode; @@ -440,13 +440,13 @@ venus_create(void *mdp, ViceFid *fid, inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; CNV_VV2V_ATTR(attr, &outp->attr); } - CFS_FREE(inp, cfs_create_size); + CODA_FREE(inp, coda_create_size); return error; } @@ -455,20 +455,20 @@ venus_remove(void *mdp, ViceFid *fid, const char *nm, int len, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_remove); /* sets Isize & Osize */ - cfs_remove_size += len + 1; - ALLOC_NO_OUT(cfs_remove); /* sets inp & outp */ + DECL_NO_OUT(coda_remove); /* sets Isize & Osize */ + coda_remove_size += len + 1; + ALLOC_NO_OUT(coda_remove); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_REMOVE, cred, p); + INIT_IN(&inp->ih, CODA_REMOVE, cred, p); inp->VFid = *fid; inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_remove_size); + CODA_FREE(inp, coda_remove_size); return error; } @@ -477,21 +477,21 @@ venus_link(void *mdp, ViceFid *fid, ViceFid *tfid, const char *nm, int len, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_link); /* sets Isize & Osize */ - cfs_link_size += len + 1; - ALLOC_NO_OUT(cfs_link); /* sets inp & outp */ + DECL_NO_OUT(coda_link); /* sets Isize & Osize */ + coda_link_size += len + 1; + ALLOC_NO_OUT(coda_link); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_LINK, cred, p); + INIT_IN(&inp->ih, CODA_LINK, cred, p); inp->sourceFid = *fid; inp->destFid = *tfid; inp->tname = Isize; STRCPY(tname, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_link_size); + CODA_FREE(inp, coda_link_size); return error; } @@ -500,12 +500,12 @@ venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid, const char *nm, int len, const char *tnm, int tlen, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_rename); /* sets Isize & Osize */ - cfs_rename_size += len + 1 + tlen + 1; - ALLOC_NO_OUT(cfs_rename); /* sets inp & outp */ + DECL_NO_OUT(coda_rename); /* sets Isize & Osize */ + coda_rename_size += len + 1 + tlen + 1; + ALLOC_NO_OUT(coda_rename); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_RENAME, cred, p); + INIT_IN(&inp->ih, CODA_RENAME, cred, p); inp->sourceFid = *fid; inp->destFid = *tfid; @@ -515,9 +515,9 @@ venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid, inp->destname = Isize; STRCPY(destname, tnm, tlen); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_rename_size); + CODA_FREE(inp, coda_rename_size); return error; } @@ -527,25 +527,25 @@ venus_mkdir(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, struct vattr *ova) { - DECL(cfs_mkdir); /* sets Isize & Osize */ - cfs_mkdir_size += len + 1; - ALLOC(cfs_mkdir); /* sets inp & outp */ + DECL(coda_mkdir); /* sets Isize & Osize */ + coda_mkdir_size += len + 1; + ALLOC(coda_mkdir); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_MKDIR, cred, p); + INIT_IN(&inp->ih, CODA_MKDIR, cred, p); inp->VFid = *fid; CNV_V2VV_ATTR(&inp->attr, va); inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; CNV_VV2V_ATTR(ova, &outp->attr); } - CFS_FREE(inp, cfs_mkdir_size); + CODA_FREE(inp, coda_mkdir_size); return error; } @@ -554,20 +554,20 @@ venus_rmdir(void *mdp, ViceFid *fid, const char *nm, int len, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_rmdir); /* sets Isize & Osize */ - cfs_rmdir_size += len + 1; - ALLOC_NO_OUT(cfs_rmdir); /* sets inp & outp */ + DECL_NO_OUT(coda_rmdir); /* sets Isize & Osize */ + coda_rmdir_size += len + 1; + ALLOC_NO_OUT(coda_rmdir); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_RMDIR, cred, p); + INIT_IN(&inp->ih, CODA_RMDIR, cred, p); inp->VFid = *fid; inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_rmdir_size); + CODA_FREE(inp, coda_rmdir_size); return error; } @@ -576,12 +576,12 @@ venus_symlink(void *mdp, ViceFid *fid, const char *lnm, int llen, const char *nm, int len, struct vattr *va, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_symlink); /* sets Isize & Osize */ - cfs_symlink_size += llen + 1 + len + 1; - ALLOC_NO_OUT(cfs_symlink); /* sets inp & outp */ + DECL_NO_OUT(coda_symlink); /* sets Isize & Osize */ + coda_symlink_size += llen + 1 + len + 1; + ALLOC_NO_OUT(coda_symlink); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_SYMLINK, cred, p); + INIT_IN(&inp->ih, CODA_SYMLINK, cred, p); inp->VFid = *fid; CNV_V2VV_ATTR(&inp->attr, va); @@ -591,9 +591,9 @@ venus_symlink(void *mdp, ViceFid *fid, inp->tname = Isize; STRCPY(tname, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_symlink_size); + CODA_FREE(inp, coda_symlink_size); return error; } @@ -603,24 +603,24 @@ venus_readdir(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ char *buffer, int *len) { - DECL(cfs_readdir); /* sets Isize & Osize */ - cfs_readdir_size = VC_MAXMSGSIZE; - ALLOC(cfs_readdir); /* sets inp & outp */ + DECL(coda_readdir); /* sets Isize & Osize */ + coda_readdir_size = VC_MAXMSGSIZE; + ALLOC(coda_readdir); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_READDIR, cred, p); + INIT_IN(&inp->ih, CODA_READDIR, cred, p); inp->VFid = *fid; inp->count = count; inp->offset = offset; Osize = VC_MAXMSGSIZE; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { bcopy((char *)outp + (int)outp->data, buffer, outp->size); *len = outp->size; } - CFS_FREE(inp, cfs_readdir_size); + CODA_FREE(inp, coda_readdir_size); return error; } @@ -629,19 +629,19 @@ venus_fhtovp(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, int *vtype) { - DECL(cfs_vget); /* sets Isize & Osize */ - ALLOC(cfs_vget); /* sets inp & outp */ + DECL(coda_vget); /* sets Isize & Osize */ + ALLOC(coda_vget); /* sets inp & outp */ /* Send the open to Venus. */ - INIT_IN(&inp->ih, CFS_VGET, cred, p); + INIT_IN(&inp->ih, CODA_VGET, cred, p); inp->VFid = *fid; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; *vtype = outp->vtype; } - CFS_FREE(inp, cfs_vget_size); + CODA_FREE(inp, coda_vget_size); return error; } diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c index 0831e17..0abddd3 100644 --- a/sys/coda/coda_vfsops.c +++ b/sys/coda/coda_vfsops.c @@ -26,8 +26,8 @@ * improvements or extensions that they make, and to grant Carnegie * Mellon the rights to redistribute these changes without encumbrance. * - * @(#) src/sys/cfs/cfs_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: cfs_vfsops.c,v 1.2 1998/09/02 19:09:53 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.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -46,7 +46,7 @@ /* * HISTORY - * $Log: cfs_vfsops.c,v $ + * $Log: coda_vfsops.c,v $ * Revision 1.2 1998/09/02 19:09:53 rvb * Pass2 complete * @@ -69,13 +69,13 @@ * Fixes up mainly to flush iopen and friends * * Revision 1.7 98/01/23 11:53:45 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.6.2.6 98/01/23 11:21:07 rvb * Sync with 2.2.5 * * Revision 1.6.2.5 98/01/22 13:05:33 rvb - * Move makecfsnode ctlfid later so vfsp is known + * Move make_coda_node ctlfid later so vfsp is known * * Revision 1.6.2.4 97/12/19 14:26:05 rvb * session id @@ -96,7 +96,7 @@ * Final cfs_venus.c w/o macros, but one locking bug * * Revision 1.5.14.7 97/11/21 13:22:03 rvb - * Catch a few cfscalls in cfs_vfsops.c + * Catch a few coda_calls in coda_vfsops.c * * Revision 1.5.14.6 97/11/20 11:46:48 rvb * Capture current cfs_venus @@ -134,7 +134,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:32 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:02 bnoble * Branch for NetBSD port revisions @@ -162,7 +162,7 @@ * merge kernel/latest and alpha/src/cfs * * Revision 2.3 92/09/30 14:16:32 mja - * Added call to cfs_flush to cfs_unmount. + * Added call to coda_flush to coda_unmount. * [90/12/15 dcs] * * Added contributors blurb. @@ -177,7 +177,7 @@ * * */ -#include +#include #include #include @@ -198,56 +198,56 @@ #include -MALLOC_DEFINE(M_CFS, "CFS storage", "Various Coda Structures"); +MALLOC_DEFINE(M_CODA, "CODA storage", "Various Coda Structures"); -int cfsdebug = 0; -int cfs_vfsop_print_entry = 0; -#define ENTRY if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) +int codadebug = 0; +int coda_vfsop_print_entry = 0; +#define ENTRY if(coda_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -struct vnode *cfs_ctlvp; -struct cfs_mntinfo cfs_mnttbl[NVCFS]; /* indexed by minor device number */ +struct vnode *coda_ctlvp; +struct coda_mntinfo coda_mnttbl[NVCODA]; /* indexed by minor device number */ /* structure to keep statistics of internally generated/satisfied calls */ -struct cfs_op_stats cfs_vfsopstats[CFS_VFSOPS_SIZE]; +struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE]; -#define MARK_ENTRY(op) (cfs_vfsopstats[op].entries++) -#define MARK_INT_SAT(op) (cfs_vfsopstats[op].sat_intrn++) -#define MARK_INT_FAIL(op) (cfs_vfsopstats[op].unsat_intrn++) -#define MRAK_INT_GEN(op) (cfs_vfsopstats[op].gen_intrn++) +#define MARK_ENTRY(op) (coda_vfsopstats[op].entries++) +#define MARK_INT_SAT(op) (coda_vfsopstats[op].sat_intrn++) +#define MARK_INT_FAIL(op) (coda_vfsopstats[op].unsat_intrn++) +#define MRAK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++) -extern int cfsnc_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 *)); -struct vfsops cfs_vfsops = { - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, +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, - cfs_init, + coda_init, }; -VFS_SET(cfs_vfsops, cfs, VFCF_NETWORK); +VFS_SET(coda_vfsops, coda, VFCF_NETWORK); int -cfs_vfsopstats_init(void) +coda_vfsopstats_init(void) { register int i; - for (i=0;ini_vp; if (error) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return (error); } if (dvp->v_type != VCHR) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); vrele(dvp); return(ENXIO); } dev = dvp->v_specinfo->si_rdev; vrele(dvp); if (major(dev) >= nchrdev || major(dev) < 0) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENXIO); } @@ -313,22 +313,22 @@ cfs_mount(vfsp, path, data, ndp, p) */ if (cdevsw[major(dev)]->d_open != vc_nb_open) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENXIO); } - if (minor(dev) >= NVCFS || minor(dev) < 0) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + if (minor(dev) >= NVCODA || minor(dev) < 0) { + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENXIO); } /* * Initialize the mount record and link it to the vfs struct */ - mi = &cfs_mnttbl[minor(dev)]; + mi = &coda_mnttbl[minor(dev)]; if (!VC_OPEN(&mi->mi_vcomm)) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENODEV); } @@ -340,27 +340,27 @@ cfs_mount(vfsp, path, data, ndp, p) /* * Make a root vnode to placate the Vnode interface, but don't - * actually make the CFS_ROOT call to venus until the first call - * to cfs_root in case a server is down while venus is starting. + * actually make the CODA_ROOT call to venus until the first call + * to coda_root in case a server is down while venus is starting. */ rootfid.Volume = 0; rootfid.Vnode = 0; rootfid.Unique = 0; - cp = makecfsnode(&rootfid, vfsp, VDIR); + cp = make_coda_node(&rootfid, vfsp, VDIR); rootvp = CTOV(cp); rootvp->v_flag |= VROOT; ctlfid.Volume = CTL_VOL; ctlfid.Vnode = CTL_VNO; ctlfid.Unique = CTL_UNI; -/* cp = makecfsnode(&ctlfid, vfsp, VCHR); +/* cp = make_coda_node(&ctlfid, vfsp, VCHR); The above code seems to cause a loop in the cnode links. I don't totally understand when it happens, it is caught when closing down the system. */ - cp = makecfsnode(&ctlfid, 0, VCHR); + cp = make_coda_node(&ctlfid, 0, VCHR); - cfs_ctlvp = CTOV(cp); + coda_ctlvp = CTOV(cp); /* Add vfs and rootvp to chain of vfs hanging off mntinfo */ mi->mi_vfsp = vfsp; @@ -377,18 +377,18 @@ cfs_mount(vfsp, path, data, ndp, p) /* error is currently guaranteed to be zero, but in case some code changes... */ - CFSDEBUG(1, - myprintf(("cfs_mount returned %d\n",error));); + CODADEBUG(1, + myprintf(("coda_mount returned %d\n",error));); if (error) - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); else - MARK_INT_SAT(CFS_MOUNT_STATS); + MARK_INT_SAT(CODA_MOUNT_STATS); return(error); } int -cfs_start(vfsp, flags, p) +coda_start(vfsp, flags, p) struct mount *vfsp; int flags; struct proc *p; @@ -398,18 +398,18 @@ cfs_start(vfsp, flags, p) } int -cfs_unmount(vfsp, mntflags, p) +coda_unmount(vfsp, mntflags, p) struct mount *vfsp; int mntflags; struct proc *p; { - struct cfs_mntinfo *mi = vftomi(vfsp); + struct coda_mntinfo *mi = vftomi(vfsp); int active, error = 0; ENTRY; - MARK_ENTRY(CFS_UMOUNT_STATS); - if (!CFS_MOUNTED(vfsp)) { - MARK_INT_FAIL(CFS_UMOUNT_STATS); + MARK_ENTRY(CODA_UMOUNT_STATS); + if (!CODA_MOUNTED(vfsp)) { + MARK_INT_FAIL(CODA_UMOUNT_STATS); return(EINVAL); } @@ -418,13 +418,13 @@ cfs_unmount(vfsp, mntflags, p) return (EBUSY); /* Venus is still running */ #ifdef DEBUG - printf("cfs_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp)); + printf("coda_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp)); #endif vrele(mi->mi_rootvp); - active = cfs_kill(vfsp, NOT_DOWNCALL); + active = coda_kill(vfsp, NOT_DOWNCALL); error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE); - printf("cfs_unmount: active = %d, vflush active %d\n", active, error); + printf("coda_unmount: active = %d, vflush active %d\n", active, error); error = 0; /* I'm going to take this out to allow lookups to go through. I'm * not sure it's important anyway. -- DCS 2/2/94 @@ -436,9 +436,9 @@ cfs_unmount(vfsp, mntflags, p) mi->mi_rootvp = NULL; if (error) - MARK_INT_FAIL(CFS_UMOUNT_STATS); + MARK_INT_FAIL(CODA_UMOUNT_STATS); else - MARK_INT_SAT(CFS_UMOUNT_STATS); + MARK_INT_SAT(CODA_UMOUNT_STATS); return(error); } @@ -449,18 +449,18 @@ cfs_unmount(vfsp, mntflags, p) * find root of cfs */ int -cfs_root(vfsp, vpp) +coda_root(vfsp, vpp) struct mount *vfsp; struct vnode **vpp; { - struct cfs_mntinfo *mi = vftomi(vfsp); + struct coda_mntinfo *mi = vftomi(vfsp); struct vnode **result; int error; struct proc *p = curproc; /* XXX - bnoble */ ViceFid VFid; ENTRY; - MARK_ENTRY(CFS_ROOT_STATS); + MARK_ENTRY(CODA_ROOT_STATS); result = NULL; if (vfsp == mi->mi_vfsp) { @@ -476,7 +476,7 @@ cfs_root(vfsp, vpp) #else vget(*vpp, LK_EXCLUSIVE, p); #endif - MARK_INT_SAT(CFS_ROOT_STATS); + MARK_INT_SAT(CODA_ROOT_STATS); return(0); } } @@ -488,9 +488,9 @@ cfs_root(vfsp, vpp) * Save the new rootfid in the cnode, and rehash the cnode into the * cnode hash with the new fid key. */ - cfs_unsave(VTOC(mi->mi_rootvp)); + coda_unsave(VTOC(mi->mi_rootvp)); VTOC(mi->mi_rootvp)->c_fid = VFid; - cfs_save(VTOC(mi->mi_rootvp)); + coda_save(VTOC(mi->mi_rootvp)); *vpp = mi->mi_rootvp; #if 1 @@ -500,16 +500,16 @@ cfs_root(vfsp, vpp) vget(*vpp, LK_EXCLUSIVE, p); #endif - MARK_INT_SAT(CFS_ROOT_STATS); + MARK_INT_SAT(CODA_ROOT_STATS); goto exit; } else if (error == ENODEV) { /* Gross hack here! */ /* - * If Venus fails to respond to the CFS_ROOT call, cfscall returns + * If Venus fails to respond to the CODA_ROOT call, coda_call returns * ENODEV. Return the uninitialized root vnode to allow vfs * operations such as unmount to continue. Without this hack, * there is no way to do an unmount if Venus dies before a - * successful CFS_ROOT call is done. All vnode operations + * successful CODA_ROOT call is done. All vnode operations * will fail. */ *vpp = mi->mi_rootvp; @@ -520,12 +520,12 @@ cfs_root(vfsp, vpp) vget(*vpp, LK_EXCLUSIVE, p); #endif - MARK_INT_FAIL(CFS_ROOT_STATS); + MARK_INT_FAIL(CODA_ROOT_STATS); error = 0; goto exit; } else { - CFSDEBUG( CFS_ROOT, myprintf(("error %d in CFS_ROOT\n", error)); ); - MARK_INT_FAIL(CFS_ROOT_STATS); + CODADEBUG( CODA_ROOT, myprintf(("error %d in CODA_ROOT\n", error)); ); + MARK_INT_FAIL(CODA_ROOT_STATS); goto exit; } @@ -535,7 +535,7 @@ cfs_root(vfsp, vpp) } int -cfs_quotactl(vfsp, cmd, uid, arg, p) +coda_quotactl(vfsp, cmd, uid, arg, p) struct mount *vfsp; int cmd; uid_t uid; @@ -550,15 +550,15 @@ cfs_quotactl(vfsp, cmd, uid, arg, p) * Get file system statistics. */ int -cfs_nb_statfs(vfsp, sbp, p) +coda_nb_statfs(vfsp, sbp, p) register struct mount *vfsp; struct statfs *sbp; struct proc *p; { ENTRY; -/* MARK_ENTRY(CFS_STATFS_STATS); */ - if (!CFS_MOUNTED(vfsp)) { -/* MARK_INT_FAIL(CFS_STATFS_STATS);*/ +/* MARK_ENTRY(CODA_STATFS_STATS); */ + if (!CODA_MOUNTED(vfsp)) { +/* MARK_INT_FAIL(CODA_STATFS_STATS);*/ return(EINVAL); } @@ -579,8 +579,8 @@ cfs_nb_statfs(vfsp, sbp, p) sbp->f_ffree = NB_SFS_SIZ; bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t)); strcpy(sbp->f_mntonname, "/coda"); - strcpy(sbp->f_mntfromname, "CFS"); -/* MARK_INT_SAT(CFS_STATFS_STATS); */ + strcpy(sbp->f_mntfromname, "CODA"); +/* MARK_INT_SAT(CODA_STATFS_STATS); */ return(0); } @@ -588,20 +588,20 @@ cfs_nb_statfs(vfsp, sbp, p) * Flush any pending I/O. */ int -cfs_sync(vfsp, waitfor, cred, p) +coda_sync(vfsp, waitfor, cred, p) struct mount *vfsp; int waitfor; struct ucred *cred; struct proc *p; { ENTRY; - MARK_ENTRY(CFS_SYNC_STATS); - MARK_INT_SAT(CFS_SYNC_STATS); + MARK_ENTRY(CODA_SYNC_STATS); + MARK_INT_SAT(CODA_SYNC_STATS); return(0); } int -cfs_vget(vfsp, ino, vpp) +coda_vget(vfsp, ino, vpp) struct mount *vfsp; ino_t ino; struct vnode **vpp; @@ -616,7 +616,7 @@ cfs_vget(vfsp, ino, vpp) * a type-specific fid. */ int -cfs_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp) +coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp) register struct mount *vfsp; struct fid *fhp; struct mbuf *nam; @@ -633,33 +633,33 @@ cfs_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp) ENTRY; - MARK_ENTRY(CFS_VGET_STATS); + MARK_ENTRY(CODA_VGET_STATS); /* Check for vget of control object. */ if (IS_CTL_FID(&cfid->cfid_fid)) { - *vpp = cfs_ctlvp; - vref(cfs_ctlvp); - MARK_INT_SAT(CFS_VGET_STATS); + *vpp = coda_ctlvp; + vref(coda_ctlvp); + MARK_INT_SAT(CODA_VGET_STATS); return(0); } error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, p->p_cred->pc_ucred, p, &VFid, &vtype); if (error) { - CFSDEBUG(CFS_VGET, myprintf(("vget error %d\n",error));) + CODADEBUG(CODA_VGET, myprintf(("vget error %d\n",error));) *vpp = (struct vnode *)0; } else { - CFSDEBUG(CFS_VGET, + CODADEBUG(CODA_VGET, myprintf(("vget: vol %lx vno %lx uni %lx type %d result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, vtype, error)); ) - cp = makecfsnode(&VFid, vfsp, vtype); + cp = make_coda_node(&VFid, vfsp, vtype); *vpp = CTOV(cp); } return(error); } int -cfs_vptofh(vnp, fidp) +coda_vptofh(vnp, fidp) struct vnode *vnp; struct fid *fidp; { @@ -668,7 +668,7 @@ cfs_vptofh(vnp, fidp) } int -cfs_init(struct vfsconf *vfsp) +coda_init(struct vfsconf *vfsp) { ENTRY; return 0; @@ -685,7 +685,7 @@ getNewVnode(vpp) struct vnode **vpp; { struct cfid cfid; - struct cfs_mntinfo *mi = vftomi((*vpp)->v_mount); + struct coda_mntinfo *mi = vftomi((*vpp)->v_mount); ENTRY; @@ -699,7 +699,7 @@ getNewVnode(vpp) if (mi->mi_vfsp == NULL) return ENODEV; - return cfs_fhtovp(mi->mi_vfsp, (struct fid*)&cfid, NULL, vpp, + return coda_fhtovp(mi->mi_vfsp, (struct fid*)&cfid, NULL, vpp, NULL, NULL); } diff --git a/sys/coda/coda_vfsops.h b/sys/coda/coda_vfsops.h index 754bbf3..ef23c3f 100644 --- a/sys/coda/coda_vfsops.h +++ b/sys/coda/coda_vfsops.h @@ -26,8 +26,8 @@ * improvements or extensions that they make, and to grant Carnegie * Mellon the rights to redistribute these changes without encumbrance. * - * @(#) src/sys/cfs/cfs_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * @(#) src/sys/cfs/coda_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: coda_vfsops.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -45,19 +45,19 @@ struct cfid { struct mount; -int cfs_vfsopstats_init(void); -int cfs_mount(struct mount *, char *, caddr_t, struct nameidata *, +int coda_vfsopstats_init(void); +int coda_mount(struct mount *, char *, caddr_t, struct nameidata *, struct proc *); -int cfs_start(struct mount *, int, struct proc *); -int cfs_unmount(struct mount *, int, struct proc *); -int cfs_root(struct mount *, struct vnode **); -int cfs_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *); -int cfs_nb_statfs(struct mount *, struct statfs *, struct proc *); -int cfs_sync(struct mount *, int, struct ucred *, struct proc *); -int cfs_vget(struct mount *, ino_t, struct vnode **); -int cfs_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, +int coda_start(struct mount *, int, struct proc *); +int coda_unmount(struct mount *, int, struct proc *); +int coda_root(struct mount *, struct vnode **); +int coda_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *); +int coda_nb_statfs(struct mount *, struct statfs *, struct proc *); +int coda_sync(struct mount *, int, struct ucred *, struct proc *); +int coda_vget(struct mount *, ino_t, struct vnode **); +int coda_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **); -int cfs_vptofh(struct vnode *, struct fid *); -int cfs_init(struct vfsconf *vfsp); +int coda_vptofh(struct vnode *, struct fid *); +int coda_init(struct vfsconf *vfsp); int getNewVnode(struct vnode **vpp); diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index c5c8203..f505af5 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/cfs/cfs_vnodeops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfs_vnodeops.c,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -48,6 +48,9 @@ /* * HISTORY * $Log: cfs_vnodeops.c,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -73,7 +76,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.6 98/01/23 11:53:47 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.5.2.8 98/01/23 11:21:11 rvb * Sync with 2.2.5 @@ -88,7 +91,7 @@ * Sync with 1.3 * * Revision 1.5.2.4 97/12/10 14:08:31 rvb - * Fix O_ flags; check result in cfscall + * Fix O_ flags; check result in coda_call * * Revision 1.5.2.3 97/12/10 11:40:27 rvb * No more ody @@ -134,7 +137,7 @@ * >64Meg; venus can be killed! * * Revision 1.4 1997/02/20 13:54:50 lily - * check for NULL return from cfsnc_lookup before CTOV + * check for NULL return from coda_nc_lookup before CTOV * * Revision 1.3 1996/12/12 22:11:02 bnoble * Fixed the "downcall invokes venus operation" deadlock in all known cases. @@ -144,7 +147,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:34 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:06 bnoble * Branch for NetBSD port revisions @@ -249,76 +252,76 @@ /* * These flags select various performance enhancements. */ -int cfs_attr_cache = 1; /* Set to cache attributes in the kernel */ -int cfs_symlink_cache = 1; /* Set to cache symbolic link information */ -int cfs_access_cache = 1; /* Set to handle some access checks directly */ +int coda_attr_cache = 1; /* Set to cache attributes in the kernel */ +int coda_symlink_cache = 1; /* Set to cache symbolic link information */ +int coda_access_cache = 1; /* Set to handle some access checks directly */ /* structure to keep track of vfs calls */ -struct cfs_op_stats cfs_vnodeopstats[CFS_VNODEOPS_SIZE]; +struct coda_op_stats coda_vnodeopstats[CODA_VNODEOPS_SIZE]; -#define MARK_ENTRY(op) (cfs_vnodeopstats[op].entries++) -#define MARK_INT_SAT(op) (cfs_vnodeopstats[op].sat_intrn++) -#define MARK_INT_FAIL(op) (cfs_vnodeopstats[op].unsat_intrn++) -#define MARK_INT_GEN(op) (cfs_vnodeopstats[op].gen_intrn++) +#define MARK_ENTRY(op) (coda_vnodeopstats[op].entries++) +#define MARK_INT_SAT(op) (coda_vnodeopstats[op].sat_intrn++) +#define MARK_INT_FAIL(op) (coda_vnodeopstats[op].unsat_intrn++) +#define MARK_INT_GEN(op) (coda_vnodeopstats[op].gen_intrn++) /* What we are delaying for in printf */ -int cfs_printf_delay = 0; /* in microseconds */ -int cfs_vnop_print_entry = 0; -static int cfs_lockdebug = 0; +int coda_printf_delay = 0; /* in microseconds */ +int coda_vnop_print_entry = 0; +static int coda_lockdebug = 0; /* Definition of the vfs operation vector */ /* * Some NetBSD details: * - * cfs_start is called at the end of the mount syscall. - * cfs_init is called at boot time. + * coda_start is called at the end of the mount syscall. + * coda_init is called at boot time. */ -#define ENTRY if(cfs_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) +#define ENTRY if(coda_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) /* Definition of the vnode operation vector */ -struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { - { &vop_default_desc, cfs_vop_error }, - { &vop_lookup_desc, cfs_lookup }, /* lookup */ - { &vop_create_desc, cfs_create }, /* create */ - { &vop_mknod_desc, cfs_vop_error }, /* mknod */ - { &vop_open_desc, cfs_open }, /* open */ - { &vop_close_desc, cfs_close }, /* close */ - { &vop_access_desc, cfs_access }, /* access */ - { &vop_getattr_desc, cfs_getattr }, /* getattr */ - { &vop_setattr_desc, cfs_setattr }, /* setattr */ - { &vop_read_desc, cfs_read }, /* read */ - { &vop_write_desc, cfs_write }, /* write */ - { &vop_ioctl_desc, cfs_ioctl }, /* ioctl */ - { &vop_mmap_desc, cfs_vop_error }, /* mmap */ - { &vop_fsync_desc, cfs_fsync }, /* fsync */ - { &vop_remove_desc, cfs_remove }, /* remove */ - { &vop_link_desc, cfs_link }, /* link */ - { &vop_rename_desc, cfs_rename }, /* rename */ - { &vop_mkdir_desc, cfs_mkdir }, /* mkdir */ - { &vop_rmdir_desc, cfs_rmdir }, /* rmdir */ - { &vop_symlink_desc, cfs_symlink }, /* symlink */ - { &vop_readdir_desc, cfs_readdir }, /* readdir */ - { &vop_readlink_desc, cfs_readlink }, /* readlink */ - { &vop_abortop_desc, cfs_abortop }, /* abortop */ - { &vop_inactive_desc, cfs_inactive }, /* inactive */ - { &vop_reclaim_desc, cfs_reclaim }, /* reclaim */ - { &vop_lock_desc, cfs_lock }, /* lock */ - { &vop_unlock_desc, cfs_unlock }, /* unlock */ - { &vop_bmap_desc, cfs_bmap }, /* bmap */ - { &vop_strategy_desc, cfs_strategy }, /* strategy */ - { &vop_print_desc, cfs_vop_error }, /* print */ - { &vop_islocked_desc, cfs_islocked }, /* islocked */ - { &vop_pathconf_desc, cfs_vop_error }, /* pathconf */ - { &vop_advlock_desc, cfs_vop_nop }, /* advlock */ - { &vop_bwrite_desc, cfs_vop_error }, /* bwrite */ - { &vop_lease_desc, cfs_vop_nop }, /* lease */ +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_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_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_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_readlink_desc, coda_readlink }, /* readlink */ + { &vop_abortop_desc, coda_abortop }, /* abortop */ + { &vop_inactive_desc, coda_inactive }, /* inactive */ + { &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_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_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_getpages_desc, cfs_fbsd_getpages }, /* pager intf.*/ - { &vop_putpages_desc, cfs_fbsd_putpages }, /* pager intf.*/ + { &vop_getpages_desc, coda_fbsd_getpages }, /* pager intf.*/ + { &vop_putpages_desc, coda_fbsd_putpages }, /* pager intf.*/ #if 0 @@ -337,28 +340,28 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } }; -static struct vnodeopv_desc cfs_vnodeop_opv_desc = - { &cfs_vnodeop_p, cfs_vnodeop_entries }; +static struct vnodeopv_desc coda_vnodeop_opv_desc = + { &coda_vnodeop_p, coda_vnodeop_entries }; -VNODEOP_SET(cfs_vnodeop_opv_desc); +VNODEOP_SET(coda_vnodeop_opv_desc); /* A generic panic: we were called with something we didn't define yet */ int -cfs_vop_error(void *anon) { +coda_vop_error(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; myprintf(("Vnode operation %s called, but not defined\n", (*desc)->vdesc_name)); - panic("cfs_vop_error"); + panic("coda_vop_error"); return 0; } /* A generic do-nothing. For lease_check, advlock */ int -cfs_vop_nop(void *anon) { +coda_vop_nop(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; - if (cfsdebug) { + if (codadebug) { myprintf(("Vnode operation %s called, but unsupported\n", (*desc)->vdesc_name)); } @@ -366,27 +369,27 @@ cfs_vop_nop(void *anon) { } int -cfs_vnodeopstats_init(void) +coda_vnodeopstats_init(void) { register int i; - for(i=0;i pair for the cache file into an inode pointer. */ - error = cfs_grab_vnode(dev, inode, &vp); + error = coda_grab_vnode(dev, inode, &vp); if (error) return (error); @@ -445,7 +448,7 @@ cfs_open(v) cp->c_ovp = vp; } else { if (cp->c_ovp != vp) - panic("cfs_open: cp->c_ovp != ITOV(ip)"); + panic("coda_open: cp->c_ovp != ITOV(ip)"); } cp->c_ocount++; @@ -463,13 +466,13 @@ cfs_open(v) /* Open the cache file. */ error = VOP_OPEN(vp, flag, cred, p); if (error) { - printf("cfs_open: VOP_OPEN on container failed %d\n", error); + printf("coda_open: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_open: vfs_object_create() returns %d\n", error); + printf("coda_open: vfs_object_create() returns %d\n", error); vput(vp); } } @@ -480,7 +483,7 @@ cfs_open(v) * Close the cache file used for I/O and notify Venus. */ int -cfs_close(v) +coda_close(v) void *v; { /* true args */ @@ -493,21 +496,21 @@ cfs_close(v) /* locals */ int error; - MARK_ENTRY(CFS_CLOSE_STATS); + MARK_ENTRY(CODA_CLOSE_STATS); /* Check for close of control file. */ if (IS_CTL_VP(vp)) { - MARK_INT_SAT(CFS_CLOSE_STATS); + MARK_INT_SAT(CODA_CLOSE_STATS); return(0); } if (IS_UNMOUNTING(cp)) { if (cp->c_ovp) { - printf("cfs_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); vgone(cp->c_ovp); } else { - printf("cfs_close: NO container vp %p/cp %p\n", vp, cp); + printf("coda_close: NO container vp %p/cp %p\n", vp, cp); } return ENODEV; } else { @@ -524,34 +527,34 @@ cfs_close(v) error = venus_close(vtomi(vp), &cp->c_fid, flag, cred, p); vrele(CTOV(cp)); - CFSDEBUG(CFS_CLOSE, myprintf(("close: result %d\n",error)); ) + CODADEBUG(CODA_CLOSE, myprintf(("close: result %d\n",error)); ) return(error); } int -cfs_read(v) +coda_read(v) void *v; { struct vop_read_args *ap = v; ENTRY; - return(cfs_rdwr(ap->a_vp, ap->a_uio, UIO_READ, + return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_READ, ap->a_ioflag, ap->a_cred, ap->a_uio->uio_procp)); } int -cfs_write(v) +coda_write(v) void *v; { struct vop_write_args *ap = v; ENTRY; - return(cfs_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE, + return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE, ap->a_ioflag, ap->a_cred, ap->a_uio->uio_procp)); } int -cfs_rdwr(vp, uiop, rw, ioflag, cred, p) +coda_rdwr(vp, uiop, rw, ioflag, cred, p) struct vnode *vp; struct uio *uiop; enum uio_rw rw; @@ -568,15 +571,15 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) int opened_internally = 0; int error = 0; - MARK_ENTRY(CFS_RDWR_STATS); + MARK_ENTRY(CODA_RDWR_STATS); - CFSDEBUG(CFS_RDWR, myprintf(("cfs_rdwr(%d, %p, %d, %qd, %d)\n", rw, + CODADEBUG(CODA_RDWR, myprintf(("coda_rdwr(%d, %p, %d, %qd, %d)\n", rw, uiop->uio_iov->iov_base, uiop->uio_resid, uiop->uio_offset, uiop->uio_segflg)); ) /* Check for rdwr of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); return(EINVAL); } @@ -595,9 +598,9 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) */ if (cp->c_inode != 0 && !(p && (p->p_acflag & ACORE))) { igot_internally = 1; - error = cfs_grab_vnode(cp->c_device, cp->c_inode, &cfvp); + error = coda_grab_vnode(cp->c_device, cp->c_inode, &cfvp); if (error) { - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); return(error); } /* @@ -608,23 +611,23 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) } else { opened_internally = 1; - MARK_INT_GEN(CFS_OPEN_STATS); + MARK_INT_GEN(CODA_OPEN_STATS); error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p); -printf("cfs_rdwr: Internally Opening %p\n", vp); +printf("coda_rdwr: Internally Opening %p\n", vp); if (error) { - printf("cfs_rdwr: VOP_OPEN on container failed %d\n", error); + printf("coda_rdwr: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_rdwr: vfs_object_create() returns %d\n", error); + printf("coda_rdwr: vfs_object_create() returns %d\n", error); vput(vp); } } if (error) { - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); return(error); } cfvp = cp->c_ovp; @@ -632,7 +635,7 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); } /* Have UFS handle the call. */ - CFSDEBUG(CFS_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n", + CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, CTOV(cp)->v_usecount)); ) @@ -650,13 +653,13 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); } if (error) - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); else - MARK_INT_SAT(CFS_RDWR_STATS); + MARK_INT_SAT(CODA_RDWR_STATS); /* Do an internal close if necessary. */ if (opened_internally) { - MARK_INT_GEN(CFS_CLOSE_STATS); + MARK_INT_GEN(CODA_CLOSE_STATS); (void)VOP_CLOSE(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p); } @@ -667,7 +670,7 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); } int -cfs_ioctl(v) +coda_ioctl(v) void *v; { /* true args */ @@ -684,17 +687,17 @@ cfs_ioctl(v) struct nameidata ndp; struct PioctlData *iap = (struct PioctlData *)data; - MARK_ENTRY(CFS_IOCTL_STATS); + MARK_ENTRY(CODA_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, myprintf(("in cfs_ioctl on %s\n", iap->path));) + CODADEBUG(CODA_IOCTL, myprintf(("in coda_ioctl on %s\n", iap->path));) /* Don't check for operation on a dying object, for ctlvp it shouldn't matter */ /* Must be control object to succeed. */ if (!IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, myprintf(("cfs_ioctl error: vp != ctlvp"));) + MARK_INT_FAIL(CODA_IOCTL_STATS); + CODADEBUG(CODA_IOCTL, myprintf(("coda_ioctl error: vp != ctlvp"));) return (EOPNOTSUPP); } /* Look up the pathname. */ @@ -707,8 +710,8 @@ cfs_ioctl(v) tvp = ndp.ni_vp; if (error) { - MARK_INT_FAIL(CFS_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, myprintf(("cfs_ioctl error: lookup returns %d\n", + MARK_INT_FAIL(CODA_IOCTL_STATS); + CODADEBUG(CODA_IOCTL, myprintf(("coda_ioctl error: lookup returns %d\n", error));) return(error); } @@ -718,11 +721,11 @@ cfs_ioctl(v) * different vfsp */ /* XXX: this totally violates the comment about vtagtype in vnode.h */ - if (tvp->v_tag != VT_CFS) { + if (tvp->v_tag != VT_CODA) { vrele(tvp); - MARK_INT_FAIL(CFS_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, - myprintf(("cfs_ioctl error: %s not a coda object\n", + MARK_INT_FAIL(CODA_IOCTL_STATS); + CODADEBUG(CODA_IOCTL, + myprintf(("coda_ioctl error: %s not a coda object\n", iap->path));) return(EINVAL); } @@ -734,9 +737,9 @@ cfs_ioctl(v) error = venus_ioctl(vtomi(tvp), &((VTOC(tvp))->c_fid), com, flag, data, cred, p); if (error) - MARK_INT_FAIL(CFS_IOCTL_STATS); + MARK_INT_FAIL(CODA_IOCTL_STATS); else - CFSDEBUG(CFS_IOCTL, myprintf(("Ioctl returns %d \n", error)); ) + CODADEBUG(CODA_IOCTL, myprintf(("Ioctl returns %d \n", error)); ) vrele(tvp); return(error); @@ -752,7 +755,7 @@ cfs_ioctl(v) * opened the file, and therefore should already have access. */ int -cfs_getattr(v) +coda_getattr(v) void *v; { /* true args */ @@ -765,41 +768,41 @@ cfs_getattr(v) /* locals */ int error; - MARK_ENTRY(CFS_GETATTR_STATS); + MARK_ENTRY(CODA_GETATTR_STATS); if (IS_UNMOUNTING(cp)) return ENODEV; /* Check for getattr of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_GETATTR_STATS); + MARK_INT_FAIL(CODA_GETATTR_STATS); return(ENOENT); } /* Check to see if the attributes have already been cached */ if (VALID_VATTR(cp)) { - CFSDEBUG(CFS_GETATTR, { myprintf(("attr cache hit: (%lx.%lx.%lx)\n", + CODADEBUG(CODA_GETATTR, { myprintf(("attr cache hit: (%lx.%lx.%lx)\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));}); - CFSDEBUG(CFS_GETATTR, if (!(cfsdebug & ~CFS_GETATTR)) + CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR)) print_vattr(&cp->c_vattr); ); *vap = cp->c_vattr; - MARK_INT_SAT(CFS_GETATTR_STATS); + MARK_INT_SAT(CODA_GETATTR_STATS); return(0); } error = venus_getattr(vtomi(vp), &cp->c_fid, cred, p, vap); if (!error) { - CFSDEBUG(CFS_GETATTR, myprintf(("getattr miss (%lx.%lx.%lx): result %d\n", + CODADEBUG(CODA_GETATTR, myprintf(("getattr miss (%lx.%lx.%lx): result %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, error)); ) - CFSDEBUG(CFS_GETATTR, if (!(cfsdebug & ~CFS_GETATTR)) + CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR)) print_vattr(vap); ); { int size = vap->va_size; @@ -809,7 +812,7 @@ cfs_getattr(v) } } /* If not open for write, store attributes in cnode */ - if ((cp->c_owrite == 0) && (cfs_attr_cache)) { + if ((cp->c_owrite == 0) && (coda_attr_cache)) { cp->c_vattr = *vap; cp->c_flags |= C_VATTR; } @@ -819,7 +822,7 @@ cfs_getattr(v) } int -cfs_setattr(v) +coda_setattr(v) void *v; { /* true args */ @@ -832,15 +835,15 @@ cfs_setattr(v) /* locals */ int error; - MARK_ENTRY(CFS_SETATTR_STATS); + MARK_ENTRY(CODA_SETATTR_STATS); /* Check for setattr of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_SETATTR_STATS); + MARK_INT_FAIL(CODA_SETATTR_STATS); return(ENOENT); } - if (cfsdebug & CFSDBGMSK(CFS_SETATTR)) { + if (codadebug & CODADBGMSK(CODA_SETATTR)) { print_vattr(vap); } error = venus_setattr(vtomi(vp), &cp->c_fid, vap, cred, p); @@ -854,12 +857,12 @@ cfs_setattr(v) vnode_pager_setsize(convp, size); } } - CFSDEBUG(CFS_SETATTR, myprintf(("setattr %d\n", error)); ) + CODADEBUG(CODA_SETATTR, myprintf(("setattr %d\n", error)); ) return(error); } int -cfs_access(v) +coda_access(v) void *v; { /* true args */ @@ -872,13 +875,13 @@ cfs_access(v) /* locals */ int error; - MARK_ENTRY(CFS_ACCESS_STATS); + MARK_ENTRY(CODA_ACCESS_STATS); /* Check for access of control object. Only read access is allowed on it. */ if (IS_CTL_VP(vp)) { /* bogus hack - all will be marked as successes */ - MARK_INT_SAT(CFS_ACCESS_STATS); + MARK_INT_SAT(CODA_ACCESS_STATS); return(((mode & VREAD) && !(mode & (VWRITE | VEXEC))) ? 0 : EACCES); } @@ -888,10 +891,10 @@ cfs_access(v) * access, and the file is in the namecache, then the user must have * lookup access to it. */ - if (cfs_access_cache) { + if (coda_access_cache) { if ((vp->v_type == VDIR) && (mode & VEXEC)) { - if (cfsnc_lookup(cp, ".", 1, cred)) { - MARK_INT_SAT(CFS_ACCESS_STATS); + if (coda_nc_lookup(cp, ".", 1, cred)) { + MARK_INT_SAT(CODA_ACCESS_STATS); return(0); /* it was in the cache */ } } @@ -903,13 +906,13 @@ cfs_access(v) } /* - * CFS abort op, called after namei() when a CREATE/DELETE isn't actually - * done. If a buffer has been saved in anticipation of a cfs_create or - * a cfs_remove, delete it. + * CODA abort op, called after namei() when a CREATE/DELETE isn't actually + * done. If a buffer has been saved in anticipation of a coda_create or + * a coda_remove, delete it. */ /* ARGSUSED */ int -cfs_abortop(v) +coda_abortop(v) void *v; { /* true args */ @@ -926,7 +929,7 @@ cfs_abortop(v) } int -cfs_readlink(v) +coda_readlink(v) void *v; { /* true args */ @@ -941,21 +944,21 @@ cfs_readlink(v) char *str; int len; - MARK_ENTRY(CFS_READLINK_STATS); + MARK_ENTRY(CODA_READLINK_STATS); /* Check for readlink of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_READLINK_STATS); + MARK_INT_FAIL(CODA_READLINK_STATS); return(ENOENT); } - if ((cfs_symlink_cache) && (VALID_SYMLINK(cp))) { /* symlink was cached */ + if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) { /* symlink was cached */ uiop->uio_rw = UIO_READ; error = uiomove(cp->c_symlink, (int)cp->c_symlen, uiop); if (error) - MARK_INT_FAIL(CFS_READLINK_STATS); + MARK_INT_FAIL(CODA_READLINK_STATS); else - MARK_INT_SAT(CFS_READLINK_STATS); + MARK_INT_SAT(CODA_READLINK_STATS); return(error); } @@ -965,20 +968,20 @@ cfs_readlink(v) uiop->uio_rw = UIO_READ; error = uiomove(str, len, uiop); - if (cfs_symlink_cache) { + if (coda_symlink_cache) { cp->c_symlink = str; cp->c_symlen = len; cp->c_flags |= C_SYMLINK; } else - CFS_FREE(str, len); + CODA_FREE(str, len); } - CFSDEBUG(CFS_READLINK, myprintf(("in readlink result %d\n",error));) + CODADEBUG(CODA_READLINK, myprintf(("in readlink result %d\n",error));) return(error); } int -cfs_fsync(v) +coda_fsync(v) void *v; { /* true args */ @@ -991,7 +994,7 @@ cfs_fsync(v) struct vnode *convp = cp->c_ovp; int error; - MARK_ENTRY(CFS_FSYNC_STATS); + MARK_ENTRY(CODA_FSYNC_STATS); /* Check for fsync on an unmounting object */ /* The NetBSD kernel, in it's infinite wisdom, can try to fsync @@ -1004,7 +1007,7 @@ cfs_fsync(v) /* Check for fsync of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_SAT(CFS_FSYNC_STATS); + MARK_INT_SAT(CODA_FSYNC_STATS); return(0); } @@ -1017,7 +1020,7 @@ cfs_fsync(v) */ /* if (!vp->v_usecount) { - printf("cfs_fsync on vnode %p with %d usecount. c_flags = %x (%x)\n", + printf("coda_fsync on vnode %p with %d usecount. c_flags = %x (%x)\n", vp, vp->v_usecount, cp->c_flags, cp->c_flags&C_PURGING); } */ @@ -1037,12 +1040,12 @@ cfs_fsync(v) return 0; error = venus_fsync(vtomi(vp), &cp->c_fid, cred, p); - CFSDEBUG(CFS_FSYNC, myprintf(("in fsync result %d\n",error)); ); + CODADEBUG(CODA_FSYNC, myprintf(("in fsync result %d\n",error)); ); return(error); } int -cfs_inactive(v) +coda_inactive(v) void *v; { /* XXX - at the moment, inactive doesn't look at cred, and doesn't @@ -1057,56 +1060,56 @@ cfs_inactive(v) /* locals */ /* We don't need to send inactive to venus - DCS */ - MARK_ENTRY(CFS_INACTIVE_STATS); + MARK_ENTRY(CODA_INACTIVE_STATS); if (IS_CTL_VP(vp)) { - MARK_INT_SAT(CFS_INACTIVE_STATS); + MARK_INT_SAT(CODA_INACTIVE_STATS); return 0; } - CFSDEBUG(CFS_INACTIVE, myprintf(("in inactive, %lx.%lx.%lx. vfsp %p\n", + CODADEBUG(CODA_INACTIVE, myprintf(("in inactive, %lx.%lx.%lx. vfsp %p\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_mount));) /* If an array has been allocated to hold the symlink, deallocate it */ - if ((cfs_symlink_cache) && (VALID_SYMLINK(cp))) { + if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) { if (cp->c_symlink == NULL) - panic("cfs_inactive: null symlink pointer in cnode"); + panic("coda_inactive: null symlink pointer in cnode"); - CFS_FREE(cp->c_symlink, cp->c_symlen); + CODA_FREE(cp->c_symlink, cp->c_symlen); cp->c_flags &= ~C_SYMLINK; cp->c_symlen = 0; } /* Remove it from the table so it can't be found. */ - cfs_unsave(cp); - if ((struct cfs_mntinfo *)(vp->v_mount->mnt_data) == NULL) { + coda_unsave(cp); + if ((struct coda_mntinfo *)(vp->v_mount->mnt_data) == NULL) { myprintf(("Help! vfsp->vfs_data was NULL, but vnode %p wasn't dying\n", vp)); - panic("badness in cfs_inactive\n"); + panic("badness in coda_inactive\n"); } if (IS_UNMOUNTING(cp)) { #ifdef DEBUG - printf("cfs_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); + printf("coda_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); if (cp->c_ovp != NULL) - printf("cfs_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", + printf("coda_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); #endif lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); } else { #ifdef DIAGNOSTIC if (CTOV(cp)->v_usecount) { - panic("cfs_inactive: nonzero reference count"); + panic("coda_inactive: nonzero reference count"); } if (cp->c_ovp != NULL) { - panic("cfs_inactive: cp->ovp != NULL"); + panic("coda_inactive: cp->ovp != NULL"); } #endif VOP_UNLOCK(vp, 0, p); vgone(vp); } - MARK_INT_SAT(CFS_INACTIVE_STATS); + MARK_INT_SAT(CODA_INACTIVE_STATS); return(0); } @@ -1118,7 +1121,7 @@ cfs_inactive(v) * It appears that in NetBSD, lookup is supposed to return the vnode locked */ int -cfs_lookup(v) +coda_lookup(v) void *v; { /* true args */ @@ -1143,23 +1146,23 @@ cfs_lookup(v) int vtype; int error = 0; - MARK_ENTRY(CFS_LOOKUP_STATS); + MARK_ENTRY(CODA_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, myprintf(("lookup: %s in %lx.%lx.%lx\n", + CODADEBUG(CODA_LOOKUP, myprintf(("lookup: %s in %lx.%lx.%lx\n", nm, dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique));); /* Check for lookup of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { - *vpp = cfs_ctlvp; + *vpp = coda_ctlvp; vref(*vpp); - MARK_INT_SAT(CFS_LOOKUP_STATS); + MARK_INT_SAT(CODA_LOOKUP_STATS); goto exit; } - if (len+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, myprintf(("name too long: lookup, %lx.%lx.%lx(%s)\n", + if (len+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_LOOKUP_STATS); + CODADEBUG(CODA_LOOKUP, myprintf(("name too long: lookup, %lx.%lx.%lx(%s)\n", dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique, nm));); *vpp = (struct vnode *)0; @@ -1168,11 +1171,11 @@ cfs_lookup(v) } /* First try to look the file up in the cfs name cache */ /* lock the parent vnode? */ - cp = cfsnc_lookup(dcp, nm, len, cred); + cp = coda_nc_lookup(dcp, nm, len, cred); if (cp) { *vpp = CTOV(cp); vref(*vpp); - CFSDEBUG(CFS_LOOKUP, + CODADEBUG(CODA_LOOKUP, myprintf(("lookup result %d vpp %p\n",error,*vpp));) } else { @@ -1180,24 +1183,24 @@ cfs_lookup(v) error = venus_lookup(vtomi(dvp), &dcp->c_fid, nm, len, cred, p, &VFid, &vtype); if (error) { - MARK_INT_FAIL(CFS_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, myprintf(("lookup error on %lx.%lx.%lx(%s)%d\n", + MARK_INT_FAIL(CODA_LOOKUP_STATS); + CODADEBUG(CODA_LOOKUP, myprintf(("lookup error on %lx.%lx.%lx(%s)%d\n", dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique, nm, error));) *vpp = (struct vnode *)0; } else { - MARK_INT_SAT(CFS_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, + MARK_INT_SAT(CODA_LOOKUP_STATS); + CODADEBUG(CODA_LOOKUP, myprintf(("lookup: vol %lx vno %lx uni %lx type %o result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, vtype, error)); ) - cp = makecfsnode(&VFid, dvp->v_mount, vtype); + cp = make_coda_node(&VFid, dvp->v_mount, vtype); *vpp = CTOV(cp); /* enter the new vnode in the Name Cache only if the top bit isn't set */ /* And don't enter a new vnode for an invalid one! */ - if (!(vtype & CFS_NOCACHE)) - cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); + if (!(vtype & CODA_NOCACHE)) + coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); } } @@ -1226,8 +1229,8 @@ cfs_lookup(v) * removal will go ahead as planned. Unfortunately, this will * probably also lock the to-be-removed vnode, which may or may * not be a good idea. I'll have to look at the bits of - * cfs_remove to make sure. We'll only save the name if we did in - * fact find the name, otherwise cfs_remove won't have a chance + * coda_remove to make sure. We'll only save the name if we did in + * fact find the name, otherwise coda_remove won't have a chance * to free the pathname. */ if ((cnp->cn_nameiop == DELETE) @@ -1257,7 +1260,7 @@ cfs_lookup(v) */ if (*ap->a_vpp) { if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { - printf("cfs_lookup: "); + printf("coda_lookup: "); panic("unlocked parent but couldn't lock child"); } } @@ -1266,7 +1269,7 @@ cfs_lookup(v) if (*ap->a_vpp && (*ap->a_vpp != dvp)) { /* Different, go ahead and lock it. */ if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { - printf("cfs_lookup: "); + printf("coda_lookup: "); panic("unlocked parent but couldn't lock child"); } } @@ -1281,7 +1284,7 @@ cfs_lookup(v) /*ARGSUSED*/ int -cfs_create(v) +coda_create(v) void *v; { /* true args */ @@ -1303,7 +1306,7 @@ cfs_create(v) ViceFid VFid; struct vattr attr; - MARK_ENTRY(CFS_CREATE_STATS); + MARK_ENTRY(CODA_CREATE_STATS); /* All creates are exclusive XXX */ /* I'm assuming the 'mode' argument is the file mode bits XXX */ @@ -1311,7 +1314,7 @@ cfs_create(v) /* Check for create of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { *vpp = (struct vnode *)0; - MARK_INT_FAIL(CFS_CREATE_STATS); + MARK_INT_FAIL(CODA_CREATE_STATS); return(EACCES); } @@ -1323,17 +1326,17 @@ cfs_create(v) /* Venus should have detected the file and reported EEXIST. */ if ((exclusive == 1) && - (cfs_find(&VFid) != NULL)) + (coda_find(&VFid) != NULL)) panic("cnode existed for newly created file!"); - cp = makecfsnode(&VFid, dvp->v_mount, attr.va_type); + cp = make_coda_node(&VFid, dvp->v_mount, attr.va_type); *vpp = CTOV(cp); /* Update va to reflect the new attributes. */ (*va) = attr; /* Update the attribute cache and mark it as valid */ - if (cfs_attr_cache) { + if (coda_attr_cache) { VTOC(*vpp)->c_vattr = attr; VTOC(*vpp)->c_flags |= C_VATTR; } @@ -1342,26 +1345,26 @@ cfs_create(v) VTOC(dvp)->c_flags &= ~C_VATTR; /* enter the new vnode in the Name Cache */ - cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); + coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); - CFSDEBUG(CFS_CREATE, + CODADEBUG(CODA_CREATE, myprintf(("create: (%lx.%lx.%lx), result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, error)); ) } else { *vpp = (struct vnode *)0; - CFSDEBUG(CFS_CREATE, myprintf(("create error %d\n", error));) + CODADEBUG(CODA_CREATE, myprintf(("create error %d\n", error));) } if (!error) { if (cnp->cn_flags & LOCKLEAF) { if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { - printf("cfs_create: "); + printf("coda_create: "); panic("unlocked parent but couldn't lock child"); } } #ifdef DIAGNOSTIC else { - printf("cfs_create: LOCKLEAF not set!\n"); + printf("coda_create: LOCKLEAF not set!\n"); } #endif /* DIAGNOSTIC */ } @@ -1377,7 +1380,7 @@ cfs_create(v) } int -cfs_remove(v) +coda_remove(v) void *v; { /* true args */ @@ -1393,13 +1396,13 @@ cfs_remove(v) int len = cnp->cn_namelen; struct cnode *tp; - MARK_ENTRY(CFS_REMOVE_STATS); + MARK_ENTRY(CODA_REMOVE_STATS); - CFSDEBUG(CFS_REMOVE, myprintf(("remove: %s in %lx.%lx.%lx\n", + CODADEBUG(CODA_REMOVE, myprintf(("remove: %s in %lx.%lx.%lx\n", nm, cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));); - /* Remove the file's entry from the CFS Name Cache */ + /* Remove the file's entry from the CODA Name Cache */ /* We're being conservative here, it might be that this person * doesn't really have sufficient access to delete the file * but we feel zapping the entry won't really hurt anyone -- dcs @@ -1409,7 +1412,7 @@ cfs_remove(v) * off by 1. We could either invalidate the attrs if cached, or * fix them. I'll try to fix them. DCS 11/8/94 */ - tp = cfsnc_lookup(VTOC(dvp), nm, len, cred); + tp = coda_nc_lookup(VTOC(dvp), nm, len, cred); if (tp) { if (VALID_VATTR(tp)) { /* If attrs are cached */ if (tp->c_vattr.va_nlink > 1) { /* If it's a hard link */ @@ -1417,7 +1420,7 @@ cfs_remove(v) } } - cfsnc_zapfile(VTOC(dvp), nm, len); + coda_nc_zapfile(VTOC(dvp), nm, len); /* No need to flush it if it doesn't exist! */ } /* Invalidate the parent's attr cache, the modification time has changed */ @@ -1425,13 +1428,13 @@ cfs_remove(v) /* Check for remove of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { - MARK_INT_FAIL(CFS_REMOVE_STATS); + MARK_INT_FAIL(CODA_REMOVE_STATS); return(ENOENT); } error = venus_remove(vtomi(dvp), &cp->c_fid, nm, len, cred, p); - CFSDEBUG(CFS_REMOVE, myprintf(("in remove result %d\n",error)); ) + CODADEBUG(CODA_REMOVE, myprintf(("in remove result %d\n",error)); ) if ((cnp->cn_flags & SAVESTART) == 0) { zfree(namei_zone, cnp->cn_pnbuf); @@ -1440,7 +1443,7 @@ cfs_remove(v) } int -cfs_link(v) +coda_link(v) void *v; { /* true args */ @@ -1457,9 +1460,9 @@ cfs_link(v) const char *nm = cnp->cn_nameptr; int len = cnp->cn_namelen; - MARK_ENTRY(CFS_LINK_STATS); + MARK_ENTRY(CODA_LINK_STATS); - if (cfsdebug & CFSDBGMSK(CFS_LINK)) { + if (codadebug & CODADBGMSK(CODA_LINK)) { myprintf(("nb_link: vp fid: (%lx.%lx.%lx)\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); @@ -1467,7 +1470,7 @@ cfs_link(v) tdcp->c_fid.Volume, tdcp->c_fid.Vnode, tdcp->c_fid.Unique)); } - if (cfsdebug & CFSDBGMSK(CFS_LINK)) { + if (codadebug & CODADBGMSK(CODA_LINK)) { myprintf(("link: vp fid: (%lx.%lx.%lx)\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); myprintf(("link: tdvp fid: (%lx.%lx.%lx)\n", @@ -1477,7 +1480,7 @@ cfs_link(v) /* Check for link to/from control object. */ if (IS_CTL_NAME(tdvp, nm, len) || IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_LINK_STATS); + MARK_INT_FAIL(CODA_LINK_STATS); return(EACCES); } @@ -1487,7 +1490,7 @@ cfs_link(v) VTOC(tdvp)->c_flags &= ~C_VATTR; VTOC(vp)->c_flags &= ~C_VATTR; - CFSDEBUG(CFS_LINK, myprintf(("in link result %d\n",error)); ) + CODADEBUG(CODA_LINK, myprintf(("in link result %d\n",error)); ) exit: @@ -1499,7 +1502,7 @@ exit: } int -cfs_rename(v) +coda_rename(v) void *v; { /* true args */ @@ -1519,7 +1522,7 @@ cfs_rename(v) const char *tnm = tcnp->cn_nameptr; int tlen = tcnp->cn_namelen; - MARK_ENTRY(CFS_RENAME_STATS); + MARK_ENTRY(CODA_RENAME_STATS); /* Hmmm. The vnodes are already looked up. Perhaps they are locked? This could be Bad. XXX */ @@ -1527,43 +1530,43 @@ cfs_rename(v) if ((fcnp->cn_cred != tcnp->cn_cred) || (fcnp->cn_proc != tcnp->cn_proc)) { - panic("cfs_rename: component names don't agree"); + panic("coda_rename: component names don't agree"); } #endif DIAGNOSTIC /* Check for rename involving control object. */ if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) { - MARK_INT_FAIL(CFS_RENAME_STATS); + MARK_INT_FAIL(CODA_RENAME_STATS); return(EACCES); } /* Problem with moving directories -- need to flush entry for .. */ if (odvp != ndvp) { - struct cnode *ovcp = cfsnc_lookup(VTOC(odvp), fnm, flen, cred); + struct cnode *ovcp = coda_nc_lookup(VTOC(odvp), fnm, flen, cred); if (ovcp) { struct vnode *ovp = CTOV(ovcp); if ((ovp) && (ovp->v_type == VDIR)) /* If it's a directory */ - cfsnc_zapfile(VTOC(ovp),"..", 2); + coda_nc_zapfile(VTOC(ovp),"..", 2); } } /* Remove the entries for both source and target files */ - cfsnc_zapfile(VTOC(odvp), fnm, flen); - cfsnc_zapfile(VTOC(ndvp), tnm, tlen); + coda_nc_zapfile(VTOC(odvp), fnm, flen); + coda_nc_zapfile(VTOC(ndvp), tnm, tlen); /* Invalidate the parent's attr cache, the modification time has changed */ VTOC(odvp)->c_flags &= ~C_VATTR; VTOC(ndvp)->c_flags &= ~C_VATTR; - if (flen+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_RENAME_STATS); + if (flen+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_RENAME_STATS); error = EINVAL; goto exit; } - if (tlen+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_RENAME_STATS); + if (tlen+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_RENAME_STATS); error = EINVAL; goto exit; } @@ -1571,7 +1574,7 @@ cfs_rename(v) error = venus_rename(vtomi(odvp), &odcp->c_fid, &ndcp->c_fid, fnm, flen, tnm, tlen, cred, p); exit: - CFSDEBUG(CFS_RENAME, myprintf(("in rename result %d\n",error));) + CODADEBUG(CODA_RENAME, myprintf(("in rename result %d\n",error));) /* XXX - do we need to call cache pureg on the moved vnode? */ cache_purge(ap->a_fvp); @@ -1594,7 +1597,7 @@ cfs_rename(v) } int -cfs_mkdir(v) +coda_mkdir(v) void *v; { /* true args */ @@ -1614,39 +1617,39 @@ cfs_mkdir(v) ViceFid VFid; struct vattr ova; - MARK_ENTRY(CFS_MKDIR_STATS); + MARK_ENTRY(CODA_MKDIR_STATS); /* Check for mkdir of target object. */ if (IS_CTL_NAME(dvp, nm, len)) { *vpp = (struct vnode *)0; - MARK_INT_FAIL(CFS_MKDIR_STATS); + MARK_INT_FAIL(CODA_MKDIR_STATS); return(EACCES); } - if (len+1 > CFS_MAXNAMLEN) { + if (len+1 > CODA_MAXNAMLEN) { *vpp = (struct vnode *)0; - MARK_INT_FAIL(CFS_MKDIR_STATS); + MARK_INT_FAIL(CODA_MKDIR_STATS); return(EACCES); } error = venus_mkdir(vtomi(dvp), &dcp->c_fid, nm, len, va, cred, p, &VFid, &ova); if (!error) { - if (cfs_find(&VFid) != NULL) + if (coda_find(&VFid) != NULL) panic("cnode existed for newly created directory!"); - cp = makecfsnode(&VFid, dvp->v_mount, va->va_type); + cp = make_coda_node(&VFid, dvp->v_mount, va->va_type); *vpp = CTOV(cp); /* enter the new vnode in the Name Cache */ - cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); + coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); /* as a side effect, enter "." and ".." for the directory */ - cfsnc_enter(VTOC(*vpp), ".", 1, cred, VTOC(*vpp)); - cfsnc_enter(VTOC(*vpp), "..", 2, cred, VTOC(dvp)); + coda_nc_enter(VTOC(*vpp), ".", 1, cred, VTOC(*vpp)); + coda_nc_enter(VTOC(*vpp), "..", 2, cred, VTOC(dvp)); - if (cfs_attr_cache) { + if (coda_attr_cache) { VTOC(*vpp)->c_vattr = ova; /* update the attr cache */ VTOC(*vpp)->c_flags |= C_VATTR; /* Valid attributes in cnode */ } @@ -1654,11 +1657,11 @@ cfs_mkdir(v) /* Invalidate the parent's attr cache, the modification time has changed */ VTOC(dvp)->c_flags &= ~C_VATTR; - CFSDEBUG( CFS_MKDIR, myprintf(("mkdir: (%lx.%lx.%lx) result %d\n", + CODADEBUG( CODA_MKDIR, myprintf(("mkdir: (%lx.%lx.%lx) result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, error)); ) } else { *vpp = (struct vnode *)0; - CFSDEBUG(CFS_MKDIR, myprintf(("mkdir error %d\n",error));) + CODADEBUG(CODA_MKDIR, myprintf(("mkdir error %d\n",error));) } /* Have to free the previously saved name */ @@ -1673,7 +1676,7 @@ cfs_mkdir(v) } int -cfs_rmdir(v) +coda_rmdir(v) void *v; { /* true args */ @@ -1689,11 +1692,11 @@ cfs_rmdir(v) int len = cnp->cn_namelen; struct cnode *cp; - MARK_ENTRY(CFS_RMDIR_STATS); + MARK_ENTRY(CODA_RMDIR_STATS); /* Check for rmdir of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { - MARK_INT_FAIL(CFS_RMDIR_STATS); + MARK_INT_FAIL(CODA_RMDIR_STATS); return(ENOENT); } @@ -1705,18 +1708,18 @@ cfs_rmdir(v) * As a side effect of the rmdir, remove any entries for children of * the directory, especially "." and "..". */ - cp = cfsnc_lookup(dcp, nm, len, cred); - if (cp) cfsnc_zapParentfid(&(cp->c_fid), NOT_DOWNCALL); + cp = coda_nc_lookup(dcp, nm, len, cred); + if (cp) coda_nc_zapParentfid(&(cp->c_fid), NOT_DOWNCALL); - /* Remove the file's entry from the CFS Name Cache */ - cfsnc_zapfile(dcp, nm, len); + /* Remove the file's entry from the CODA Name Cache */ + coda_nc_zapfile(dcp, nm, len); /* Invalidate the parent's attr cache, the modification time has changed */ dcp->c_flags &= ~C_VATTR; error = venus_rmdir(vtomi(dvp), &dcp->c_fid, nm, len, cred, p); - CFSDEBUG(CFS_RMDIR, myprintf(("in rmdir result %d\n", error)); ) + CODADEBUG(CODA_RMDIR, myprintf(("in rmdir result %d\n", error)); ) if ((cnp->cn_flags & SAVESTART) == 0) { zfree(namei_zone, cnp->cn_pnbuf); @@ -1725,7 +1728,7 @@ cfs_rmdir(v) } int -cfs_symlink(v) +coda_symlink(v) void *v; { /* true args */ @@ -1740,7 +1743,7 @@ cfs_symlink(v) /* locals */ int error; /* - * XXX I'm assuming the following things about cfs_symlink's + * XXX I'm assuming the following things about coda_symlink's * arguments: * t(foo) is the new name/parent/etc being created. * lname is the contents of the new symlink. @@ -1760,21 +1763,21 @@ cfs_symlink(v) * returns the resultant vnode in a vpp argument. */ - MARK_ENTRY(CFS_SYMLINK_STATS); + MARK_ENTRY(CODA_SYMLINK_STATS); /* Check for symlink of control object. */ if (IS_CTL_NAME(tdvp, nm, len)) { - MARK_INT_FAIL(CFS_SYMLINK_STATS); + MARK_INT_FAIL(CODA_SYMLINK_STATS); return(EACCES); } - if (plen+1 > CFS_MAXPATHLEN) { - MARK_INT_FAIL(CFS_SYMLINK_STATS); + if (plen+1 > CODA_MAXPATHLEN) { + MARK_INT_FAIL(CODA_SYMLINK_STATS); return(EINVAL); } - if (len+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_SYMLINK_STATS); + if (len+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_SYMLINK_STATS); error = EINVAL; goto exit; } @@ -1792,7 +1795,7 @@ cfs_symlink(v) } exit: - CFSDEBUG(CFS_SYMLINK, myprintf(("in symlink result %d\n",error)); ) + CODADEBUG(CODA_SYMLINK, myprintf(("in symlink result %d\n",error)); ) return(error); } @@ -1800,7 +1803,7 @@ cfs_symlink(v) * Read directory entries. */ int -cfs_readdir(v) +coda_readdir(v) void *v; { /* true args */ @@ -1817,13 +1820,13 @@ cfs_readdir(v) /* locals */ int error = 0; - MARK_ENTRY(CFS_READDIR_STATS); + MARK_ENTRY(CODA_READDIR_STATS); - CFSDEBUG(CFS_READDIR, myprintf(("cfs_readdir(%p, %d, %qd, %d)\n", uiop->uio_iov->iov_base, uiop->uio_resid, uiop->uio_offset, uiop->uio_segflg)); ) + CODADEBUG(CODA_READDIR, myprintf(("coda_readdir(%p, %d, %qd, %d)\n", uiop->uio_iov->iov_base, uiop->uio_resid, uiop->uio_offset, uiop->uio_segflg)); ) /* Check for readdir of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_READDIR_STATS); + MARK_INT_FAIL(CODA_READDIR_STATS); return(ENOENT); } @@ -1832,17 +1835,17 @@ cfs_readdir(v) int opened_internally = 0; if (cp->c_ovp == NULL) { opened_internally = 1; - MARK_INT_GEN(CFS_OPEN_STATS); + MARK_INT_GEN(CODA_OPEN_STATS); error = VOP_OPEN(vp, FREAD, cred, p); -printf("cfs_readdir: Internally Opening %p\n", vp); +printf("coda_readdir: Internally Opening %p\n", vp); if (error) { - printf("cfs_readdir: VOP_OPEN on container failed %d\n", error); + printf("coda_readdir: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_readdir: vfs_object_create() returns %d\n", error); + printf("coda_readdir: vfs_object_create() returns %d\n", error); vput(vp); } } @@ -1850,18 +1853,18 @@ printf("cfs_readdir: Internally Opening %p\n", vp); } /* Have UFS handle the call. */ - CFSDEBUG(CFS_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) + CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies, cookies); if (error) - MARK_INT_FAIL(CFS_READDIR_STATS); + MARK_INT_FAIL(CODA_READDIR_STATS); else - MARK_INT_SAT(CFS_READDIR_STATS); + MARK_INT_SAT(CODA_READDIR_STATS); /* Do an "internal close" if necessary. */ if (opened_internally) { - MARK_INT_GEN(CFS_CLOSE_STATS); + MARK_INT_GEN(CODA_CLOSE_STATS); (void)VOP_CLOSE(vp, FREAD, cred, p); } } @@ -1873,7 +1876,7 @@ printf("cfs_readdir: Internally Opening %p\n", vp); * Convert from file system blocks to device blocks */ int -cfs_bmap(v) +coda_bmap(v) void *v; { /* XXX on the global proc */ @@ -1892,13 +1895,13 @@ cfs_bmap(v) cp = VTOC(vp); if (cp->c_ovp) { - printf("cfs_bmap: container .. "); + printf("coda_bmap: container .. "); ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb); 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); return ret; } else { - printf("cfs_bmap: no container\n"); + printf("coda_bmap: no container\n"); return(EOPNOTSUPP); } } @@ -1911,7 +1914,7 @@ cfs_bmap(v) * int async_daemon_count; */ int -cfs_strategy(v) +coda_strategy(v) void *v; { /* true args */ @@ -1921,12 +1924,12 @@ cfs_strategy(v) /* upcall decl */ /* locals */ - printf("cfs_strategy: called ???\n"); + printf("coda_strategy: called ???\n"); return(EOPNOTSUPP); } int -cfs_reclaim(v) +coda_reclaim(v) void *v; { /* true args */ @@ -1945,26 +1948,26 @@ cfs_reclaim(v) #ifdef DEBUG if (VTOC(vp)->c_ovp) { if (IS_UNMOUNTING(cp)) - printf("cfs_reclaim: c_ovp not void: vp %p, cp %p\n", vp, cp); + printf("coda_reclaim: c_ovp not void: vp %p, cp %p\n", vp, cp); } #endif } else { #ifdef DIAGNOSTIC if (vp->v_usecount != 0) - vprint("cfs_reclaim: pushing active", vp); + vprint("coda_reclaim: pushing active", vp); if (VTOC(vp)->c_ovp) { - panic("cfs_reclaim: c_ovp not void"); + panic("coda_reclaim: c_ovp not void"); } #endif DIAGNOSTIC } cache_purge(vp); - cfs_free(VTOC(vp)); + coda_free(VTOC(vp)); VTOC(vp) = NULL; return (0); } int -cfs_lock(v) +coda_lock(v) void *v; { /* true args */ @@ -1977,7 +1980,7 @@ cfs_lock(v) ENTRY; - if (cfs_lockdebug) { + if (coda_lockdebug) { myprintf(("Attempting lock on %lx.%lx.%lx\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } @@ -1986,7 +1989,7 @@ cfs_lock(v) } int -cfs_unlock(v) +coda_unlock(v) void *v; { /* true args */ @@ -1998,7 +2001,7 @@ cfs_unlock(v) /* locals */ ENTRY; - if (cfs_lockdebug) { + if (coda_lockdebug) { myprintf(("Attempting unlock on %lx.%lx.%lx\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } @@ -2007,7 +2010,7 @@ cfs_unlock(v) } int -cfs_islocked(v) +coda_islocked(v) void *v; { /* true args */ @@ -2020,21 +2023,21 @@ cfs_islocked(v) /* How one looks up a vnode given a device/inode pair: */ int -cfs_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp) +coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp) { /* This is like VFS_VGET() or igetinode()! */ int error; struct mount *mp; if (!(mp = devtomp(dev))) { - myprintf(("cfs_grab_vnode: devtomp(%d) returns NULL\n", dev)); + myprintf(("coda_grab_vnode: devtomp(%d) returns NULL\n", dev)); return(ENXIO); } /* XXX - ensure that nonzero-return means failure */ error = VFS_VGET(mp,ino,vpp); if (error) { - myprintf(("cfs_grab_vnode: iget/vget(%d, %d) returns %p, err %d\n", + myprintf(("coda_grab_vnode: iget/vget(%d, %d) returns %p, err %d\n", dev, ino, *vpp, error)); return(ENOENT); } @@ -2120,31 +2123,31 @@ print_cred(cred) * If no cnode exists for this fid create one and put it * in a table hashed by fid.Volume and fid.Vnode. If the cnode for * this fid is already in the table return it (ref count is - * incremented by cfs_find. The cnode will be flushed from the - * table when cfs_inactive calls cfs_unsave. + * incremented by coda_find. The cnode will be flushed from the + * table when coda_inactive calls coda_unsave. */ struct cnode * -makecfsnode(fid, vfsp, type) +make_coda_node(fid, vfsp, type) ViceFid *fid; struct mount *vfsp; short type; { struct cnode *cp; int err; - if ((cp = cfs_find(fid)) == NULL) { + if ((cp = coda_find(fid)) == NULL) { struct vnode *vp; - cp = cfs_alloc(); + cp = coda_alloc(); lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); cp->c_fid = *fid; - err = getnewvnode(VT_CFS, vfsp, cfs_vnodeop_p, &vp); + err = getnewvnode(VT_CODA, vfsp, coda_vnodeop_p, &vp); if (err) { - panic("cfs: getnewvnode returned error %d\n", err); + panic("coda: getnewvnode returned error %d\n", err); } vp->v_data = cp; vp->v_type = type; cp->c_vnode = vp; - cfs_save(cp); + coda_save(cp); } else { vref(CTOV(cp)); diff --git a/sys/coda/coda_vnops.h b/sys/coda/coda_vnops.h index f965c93..9ed3387 100644 --- a/sys/coda/coda_vnops.h +++ b/sys/coda/coda_vnops.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfs_vnodeops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfs_vnodeops.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -48,6 +48,9 @@ /* * HISTORY * $Log: cfs_vnodeops.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -64,7 +67,7 @@ * Sync the code for NetBSD -current; test on 1.3 later * * Revision 1.4 98/01/23 11:53:49 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.3.2.3 98/01/23 11:21:13 rvb * Sync with 2.2.5 @@ -73,7 +76,7 @@ * Sync with 1.3 * * Revision 1.3.2.1 97/12/10 14:08:34 rvb - * Fix O_ flags; check result in cfscall + * Fix O_ flags; check result in coda_call * * Revision 1.3 97/12/05 10:39:25 rvb * Read CHANGES @@ -88,48 +91,48 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:40 bnoble - * Added CFS-specific files + * Added CODA-specific files * */ /* NetBSD interfaces to the vnodeops */ -int cfs_open __P((void *)); -int cfs_close __P((void *)); -int cfs_read __P((void *)); -int cfs_write __P((void *)); -int cfs_ioctl __P((void *)); +int coda_open __P((void *)); +int coda_close __P((void *)); +int coda_read __P((void *)); +int coda_write __P((void *)); +int coda_ioctl __P((void *)); /* 1.3 int cfs_select __P((void *));*/ -int cfs_getattr __P((void *)); -int cfs_setattr __P((void *)); -int cfs_access __P((void *)); -int cfs_abortop __P((void *)); -int cfs_readlink __P((void *)); -int cfs_fsync __P((void *)); -int cfs_inactive __P((void *)); -int cfs_lookup __P((void *)); -int cfs_create __P((void *)); -int cfs_remove __P((void *)); -int cfs_link __P((void *)); -int cfs_rename __P((void *)); -int cfs_mkdir __P((void *)); -int cfs_rmdir __P((void *)); -int cfs_symlink __P((void *)); -int cfs_readdir __P((void *)); -int cfs_bmap __P((void *)); -int cfs_strategy __P((void *)); -int cfs_reclaim __P((void *)); -int cfs_lock __P((void *)); -int cfs_unlock __P((void *)); -int cfs_islocked __P((void *)); -int cfs_vop_error __P((void *)); -int cfs_vop_nop __P((void *)); -int cfs_fbsd_getpages __P((void *)); -int cfs_fbsd_putpages __P((void *)); +int coda_getattr __P((void *)); +int coda_setattr __P((void *)); +int coda_access __P((void *)); +int coda_abortop __P((void *)); +int coda_readlink __P((void *)); +int coda_fsync __P((void *)); +int coda_inactive __P((void *)); +int coda_lookup __P((void *)); +int coda_create __P((void *)); +int coda_remove __P((void *)); +int coda_link __P((void *)); +int coda_rename __P((void *)); +int coda_mkdir __P((void *)); +int coda_rmdir __P((void *)); +int coda_symlink __P((void *)); +int coda_readdir __P((void *)); +int coda_bmap __P((void *)); +int coda_strategy __P((void *)); +int coda_reclaim __P((void *)); +int coda_lock __P((void *)); +int coda_unlock __P((void *)); +int coda_islocked __P((void *)); +int coda_vop_error __P((void *)); +int coda_vop_nop __P((void *)); +int coda_fbsd_getpages __P((void *)); +int coda_fbsd_putpages __P((void *)); -int (**cfs_vnodeop_p)(void *); +int (**coda_vnodeop_p)(void *); -int cfs_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, +int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct proc *p); -int cfs_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); +int coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); void print_vattr(struct vattr *attr); void print_cred(struct ucred *cred); diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 21566c3..a78f954 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2,7 +2,7 @@ # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.460 1998/09/10 08:20:46 sos Exp $ +# $Id: LINT,v 1.461 1998/09/10 11:23:08 sos Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -552,9 +552,9 @@ options "NFS_WDELAYHASHSIZ=16" # and with this options "NFS_MUIDHASHSIZ=63" # Tune the size of nfsmount with this options NFS_DEBUG # Enable NFS Debugging -# CFS stuff: -#options CFS #CODA filesystem. -#pseudo-device vcfs 4 #coda minicache <-> venus comm. +# Coda stuff: +options CODA #CODA filesystem. +pseudo-device vcoda 4 #coda minicache <-> venus comm. ##################################################################### diff --git a/sys/conf/files b/sys/conf/files index 7c56788..8e09811 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -43,13 +43,13 @@ bus_if.h standard \ compile-with "sh $S/kern/makedevops.sh -h $S/kern/bus_if.m" \ no-obj no-implicit-rule before-depend \ clean "bus_if.h" -cfs/cfs_namecache.c optional vcfs -cfs/cfs_fbsd.c optional vcfs -cfs/cfs_psdev.c optional vcfs -cfs/cfs_subr.c optional vcfs -cfs/cfs_venus.c optional vcfs -cfs/cfs_vfsops.c optional vcfs -cfs/cfs_vnodeops.c optional vcfs +cfs/cfs_namecache.c optional vcoda +cfs/cfs_fbsd.c optional vcoda +cfs/cfs_psdev.c optional vcoda +cfs/cfs_subr.c optional vcoda +cfs/cfs_venus.c optional vcoda +cfs/cfs_vfsops.c optional vcoda +cfs/cfs_vnodeops.c optional vcoda ddb/db_access.c optional ddb ddb/db_kld.c optional ddb db_kld_symbols ddb/db_elf.c optional ddb db_elf_symbols diff --git a/sys/conf/options b/sys/conf/options index 0a07915..1edf4d2 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1,4 +1,4 @@ -# $Id: options,v 1.91 1998/08/26 12:13:39 sos Exp $ +# $Id: options,v 1.94 1998/08/31 18:37:19 sos Exp $ # # On the handling of kernel options # @@ -87,7 +87,7 @@ UMAPFS opt_dontuse.h # statically compiled into the kernel, code for mounting them as root # filesystems will be enabled - but look below. Boot-code is purposely # unavailable for the LKM-based versions. -CFS +CODA CD9660 FFS NFS diff --git a/sys/fs/coda/cnode.h b/sys/fs/coda/cnode.h index 9f29ca9..cefc6a8 100644 --- a/sys/fs/coda/cnode.h +++ b/sys/fs/coda/cnode.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cnode.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cnode.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -47,6 +47,9 @@ /* * HISTORY * $Log: cnode.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -69,7 +72,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.5 98/01/23 11:53:51 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.4.2.5 98/01/23 11:21:14 rvb * Sync with 2.2.5 @@ -103,7 +106,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:53 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:23 bnoble * Branch for NetBSD port revisions @@ -152,7 +155,7 @@ #include #include -MALLOC_DECLARE(M_CFS); +MALLOC_DECLARE(M_CODA); /* * tmp below since we need struct queue @@ -161,41 +164,41 @@ MALLOC_DECLARE(M_CFS); /* * Cnode lookup stuff. - * NOTE: CFS_CACHESIZE must be a power of 2 for cfshash to work! + * NOTE: CODA_CACHESIZE must be a power of 2 for cfshash to work! */ -#define CFS_CACHESIZE 512 +#define CODA_CACHESIZE 512 -#define CFS_ALLOC(ptr, cast, size) \ +#define CODA_ALLOC(ptr, cast, size) \ do { \ - ptr = (cast)malloc((unsigned long) size, M_CFS, M_WAITOK); \ + ptr = (cast)malloc((unsigned long) size, M_CODA, M_WAITOK); \ if (ptr == 0) { \ panic("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ } \ } while (0) -#define CFS_FREE(ptr, size) free((ptr), M_CFS) +#define CODA_FREE(ptr, size) free((ptr), M_CODA) /* * global cache state control */ -extern int cfsnc_use; +extern int coda_nc_use; /* * Used to select debugging statements throughout the cfs code. */ -extern int cfsdebug; -extern int cfsnc_debug; -extern int cfs_printf_delay; -extern int cfs_vnop_print_entry; -extern int cfs_psdev_print_entry; -extern int cfs_vfsop_print_entry; +extern int codadebug; +extern int coda_nc_debug; +extern int coda_printf_delay; +extern int coda_vnop_print_entry; +extern int coda_psdev_print_entry; +extern int coda_vfsop_print_entry; -#define CFSDBGMSK(N) (1 << N) -#define CFSDEBUG(N, STMT) { if (cfsdebug & CFSDBGMSK(N)) { STMT } } +#define CODADBGMSK(N) (1 << N) +#define CODADEBUG(N, STMT) { if (codadebug & CODADBGMSK(N)) { STMT } } #define myprintf(args) \ do { \ - if (cfs_printf_delay) \ - DELAY(cfs_printf_delay);\ + if (coda_printf_delay) \ + DELAY(coda_printf_delay);\ printf args ; \ } while (0) @@ -240,42 +243,42 @@ struct vcomm { #define MARK_VC_CLOSED(vcp) (vcp)->vc_requests.forw = NULL; #define MARK_VC_OPEN(vcp) /* MT */ -struct cfs_clstat { +struct coda_clstat { int ncalls; /* client requests */ int nbadcalls; /* upcall failures */ - int reqs[CFS_NCALLS]; /* count of each request */ + int reqs[CODA_NCALLS]; /* count of each request */ }; -extern struct cfs_clstat cfs_clstat; +extern struct coda_clstat coda_clstat; /* - * CFS structure to hold mount/file system information + * CODA structure to hold mount/file system information */ -struct cfs_mntinfo { +struct coda_mntinfo { struct vnode *mi_rootvp; struct mount *mi_vfsp; struct vcomm mi_vcomm; }; -extern struct cfs_mntinfo cfs_mnttbl[]; /* indexed by minor device number */ +extern struct coda_mntinfo coda_mnttbl[]; /* indexed by minor device number */ /* * vfs pointer to mount info */ -#define vftomi(vfsp) ((struct cfs_mntinfo *)(vfsp->mnt_data)) -#define CFS_MOUNTED(vfsp) (vftomi((vfsp)) != (struct cfs_mntinfo *)0) +#define vftomi(vfsp) ((struct coda_mntinfo *)(vfsp->mnt_data)) +#define CODA_MOUNTED(vfsp) (vftomi((vfsp)) != (struct coda_mntinfo *)0) /* * vnode pointer to mount info */ -#define vtomi(vp) ((struct cfs_mntinfo *)(vp->v_mount->mnt_data)) +#define vtomi(vp) ((struct coda_mntinfo *)(vp->v_mount->mnt_data)) /* * Used for identifying usage of "Control" object */ -extern struct vnode *cfs_ctlvp; -#define IS_CTL_VP(vp) ((vp) == cfs_ctlvp) -#define IS_CTL_NAME(vp, name, l)((l == CFS_CONTROLLEN) \ +extern struct vnode *coda_ctlvp; +#define IS_CTL_VP(vp) ((vp) == coda_ctlvp) +#define IS_CTL_NAME(vp, name, l)((l == CODA_CONTROLLEN) \ && ((vp) == vtomi((vp))->mi_rootvp) \ - && strncmp(name, CFS_CONTROL, l) == 0) + && strncmp(name, CODA_CONTROL, l) == 0) /* * An enum to tell us whether something that will remove a reference @@ -287,22 +290,22 @@ enum dc_status { }; /* cfs_psdev.h */ -int cfscall(struct cfs_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); +int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer); /* cfs_subr.h */ int handleDownCall(int opcode, union outputArgs *out); -void cfs_unmounting(struct mount *whoIam); -int cfs_vmflush(struct cnode *cp); +void coda_unmounting(struct mount *whoIam); +int coda_vmflush(struct cnode *cp); /* cfs_vnodeops.h */ -struct cnode *makecfsnode(ViceFid *fid, struct mount *vfsp, short type); -int cfs_vnodeopstats_init(void); +struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type); +int coda_vnodeopstats_init(void); -/* cfs_vfsops.h */ +/* coda_vfsops.h */ struct mount *devtomp(dev_t dev); /* sigh */ -#define CFS_RDWR ((u_long) 31) +#define CODA_RDWR ((u_long) 31) #endif /* _CNODE_H_ */ diff --git a/sys/fs/coda/coda.h b/sys/fs/coda/coda.h index 09268b6..45a30ba 100644 --- a/sys/fs/coda/coda.h +++ b/sys/fs/coda/coda.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/coda.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: coda.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -37,8 +37,8 @@ * Linux modifications by Peter Braam, Aug 1996 */ -#ifndef _CFS_HEADER_ -#define _CFS_HEADER_ +#ifndef _CODA_HEADER_ +#define _CODA_HEADER_ /* Catch new _KERNEL defn for NetBSD */ #ifdef __NetBSD__ @@ -65,11 +65,11 @@ struct timespec { /* - * Cfs constants + * Coda constants */ -#define CFS_MAXNAMLEN 255 -#define CFS_MAXPATHLEN 1024 -#define CFS_MAXSYMLINK 10 +#define CODA_MAXNAMLEN 255 +#define CODA_MAXPATHLEN 1024 +#define CODA_MAXSYMLINK 10 /* these are Coda's version of O_RDONLY etc combinations * to deal with VFS open modes @@ -98,10 +98,10 @@ struct venus_dirent { unsigned short d_reclen; /* length of this record */ char d_type; /* file type, see below */ char d_namlen; /* length of string in d_name */ - char d_name[CFS_MAXNAMLEN + 1];/* name must be no longer than this */ + char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */ }; #undef DIRSIZ -#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CFS_MAXNAMLEN+1)) + \ +#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \ (((dp)->d_namlen+1 + 3) &~ 3)) /* @@ -203,38 +203,38 @@ struct coda_vattr { * Kernel <--> Venus communications. */ -#define CFS_ROOT ((u_long) 2) -#define CFS_SYNC ((u_long) 3) -#define CFS_OPEN ((u_long) 4) -#define CFS_CLOSE ((u_long) 5) -#define CFS_IOCTL ((u_long) 6) -#define CFS_GETATTR ((u_long) 7) -#define CFS_SETATTR ((u_long) 8) -#define CFS_ACCESS ((u_long) 9) -#define CFS_LOOKUP ((u_long) 10) -#define CFS_CREATE ((u_long) 11) -#define CFS_REMOVE ((u_long) 12) -#define CFS_LINK ((u_long) 13) -#define CFS_RENAME ((u_long) 14) -#define CFS_MKDIR ((u_long) 15) -#define CFS_RMDIR ((u_long) 16) -#define CFS_READDIR ((u_long) 17) -#define CFS_SYMLINK ((u_long) 18) -#define CFS_READLINK ((u_long) 19) -#define CFS_FSYNC ((u_long) 20) -#define CFS_INACTIVE ((u_long) 21) -#define CFS_VGET ((u_long) 22) -#define CFS_SIGNAL ((u_long) 23) -#define CFS_REPLACE ((u_long) 24) -#define CFS_FLUSH ((u_long) 25) -#define CFS_PURGEUSER ((u_long) 26) -#define CFS_ZAPFILE ((u_long) 27) -#define CFS_ZAPDIR ((u_long) 28) -#define CFS_ZAPVNODE ((u_long) 29) -#define CFS_PURGEFID ((u_long) 30) -#define CFS_NCALLS 31 - -#define DOWNCALL(opcode) (opcode >= CFS_REPLACE && opcode <= CFS_PURGEFID) +#define CODA_ROOT ((u_long) 2) +#define CODA_SYNC ((u_long) 3) +#define CODA_OPEN ((u_long) 4) +#define CODA_CLOSE ((u_long) 5) +#define CODA_IOCTL ((u_long) 6) +#define CODA_GETATTR ((u_long) 7) +#define CODA_SETATTR ((u_long) 8) +#define CODA_ACCESS ((u_long) 9) +#define CODA_LOOKUP ((u_long) 10) +#define CODA_CREATE ((u_long) 11) +#define CODA_REMOVE ((u_long) 12) +#define CODA_LINK ((u_long) 13) +#define CODA_RENAME ((u_long) 14) +#define CODA_MKDIR ((u_long) 15) +#define CODA_RMDIR ((u_long) 16) +#define CODA_READDIR ((u_long) 17) +#define CODA_SYMLINK ((u_long) 18) +#define CODA_READLINK ((u_long) 19) +#define CODA_FSYNC ((u_long) 20) +#define CODA_INACTIVE ((u_long) 21) +#define CODA_VGET ((u_long) 22) +#define CODA_SIGNAL ((u_long) 23) +#define CODA_REPLACE ((u_long) 24) +#define CODA_FLUSH ((u_long) 25) +#define CODA_PURGEUSER ((u_long) 26) +#define CODA_ZAPFILE ((u_long) 27) +#define CODA_ZAPDIR ((u_long) 28) +#define CODA_ZAPVNODE ((u_long) 29) +#define CODA_PURGEFID ((u_long) 30) +#define CODA_NCALLS 31 + +#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) #define VC_MAXDATASIZE 8192 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\ @@ -245,7 +245,7 @@ struct coda_vattr { /* * Venus <-> Coda RPC arguments */ -struct cfs_in_hdr { +struct coda_in_hdr { unsigned long opcode; unsigned long unique; /* Keep multiple outstanding msgs distinct */ u_short pid; /* Common to all */ @@ -255,53 +255,53 @@ struct cfs_in_hdr { }; /* Really important that opcode and unique are 1st two fields! */ -struct cfs_out_hdr { +struct coda_out_hdr { unsigned long opcode; unsigned long unique; unsigned long result; }; -/* cfs_root: NO_IN */ -struct cfs_root_out { - struct cfs_out_hdr oh; +/* coda_root: NO_IN */ +struct coda_root_out { + struct coda_out_hdr oh; ViceFid VFid; }; -struct cfs_root_in { - struct cfs_in_hdr in; +struct coda_root_in { + struct coda_in_hdr in; }; -/* cfs_sync: */ -/* Nothing needed for cfs_sync */ +/* coda_sync: */ +/* Nothing needed for coda_sync */ -/* cfs_open: */ -struct cfs_open_in { - struct cfs_in_hdr ih; +/* coda_open: */ +struct coda_open_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_open_out { - struct cfs_out_hdr oh; +struct coda_open_out { + struct coda_out_hdr oh; cdev_t dev; ino_t inode; }; -/* cfs_close: */ -struct cfs_close_in { - struct cfs_in_hdr ih; +/* coda_close: */ +struct coda_close_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_close_out { - struct cfs_out_hdr out; +struct coda_close_out { + struct coda_out_hdr out; }; -/* cfs_ioctl: */ -struct cfs_ioctl_in { - struct cfs_in_hdr ih; +/* coda_ioctl: */ +struct coda_ioctl_in { + struct coda_in_hdr ih; ViceFid VFid; int cmd; int len; @@ -309,64 +309,64 @@ struct cfs_ioctl_in { char *data; /* Place holder for data. */ }; -struct cfs_ioctl_out { - struct cfs_out_hdr oh; +struct coda_ioctl_out { + struct coda_out_hdr oh; int len; caddr_t data; /* Place holder for data. */ }; -/* cfs_getattr: */ -struct cfs_getattr_in { - struct cfs_in_hdr ih; +/* coda_getattr: */ +struct coda_getattr_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_getattr_out { - struct cfs_out_hdr oh; +struct coda_getattr_out { + struct coda_out_hdr oh; struct coda_vattr attr; }; -/* cfs_setattr: NO_OUT */ -struct cfs_setattr_in { - struct cfs_in_hdr ih; +/* coda_setattr: NO_OUT */ +struct coda_setattr_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; }; -struct cfs_setattr_out { - struct cfs_out_hdr out; +struct coda_setattr_out { + struct coda_out_hdr out; }; -/* cfs_access: NO_OUT */ -struct cfs_access_in { - struct cfs_in_hdr ih; +/* coda_access: NO_OUT */ +struct coda_access_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_access_out { - struct cfs_out_hdr out; +struct coda_access_out { + struct coda_out_hdr out; }; -/* cfs_lookup: */ -struct cfs_lookup_in { - struct cfs_in_hdr ih; +/* coda_lookup: */ +struct coda_lookup_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_lookup_out { - struct cfs_out_hdr oh; +struct coda_lookup_out { + struct coda_out_hdr oh; ViceFid VFid; int vtype; }; -/* cfs_create: */ -struct cfs_create_in { - struct cfs_in_hdr ih; +/* coda_create: */ +struct coda_create_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; int excl; @@ -374,188 +374,188 @@ struct cfs_create_in { int name; /* Place holder for data. */ }; -struct cfs_create_out { - struct cfs_out_hdr oh; +struct coda_create_out { + struct coda_out_hdr oh; ViceFid VFid; struct coda_vattr attr; }; -/* cfs_remove: NO_OUT */ -struct cfs_remove_in { - struct cfs_in_hdr ih; +/* coda_remove: NO_OUT */ +struct coda_remove_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_remove_out { - struct cfs_out_hdr out; +struct coda_remove_out { + struct coda_out_hdr out; }; -/* cfs_link: NO_OUT */ -struct cfs_link_in { - struct cfs_in_hdr ih; +/* coda_link: NO_OUT */ +struct coda_link_in { + struct coda_in_hdr ih; ViceFid sourceFid; /* cnode to link *to* */ ViceFid destFid; /* Directory in which to place link */ int tname; /* Place holder for data. */ }; -struct cfs_link_out { - struct cfs_out_hdr out; +struct coda_link_out { + struct coda_out_hdr out; }; -/* cfs_rename: NO_OUT */ -struct cfs_rename_in { - struct cfs_in_hdr ih; +/* coda_rename: NO_OUT */ +struct coda_rename_in { + struct coda_in_hdr ih; ViceFid sourceFid; int srcname; ViceFid destFid; int destname; }; -struct cfs_rename_out { - struct cfs_out_hdr out; +struct coda_rename_out { + struct coda_out_hdr out; }; -/* cfs_mkdir: */ -struct cfs_mkdir_in { - struct cfs_in_hdr ih; +/* coda_mkdir: */ +struct coda_mkdir_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; int name; /* Place holder for data. */ }; -struct cfs_mkdir_out { - struct cfs_out_hdr oh; +struct coda_mkdir_out { + struct coda_out_hdr oh; ViceFid VFid; struct coda_vattr attr; }; -/* cfs_rmdir: NO_OUT */ -struct cfs_rmdir_in { - struct cfs_in_hdr ih; +/* coda_rmdir: NO_OUT */ +struct coda_rmdir_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_rmdir_out { - struct cfs_out_hdr out; +struct coda_rmdir_out { + struct coda_out_hdr out; }; -/* cfs_readdir: */ -struct cfs_readdir_in { - struct cfs_in_hdr ih; +/* coda_readdir: */ +struct coda_readdir_in { + struct coda_in_hdr ih; ViceFid VFid; int count; int offset; }; -struct cfs_readdir_out { - struct cfs_out_hdr oh; +struct coda_readdir_out { + struct coda_out_hdr oh; int size; caddr_t data; /* Place holder for data. */ }; -/* cfs_symlink: NO_OUT */ -struct cfs_symlink_in { - struct cfs_in_hdr ih; +/* coda_symlink: NO_OUT */ +struct coda_symlink_in { + struct coda_in_hdr ih; ViceFid VFid; /* Directory to put symlink in */ int srcname; struct coda_vattr attr; int tname; }; -struct cfs_symlink_out { - struct cfs_out_hdr out; +struct coda_symlink_out { + struct coda_out_hdr out; }; -/* cfs_readlink: */ -struct cfs_readlink_in { - struct cfs_in_hdr ih; +/* coda_readlink: */ +struct coda_readlink_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_readlink_out { - struct cfs_out_hdr oh; +struct coda_readlink_out { + struct coda_out_hdr oh; int count; caddr_t data; /* Place holder for data. */ }; -/* cfs_fsync: NO_OUT */ -struct cfs_fsync_in { - struct cfs_in_hdr ih; +/* coda_fsync: NO_OUT */ +struct coda_fsync_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_fsync_out { - struct cfs_out_hdr out; +struct coda_fsync_out { + struct coda_out_hdr out; }; -/* cfs_inactive: NO_OUT */ -struct cfs_inactive_in { - struct cfs_in_hdr ih; +/* coda_inactive: NO_OUT */ +struct coda_inactive_in { + struct coda_in_hdr ih; ViceFid VFid; }; -/* cfs_vget: */ -struct cfs_vget_in { - struct cfs_in_hdr ih; +/* coda_vget: */ +struct coda_vget_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_vget_out { - struct cfs_out_hdr oh; +struct coda_vget_out { + struct coda_out_hdr oh; ViceFid VFid; int vtype; }; -/* CFS_SIGNAL is out-of-band, doesn't need data. */ -/* CFS_INVALIDATE is a venus->kernel call */ -/* CFS_FLUSH is a venus->kernel call */ +/* CODA_SIGNAL is out-of-band, doesn't need data. */ +/* CODA_INVALIDATE is a venus->kernel call */ +/* CODA_FLUSH is a venus->kernel call */ -/* cfs_purgeuser: */ -/* CFS_PURGEUSER is a venus->kernel call */ -struct cfs_purgeuser_out { - struct cfs_out_hdr oh; +/* coda_purgeuser: */ +/* CODA_PURGEUSER is a venus->kernel call */ +struct coda_purgeuser_out { + struct coda_out_hdr oh; struct coda_cred cred; }; -/* cfs_zapfile: */ -/* CFS_ZAPFILE is a venus->kernel call */ -struct cfs_zapfile_out { - struct cfs_out_hdr oh; +/* coda_zapfile: */ +/* CODA_ZAPFILE is a venus->kernel call */ +struct coda_zapfile_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_zapdir: */ -/* CFS_ZAPDIR is a venus->kernel call */ -struct cfs_zapdir_out { - struct cfs_out_hdr oh; +/* coda_zapdir: */ +/* CODA_ZAPDIR is a venus->kernel call */ +struct coda_zapdir_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_zapnode: */ -/* CFS_ZAPVNODE is a venus->kernel call */ -struct cfs_zapvnode_out { - struct cfs_out_hdr oh; +/* coda_zapnode: */ +/* CODA_ZAPVNODE is a venus->kernel call */ +struct coda_zapvnode_out { + struct coda_out_hdr oh; struct coda_cred cred; ViceFid VFid; }; -/* cfs_purgefid: */ -/* CFS_PURGEFID is a venus->kernel call */ -struct cfs_purgefid_out { - struct cfs_out_hdr oh; +/* coda_purgefid: */ +/* CODA_PURGEFID is a venus->kernel call */ +struct coda_purgefid_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_rdwr: */ -struct cfs_rdwr_in { - struct cfs_in_hdr ih; +/* coda_rdwr: */ +struct coda_rdwr_in { + struct coda_in_hdr ih; ViceFid VFid; int rwflag; int count; @@ -564,83 +564,83 @@ struct cfs_rdwr_in { caddr_t data; /* Place holder for data. */ }; -struct cfs_rdwr_out { - struct cfs_out_hdr oh; +struct coda_rdwr_out { + struct coda_out_hdr oh; int rwflag; int count; caddr_t data; /* Place holder for data. */ }; -/* cfs_replace: */ -/* CFS_REPLACE is a venus->kernel call */ -struct cfs_replace_out { /* cfs_replace is a venus->kernel call */ - struct cfs_out_hdr oh; +/* coda_replace: */ +/* CODA_REPLACE is a venus->kernel call */ +struct coda_replace_out { /* coda_replace is a venus->kernel call */ + struct coda_out_hdr oh; ViceFid NewFid; ViceFid OldFid; }; /* - * Occasionally, don't cache the fid returned by CFS_LOOKUP. For instance, if + * Occasionally, don't cache the fid returned by CODA_LOOKUP. For instance, if * the fid is inconsistent. This case is handled by setting the top bit of the * return result parameter. */ -#define CFS_NOCACHE 0x80000000 +#define CODA_NOCACHE 0x80000000 union inputArgs { - struct cfs_in_hdr ih; /* NB: every struct below begins with an ih */ - struct cfs_open_in cfs_open; - struct cfs_close_in cfs_close; - struct cfs_ioctl_in cfs_ioctl; - struct cfs_getattr_in cfs_getattr; - struct cfs_setattr_in cfs_setattr; - struct cfs_access_in cfs_access; - struct cfs_lookup_in cfs_lookup; - struct cfs_create_in cfs_create; - struct cfs_remove_in cfs_remove; - struct cfs_link_in cfs_link; - struct cfs_rename_in cfs_rename; - struct cfs_mkdir_in cfs_mkdir; - struct cfs_rmdir_in cfs_rmdir; - struct cfs_readdir_in cfs_readdir; - struct cfs_symlink_in cfs_symlink; - struct cfs_readlink_in cfs_readlink; - struct cfs_fsync_in cfs_fsync; - struct cfs_inactive_in cfs_inactive; - struct cfs_vget_in cfs_vget; - struct cfs_rdwr_in cfs_rdwr; + struct coda_in_hdr ih; /* NB: every struct below begins with an ih */ + struct coda_open_in coda_open; + struct coda_close_in coda_close; + struct coda_ioctl_in coda_ioctl; + struct coda_getattr_in coda_getattr; + struct coda_setattr_in coda_setattr; + struct coda_access_in coda_access; + struct coda_lookup_in coda_lookup; + struct coda_create_in coda_create; + struct coda_remove_in coda_remove; + struct coda_link_in coda_link; + struct coda_rename_in coda_rename; + struct coda_mkdir_in coda_mkdir; + struct coda_rmdir_in coda_rmdir; + struct coda_readdir_in coda_readdir; + struct coda_symlink_in coda_symlink; + struct coda_readlink_in coda_readlink; + struct coda_fsync_in coda_fsync; + struct coda_inactive_in coda_inactive; + struct coda_vget_in coda_vget; + struct coda_rdwr_in coda_rdwr; }; union outputArgs { - struct cfs_out_hdr oh; /* NB: every struct below begins with an oh */ - struct cfs_root_out cfs_root; - struct cfs_open_out cfs_open; - struct cfs_ioctl_out cfs_ioctl; - struct cfs_getattr_out cfs_getattr; - struct cfs_lookup_out cfs_lookup; - struct cfs_create_out cfs_create; - struct cfs_mkdir_out cfs_mkdir; - struct cfs_readdir_out cfs_readdir; - struct cfs_readlink_out cfs_readlink; - struct cfs_vget_out cfs_vget; - struct cfs_purgeuser_out cfs_purgeuser; - struct cfs_zapfile_out cfs_zapfile; - struct cfs_zapdir_out cfs_zapdir; - struct cfs_zapvnode_out cfs_zapvnode; - struct cfs_purgefid_out cfs_purgefid; - struct cfs_rdwr_out cfs_rdwr; - struct cfs_replace_out cfs_replace; + struct coda_out_hdr oh; /* NB: every struct below begins with an oh */ + struct coda_root_out coda_root; + struct coda_open_out coda_open; + struct coda_ioctl_out coda_ioctl; + struct coda_getattr_out coda_getattr; + struct coda_lookup_out coda_lookup; + struct coda_create_out coda_create; + struct coda_mkdir_out coda_mkdir; + struct coda_readdir_out coda_readdir; + struct coda_readlink_out coda_readlink; + struct coda_vget_out coda_vget; + struct coda_purgeuser_out coda_purgeuser; + struct coda_zapfile_out coda_zapfile; + struct coda_zapdir_out coda_zapdir; + struct coda_zapvnode_out coda_zapvnode; + struct coda_purgefid_out coda_purgefid; + struct coda_rdwr_out coda_rdwr; + struct coda_replace_out coda_replace; }; -union cfs_downcalls { - /* CFS_INVALIDATE is a venus->kernel call */ - /* CFS_FLUSH is a venus->kernel call */ - struct cfs_purgeuser_out purgeuser; - struct cfs_zapfile_out zapfile; - struct cfs_zapdir_out zapdir; - struct cfs_zapvnode_out zapvnode; - struct cfs_purgefid_out purgefid; - struct cfs_replace_out replace; +union coda_downcalls { + /* CODA_INVALIDATE is a venus->kernel call */ + /* CODA_FLUSH is a venus->kernel call */ + struct coda_purgeuser_out purgeuser; + struct coda_zapfile_out zapfile; + struct coda_zapdir_out zapdir; + struct coda_zapvnode_out zapvnode; + struct coda_purgefid_out purgefid; + struct coda_replace_out replace; }; @@ -661,8 +661,8 @@ struct PioctlData { struct ViceIoctl vi; }; -#define CFS_CONTROL ".CONTROL" -#define CFS_CONTROLLEN 8 +#define CODA_CONTROL ".CONTROL" +#define CODA_CONTROLLEN 8 #define CTL_VOL -1 #define CTL_VNO -1 #define CTL_UNI -1 diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c index f137ff5..4c49386 100644 --- a/sys/fs/coda/coda_fbsd.c +++ b/sys/fs/coda/coda_fbsd.c @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfs_fbsd.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfs_fbsd.c,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -99,7 +99,7 @@ vcattach(void) VCDEBUG("makedev OK.\n"); cdevsw_add(&vccdev, &vccdevsw, NULL); - VCDEBUG("cfs: vccdevsw entry installed at %d.\n", major(vccdev)); + VCDEBUG("coda: vccdevsw entry installed at %d.\n", major(vccdev)); } static vc_devsw_installed = 0; @@ -118,7 +118,7 @@ vc_drvinit(void *unused) } int -cfs_fbsd_getpages(v) +coda_fbsd_getpages(v) void *v; { struct vop_getpages_args *ap = v; @@ -151,16 +151,16 @@ cfs_fbsd_getpages(v) opened_internally = 1; error = VOP_OPEN(vp, FREAD, cred, p); -printf("cfs_getp: Internally Opening %p\n", vp); +printf("coda_getp: Internally Opening %p\n", vp); if (error) { - printf("cfs_getpage: VOP_OPEN on container failed %d\n", error); + printf("coda_getpage: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_getpage: vfs_object_create() returns %d\n", error); + printf("coda_getpage: vfs_object_create() returns %d\n", error); vput(vp); return(error); } @@ -168,10 +168,10 @@ printf("cfs_getp: Internally Opening %p\n", vp); cfvp = cp->c_ovp; } else { -printf("cfs_getp: has container %p\n", cfvp); +printf("coda_getp: has container %p\n", cfvp); } -printf("cfs_fbsd_getpages: using container "); +printf("coda_fbsd_getpages: using container "); /* error = vnode_pager_generic_getpages(cfvp, ap->a_m, ap->a_count, ap->a_reqpage); @@ -191,7 +191,7 @@ printf("error = %d\n", error); } int -cfs_fbsd_putpages(v) +coda_fbsd_putpages(v) void *v; { struct vop_putpages_args *ap = v; diff --git a/sys/fs/coda/coda_io.h b/sys/fs/coda/coda_io.h index 87a0ec3..a41f5ce 100644 --- a/sys/fs/coda/coda_io.h +++ b/sys/fs/coda/coda_io.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfsio.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfsio.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -47,6 +47,9 @@ /* * HISTORY * $Log: cfsio.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -57,7 +60,7 @@ * Sync the code for NetBSD -current; test on 1.3 later * * Revision 1.3 98/01/23 11:53:49 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.2.38.1 97/12/16 12:40:22 rvb * Sync with 1.3 @@ -66,7 +69,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:42 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:20 bnoble * Branch for NetBSD port revisions @@ -106,16 +109,16 @@ * */ -#ifndef _CFSIO_H_ -#define _CFSIO_H_ +#ifndef _CODAIO_H_ +#define _CODAIO_H_ /* Define ioctl commands for vcioctl, /dev/cfs */ -#define CFSRESIZE _IOW('c', 1, struct cfs_resize ) /* Resize CFS NameCache */ -#define CFSSTATS _IO('c', 2) /* Collect stats */ -#define CFSPRINT _IO('c', 3) /* Print Cache */ -#define CFSTEST _IO('c', 4) /* Print Cache */ +#define CODARESIZE _IOW('c', 1, struct coda_resize ) /* Resize CODA NameCache */ +#define CODASTATS _IO('c', 2) /* Collect stats */ +#define CODAPRINT _IO('c', 3) /* Print Cache */ +#define CODATEST _IO('c', 4) /* Print Cache */ -struct cfs_resize { int hashsize, heapsize; }; +struct coda_resize { int hashsize, heapsize; }; #endif diff --git a/sys/fs/coda/coda_namecache.c b/sys/fs/coda/coda_namecache.c index 2a079e5..1a88346 100644 --- a/sys/fs/coda/coda_namecache.c +++ b/sys/fs/coda/coda_namecache.c @@ -69,7 +69,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.7 98/01/23 11:53:39 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.6.2.4 98/01/23 11:21:02 rvb * Sync with 2.2.5 @@ -109,7 +109,7 @@ * >64Meg; venus can be killed! * * Revision 1.5 97/08/05 11:08:01 lily - * Removed cfsnc_replace, replaced it with a cfs_find, unhash, and + * Removed cfsnc_replace, replaced it with a coda_find, unhash, and * rehash. This fixes a cnode leak and a bug in which the fid is * not actually replaced. (cfs_namecache.c, cfsnc.h, cfs_subr.c) * @@ -125,7 +125,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:15 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:07:57 bnoble * Branch for NetBSD port revisions @@ -137,20 +137,20 @@ * Made changes 'cause sun4s have braindead compilers * * Revision 2.2 94/08/28 19:37:35 luqi - * Add a new CFS_REPLACE call to allow venus to replace a ViceFid in the + * Add a new CODA_REPLACE call to allow venus to replace a ViceFid in the * mini-cache. * * In "cfs.h": - * Add CFS_REPLACE decl. + * Add CODA_REPLACE decl. * * In "cfs_namecache.c": * Add routine cfsnc_replace. * * In "cfs_subr.c": - * Add case-statement to process CFS_REPLACE. + * Add case-statement to process CODA_REPLACE. * * In "cfsnc.h": - * Add decl for CFSNC_REPLACE. + * Add decl for CODA_NC_REPLACE. * * * Revision 2.1 94/07/21 16:25:15 satya @@ -160,7 +160,7 @@ * merge kernel/latest and alpha/src/cfs * * Revision 2.3 92/09/30 14:16:20 mja - * call cfs_flush instead of calling inode_uncache_try directly + * call coda_flush instead of calling inode_uncache_try directly * (from dcs). Also... * * Substituted rvb's history blurb so that we agree with Mach 2.5 sources. @@ -180,7 +180,7 @@ */ /* - * This module contains the routines to implement the CFS name cache. The + * This module contains the routines to implement the CODA name cache. The * purpose of this cache is to reduce the cost of translating pathnames * into Vice FIDs. Each entry in the cache contains the name of the file, * the vnode (FID) of the parent directory, and the cred structure of the @@ -203,8 +203,8 @@ * NOTES: rvb@cs * 1. The name cache holds a reference to every vnode in it. Hence files can not be * closed or made inactive until they are released. - * 2. cfsnc_name(cp) was added to get a name for a cnode pointer for debugging. - * 3. cfsnc_find() has debug code to detect when entries are stored with different + * 2. coda_nc_name(cp) was added to get a name for a cnode pointer for debugging. + * 3. coda_nc_find() has debug code to detect when entries are stored with different * credentials. We don't understand yet, if/how entries are NOT EQ but still * EQUAL * 4. I wonder if this name cache could be replace by the vnode name cache. @@ -227,82 +227,78 @@ #include #include #include -#ifdef DEBUG -/* for printcred */ -#include -#endif /* * Declaration of the name cache data structure. */ -int cfsnc_use = 1; /* Indicate use of CFS Name Cache */ -int cfsnc_size = CFSNC_CACHESIZE; /* size of the cache */ -int cfsnc_hashsize = CFSNC_HASHSIZE; /* size of the primary hash */ +int coda_nc_use = 1; /* Indicate use of CODA Name Cache */ +int coda_nc_size = CODA_NC_CACHESIZE; /* size of the cache */ +int coda_nc_hashsize = CODA_NC_HASHSIZE; /* size of the primary hash */ -struct cfscache *cfsncheap; /* pointer to the cache entries */ -struct cfshash *cfsnchash; /* hash table of cfscache pointers */ -struct cfslru cfsnc_lru; /* head of lru chain */ +struct coda_cache *coda_nc_heap; /* pointer to the cache entries */ +struct coda_hash *coda_nc_hash; /* hash table of coda_cache pointers */ +struct coda_lru coda_nc_lru; /* head of lru chain */ -struct cfsnc_statistics cfsnc_stat; /* Keep various stats */ +struct coda_nc_statistics coda_nc_stat; /* Keep various stats */ /* * for testing purposes */ -int cfsnc_debug = 0; +int coda_nc_debug = 0; /* - * Entry points for the CFS Name Cache + * Entry points for the CODA Name Cache */ -static struct cfscache *cfsnc_find(struct cnode *dcp, const char *name, int namelen, +static struct coda_cache *coda_nc_find(struct cnode *dcp, const char *name, int namelen, struct ucred *cred, int hash); -static void cfsnc_remove(struct cfscache *cncp, enum dc_status dcstat); +static void coda_nc_remove(struct coda_cache *cncp, enum dc_status dcstat); /* * Initialize the cache, the LRU structure and the Hash structure(s) */ -#define TOTAL_CACHE_SIZE (sizeof(struct cfscache) * cfsnc_size) -#define TOTAL_HASH_SIZE (sizeof(struct cfshash) * cfsnc_hashsize) +#define TOTAL_CACHE_SIZE (sizeof(struct coda_cache) * coda_nc_size) +#define TOTAL_HASH_SIZE (sizeof(struct coda_hash) * coda_nc_hashsize) -int cfsnc_initialized = 0; /* Initially the cache has not been initialized */ +int coda_nc_initialized = 0; /* Initially the cache has not been initialized */ void -cfsnc_init(void) +coda_nc_init(void) { int i; /* zero the statistics structure */ - bzero(&cfsnc_stat, (sizeof(struct cfsnc_statistics))); + bzero(&coda_nc_stat, (sizeof(struct coda_nc_statistics))); - printf("CFS NAME CACHE: CACHE %d, HASH TBL %d\n", CFSNC_CACHESIZE, CFSNC_HASHSIZE); - CFS_ALLOC(cfsncheap, struct cfscache *, TOTAL_CACHE_SIZE); - CFS_ALLOC(cfsnchash, struct cfshash *, TOTAL_HASH_SIZE); + printf("CODA NAME CACHE: CACHE %d, HASH TBL %d\n", CODA_NC_CACHESIZE, CODA_NC_HASHSIZE); + CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE); + CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE); - cfsnc_lru.lru_next = - cfsnc_lru.lru_prev = (struct cfscache *)LRU_PART(&cfsnc_lru); + coda_nc_lru.lru_next = + coda_nc_lru.lru_prev = (struct coda_cache *)LRU_PART(&coda_nc_lru); - for (i=0; i < cfsnc_size; i++) { /* initialize the heap */ - CFSNC_LRUINS(&cfsncheap[i], &cfsnc_lru); - CFSNC_HSHNUL(&cfsncheap[i]); - cfsncheap[i].cp = cfsncheap[i].dcp = (struct cnode *)0; + for (i=0; i < coda_nc_size; i++) { /* initialize the heap */ + CODA_NC_LRUINS(&coda_nc_heap[i], &coda_nc_lru); + CODA_NC_HSHNUL(&coda_nc_heap[i]); + coda_nc_heap[i].cp = coda_nc_heap[i].dcp = (struct cnode *)0; } - for (i=0; i < cfsnc_hashsize; i++) { /* initialize the hashtable */ - CFSNC_HSHNUL((struct cfscache *)&cfsnchash[i]); + for (i=0; i < coda_nc_hashsize; i++) { /* initialize the hashtable */ + CODA_NC_HSHNUL((struct coda_cache *)&coda_nc_hash[i]); } - cfsnc_initialized++; + coda_nc_initialized++; } /* * Auxillary routines -- shouldn't be entry points */ -static struct cfscache * -cfsnc_find(dcp, name, namelen, cred, hash) +static struct coda_cache * +coda_nc_find(dcp, name, namelen, cred, hash) struct cnode *dcp; const char *name; int namelen; @@ -313,28 +309,28 @@ cfsnc_find(dcp, name, namelen, cred, hash) * hash to find the appropriate bucket, look through the chain * for the right entry (especially right cred, unless cred == 0) */ - struct cfscache *cncp; + struct coda_cache *cncp; int count = 1; - CFSNC_DEBUG(CFSNC_FIND, - myprintf(("cfsnc_find(dcp %p, name %s, len %d, cred %p, hash %d\n", + CODA_NC_DEBUG(CODA_NC_FIND, + myprintf(("coda_nc_find(dcp %p, name %s, len %d, cred %p, hash %d\n", dcp, name, namelen, cred, hash));) - for (cncp = cfsnchash[hash].hash_next; - cncp != (struct cfscache *)&cfsnchash[hash]; + for (cncp = coda_nc_hash[hash].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[hash]; cncp = cncp->hash_next, count++) { - if ((CFS_NAMEMATCH(cncp, name, namelen, dcp)) && + if ((CODA_NAMEMATCH(cncp, name, namelen, dcp)) && ((cred == 0) || (cncp->cred == cred))) { /* compare cr_uid instead */ - cfsnc_stat.Search_len += count; + coda_nc_stat.Search_len += count; return(cncp); } #ifdef DEBUG - else if (CFS_NAMEMATCH(cncp, name, namelen, dcp)) { - printf("cfsnc_find: name %s, new cred = %p, cred = %p\n", + else if (CODA_NAMEMATCH(cncp, name, namelen, dcp)) { + printf("coda_nc_find: name %s, new cred = %p, cred = %p\n", name, cred, cncp->cred); printf("nref %d, nuid %d, ngid %d // oref %d, ocred %d, ogid %d\n", cred->cr_ref, cred->cr_uid, cred->cr_gid, @@ -345,7 +341,7 @@ cfsnc_find(dcp, name, namelen, cred, hash) #endif } - return((struct cfscache *)0); + return((struct coda_cache *)0); } /* @@ -353,52 +349,52 @@ cfsnc_find(dcp, name, namelen, cred, hash) * LRU and Hash as needed. */ void -cfsnc_enter(dcp, name, namelen, cred, cp) +coda_nc_enter(dcp, name, namelen, cred, cp) struct cnode *dcp; const char *name; int namelen; struct ucred *cred; struct cnode *cp; { - struct cfscache *cncp; + struct coda_cache *cncp; int hash; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ENTER, + CODA_NC_DEBUG(CODA_NC_ENTER, myprintf(("Enter: dcp %p cp %p name %s cred %p \n", dcp, cp, name, cred)); ) - if (namelen > CFSNC_NAMELEN) { - CFSNC_DEBUG(CFSNC_ENTER, + if (namelen > CODA_NC_NAMELEN) { + CODA_NC_DEBUG(CODA_NC_ENTER, myprintf(("long name enter %s\n",name));) - cfsnc_stat.long_name_enters++; /* record stats */ + coda_nc_stat.long_name_enters++; /* record stats */ return; } - hash = CFSNC_HASH(name, namelen, dcp); - cncp = cfsnc_find(dcp, name, namelen, cred, hash); - if (cncp != (struct cfscache *) 0) { - cfsnc_stat.dbl_enters++; /* duplicate entry */ + hash = CODA_NC_HASH(name, namelen, dcp); + cncp = coda_nc_find(dcp, name, namelen, cred, hash); + if (cncp != (struct coda_cache *) 0) { + coda_nc_stat.dbl_enters++; /* duplicate entry */ return; } - cfsnc_stat.enters++; /* record the enters statistic */ + coda_nc_stat.enters++; /* record the enters statistic */ /* Grab the next element in the lru chain */ - cncp = CFSNC_LRUGET(cfsnc_lru); + cncp = CODA_NC_LRUGET(coda_nc_lru); - CFSNC_LRUREM(cncp); /* remove it from the lists */ + CODA_NC_LRUREM(cncp); /* remove it from the lists */ - if (CFSNC_VALID(cncp)) { + if (CODA_NC_VALID(cncp)) { /* Seems really ugly, but we have to decrement the appropriate hash bucket length here, so we have to find the hash bucket */ - cfsnchash[CFSNC_HASH(cncp->name, cncp->namelen, cncp->dcp)].length--; + coda_nc_hash[CODA_NC_HASH(cncp->name, cncp->namelen, cncp->dcp)].length--; - cfsnc_stat.lru_rm++; /* zapped a valid entry */ - CFSNC_HSHREM(cncp); + coda_nc_stat.lru_rm++; /* zapped a valid entry */ + CODA_NC_HSHREM(cncp); vrele(CTOV(cncp->dcp)); vrele(CTOV(cncp->cp)); crfree(cncp->cred); @@ -419,11 +415,11 @@ cfsnc_enter(dcp, name, namelen, cred, cp) /* Insert into the lru and hash chains. */ - CFSNC_LRUINS(cncp, &cfsnc_lru); - CFSNC_HSHINS(cncp, &cfsnchash[hash]); - cfsnchash[hash].length++; /* Used for tuning */ + CODA_NC_LRUINS(cncp, &coda_nc_lru); + CODA_NC_HSHINS(cncp, &coda_nc_hash[hash]); + coda_nc_hash[hash].length++; /* Used for tuning */ - CFSNC_DEBUG(CFSNC_PRINTCFSNC, print_cfsnc(); ) + CODA_NC_DEBUG(CODA_NC_PRINTCODA_NC, print_coda_nc(); ) } /* @@ -431,22 +427,22 @@ cfsnc_enter(dcp, name, namelen, cred, cp) * matches the input, return it, otherwise return 0 */ struct cnode * -cfsnc_lookup(dcp, name, namelen, cred) +coda_nc_lookup(dcp, name, namelen, cred) struct cnode *dcp; const char *name; int namelen; struct ucred *cred; { int hash; - struct cfscache *cncp; + struct coda_cache *cncp; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return((struct cnode *) 0); - if (namelen > CFSNC_NAMELEN) { - CFSNC_DEBUG(CFSNC_LOOKUP, + if (namelen > CODA_NC_NAMELEN) { + CODA_NC_DEBUG(CODA_NC_LOOKUP, myprintf(("long name lookup %s\n",name));) - cfsnc_stat.long_name_lookups++; /* record stats */ + coda_nc_stat.long_name_lookups++; /* record stats */ return((struct cnode *) 0); } @@ -455,25 +451,25 @@ cfsnc_lookup(dcp, name, namelen, cred) the correct cred. */ - hash = CFSNC_HASH(name, namelen, dcp); - cncp = cfsnc_find(dcp, name, namelen, cred, hash); - if (cncp == (struct cfscache *) 0) { - cfsnc_stat.misses++; /* record miss */ + hash = CODA_NC_HASH(name, namelen, dcp); + cncp = coda_nc_find(dcp, name, namelen, cred, hash); + if (cncp == (struct coda_cache *) 0) { + coda_nc_stat.misses++; /* record miss */ return((struct cnode *) 0); } - cfsnc_stat.hits++; + coda_nc_stat.hits++; /* put this entry at the end of the LRU */ - CFSNC_LRUREM(cncp); - CFSNC_LRUINS(cncp, &cfsnc_lru); + CODA_NC_LRUREM(cncp); + CODA_NC_LRUINS(cncp, &coda_nc_lru); /* move it to the front of the hash chain */ /* don't need to change the hash bucket length */ - CFSNC_HSHREM(cncp); - CFSNC_HSHINS(cncp, &cfsnchash[hash]); + CODA_NC_HSHREM(cncp); + CODA_NC_HSHINS(cncp, &coda_nc_hash[hash]); - CFSNC_DEBUG(CFSNC_LOOKUP, + CODA_NC_DEBUG(CODA_NC_LOOKUP, printf("lookup: dcp %p, name %s, cred %p = cp %p\n", dcp, name, cred, cncp->cp); ) @@ -481,8 +477,8 @@ cfsnc_lookup(dcp, name, namelen, cred) } static void -cfsnc_remove(cncp, dcstat) - struct cfscache *cncp; +coda_nc_remove(cncp, dcstat) + struct coda_cache *cncp; enum dc_status dcstat; { /* @@ -490,14 +486,14 @@ cfsnc_remove(cncp, dcstat) * remove it from it's hash chain, and * place it at the head of the lru list. */ - CFSNC_DEBUG(CFSNC_REMOVE, - myprintf(("cfsnc_remove %s from parent %lx.%lx.%lx\n", + CODA_NC_DEBUG(CODA_NC_REMOVE, + myprintf(("coda_nc_remove %s from parent %lx.%lx.%lx\n", cncp->name, (cncp->dcp)->c_fid.Volume, (cncp->dcp)->c_fid.Vnode, (cncp->dcp)->c_fid.Unique));) - CFSNC_HSHREM(cncp); + CODA_NC_HSHREM(cncp); - CFSNC_HSHNUL(cncp); /* have it be a null chain */ + CODA_NC_HSHNUL(cncp); /* have it be a null chain */ if ((dcstat == IS_DOWNCALL) && (CTOV(cncp->dcp)->v_usecount == 1)) { cncp->dcp->c_flags |= C_PURGING; } @@ -513,15 +509,15 @@ cfsnc_remove(cncp, dcstat) /* Put the null entry just after the least-recently-used entry */ /* LRU_TOP adjusts the pointer to point to the top of the structure. */ - CFSNC_LRUREM(cncp); - CFSNC_LRUINS(cncp, LRU_TOP(cfsnc_lru.lru_prev)); + CODA_NC_LRUREM(cncp); + CODA_NC_LRUINS(cncp, LRU_TOP(coda_nc_lru.lru_prev)); } /* * Remove all entries with a parent which has the input fid. */ void -cfsnc_zapParentfid(fid, dcstat) +coda_nc_zapParentfid(fid, dcstat) ViceFid *fid; enum dc_status dcstat; { @@ -530,34 +526,34 @@ cfsnc_zapParentfid(fid, dcstat) appropriate entries. The later may be acceptable since I don't think callbacks or whatever Case 1 covers are frequent occurences. */ - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPPFID, + CODA_NC_DEBUG(CODA_NC_ZAPPFID, myprintf(("ZapParent: fid 0x%lx, 0x%lx, 0x%lx \n", fid->Volume, fid->Vnode, fid->Unique)); ) - cfsnc_stat.zapPfids++; + coda_nc_stat.zapPfids++; - for (i = 0; i < cfsnc_hashsize; i++) { + for (i = 0; i < coda_nc_hashsize; i++) { /* * Need to save the hash_next pointer in case we remove the * entry. remove causes hash_next to point to itself. */ - for (cncp = cfsnchash[i].hash_next; - cncp != (struct cfscache *)&cfsnchash[i]; + for (cncp = coda_nc_hash[i].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[i]; cncp = ncncp) { ncncp = cncp->hash_next; if ((cncp->dcp->c_fid.Volume == fid->Volume) && (cncp->dcp->c_fid.Vnode == fid->Vnode) && (cncp->dcp->c_fid.Unique == fid->Unique)) { - cfsnchash[i].length--; /* Used for tuning */ - cfsnc_remove(cncp, dcstat); + coda_nc_hash[i].length--; /* Used for tuning */ + coda_nc_remove(cncp, dcstat); } } } @@ -568,35 +564,35 @@ cfsnc_zapParentfid(fid, dcstat) * Remove all entries which have the same fid as the input */ void -cfsnc_zapfid(fid, dcstat) +coda_nc_zapfid(fid, dcstat) ViceFid *fid; enum dc_status dcstat; { /* See comment for zapParentfid. This routine will be used if attributes are being cached. */ - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPFID, + CODA_NC_DEBUG(CODA_NC_ZAPFID, myprintf(("Zapfid: fid 0x%lx, 0x%lx, 0x%lx \n", fid->Volume, fid->Vnode, fid->Unique)); ) - cfsnc_stat.zapFids++; + coda_nc_stat.zapFids++; - for (i = 0; i < cfsnc_hashsize; i++) { - for (cncp = cfsnchash[i].hash_next; - cncp != (struct cfscache *)&cfsnchash[i]; + for (i = 0; i < coda_nc_hashsize; i++) { + for (cncp = coda_nc_hash[i].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[i]; cncp = ncncp) { ncncp = cncp->hash_next; if ((cncp->cp->c_fid.Volume == fid->Volume) && (cncp->cp->c_fid.Vnode == fid->Vnode) && (cncp->cp->c_fid.Unique == fid->Unique)) { - cfsnchash[i].length--; /* Used for tuning */ - cfsnc_remove(cncp, dcstat); + coda_nc_hash[i].length--; /* Used for tuning */ + coda_nc_remove(cncp, dcstat); } } } @@ -606,7 +602,7 @@ cfsnc_zapfid(fid, dcstat) * Remove all entries which match the fid and the cred */ void -cfsnc_zapvnode(fid, cred, dcstat) +coda_nc_zapvnode(fid, cred, dcstat) ViceFid *fid; struct ucred *cred; enum dc_status dcstat; @@ -615,10 +611,10 @@ cfsnc_zapvnode(fid, cred, dcstat) want to zap a file with a specific cred from the kernel. We'll leave this one unimplemented. */ - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPVNODE, + CODA_NC_DEBUG(CODA_NC_ZAPVNODE, myprintf(("Zapvnode: fid 0x%lx, 0x%lx, 0x%lx cred %p\n", fid->Volume, fid->Vnode, fid->Unique, cred)); ) @@ -628,7 +624,7 @@ cfsnc_zapvnode(fid, cred, dcstat) * Remove all entries which have the (dir vnode, name) pair */ void -cfsnc_zapfile(dcp, name, namelen) +coda_nc_zapfile(dcp, name, namelen) struct cnode *dcp; const char *name; int namelen; @@ -636,31 +632,31 @@ cfsnc_zapfile(dcp, name, namelen) /* use the hash function to locate the file, then zap all entries of it regardless of the cred. */ - struct cfscache *cncp; + struct coda_cache *cncp; int hash; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_ZAPFILE, + CODA_NC_DEBUG(CODA_NC_ZAPFILE, myprintf(("Zapfile: dcp %p name %s \n", dcp, name)); ) - if (namelen > CFSNC_NAMELEN) { - cfsnc_stat.long_remove++; /* record stats */ + if (namelen > CODA_NC_NAMELEN) { + coda_nc_stat.long_remove++; /* record stats */ return; } - cfsnc_stat.zapFile++; + coda_nc_stat.zapFile++; - hash = CFSNC_HASH(name, namelen, dcp); - cncp = cfsnc_find(dcp, name, namelen, 0, hash); + hash = CODA_NC_HASH(name, namelen, dcp); + cncp = coda_nc_find(dcp, name, namelen, 0, hash); while (cncp) { - cfsnchash[hash].length--; /* Used for tuning */ + coda_nc_hash[hash].length--; /* Used for tuning */ - cfsnc_remove(cncp, NOT_DOWNCALL); - cncp = cfsnc_find(dcp, name, namelen, 0, hash); + coda_nc_remove(cncp, NOT_DOWNCALL); + cncp = coda_nc_find(dcp, name, namelen, 0, hash); } } @@ -669,7 +665,7 @@ cfsnc_zapfile(dcp, name, namelen) * A user is determined by his/her effective user id (id_uid). */ void -cfsnc_purge_user(uid, dcstat) +coda_nc_purge_user(uid, dcstat) vuid_t uid; enum dc_status dcstat; { @@ -681,30 +677,30 @@ cfsnc_purge_user(uid, dcstat) * always be full and LRU is more straightforward. */ - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int hash; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - CFSNC_DEBUG(CFSNC_PURGEUSER, + CODA_NC_DEBUG(CODA_NC_PURGEUSER, myprintf(("ZapDude: uid %lx\n", uid)); ) - cfsnc_stat.zapUsers++; + coda_nc_stat.zapUsers++; - for (cncp = CFSNC_LRUGET(cfsnc_lru); - cncp != (struct cfscache *)(&cfsnc_lru); + for (cncp = CODA_NC_LRUGET(coda_nc_lru); + cncp != (struct coda_cache *)(&coda_nc_lru); cncp = ncncp) { - ncncp = CFSNC_LRUGET(*cncp); + ncncp = CODA_NC_LRUGET(*cncp); - if ((CFSNC_VALID(cncp)) && + if ((CODA_NC_VALID(cncp)) && ((cncp->cred)->cr_uid == uid)) { /* Seems really ugly, but we have to decrement the appropriate hash bucket length here, so we have to find the hash bucket */ - hash = CFSNC_HASH(cncp->name, cncp->namelen, cncp->dcp); - cfsnchash[hash].length--; /* For performance tuning */ + hash = CODA_NC_HASH(cncp->name, cncp->namelen, cncp->dcp); + coda_nc_hash[hash].length--; /* For performance tuning */ - cfsnc_remove(cncp, dcstat); + coda_nc_remove(cncp, dcstat); } } } @@ -713,7 +709,7 @@ cfsnc_purge_user(uid, dcstat) * Flush the entire name cache. In response to a flush of the Venus cache. */ void -cfsnc_flush(dcstat) +coda_nc_flush(dcstat) enum dc_status dcstat; { /* One option is to deallocate the current name cache and @@ -727,21 +723,21 @@ cfsnc_flush(dcstat) * I don't use remove since that would rebuild the lru chain * as it went and that seemed unneccesary. */ - struct cfscache *cncp; + struct coda_cache *cncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - cfsnc_stat.Flushes++; + coda_nc_stat.Flushes++; - for (cncp = CFSNC_LRUGET(cfsnc_lru); - cncp != (struct cfscache *)&cfsnc_lru; - cncp = CFSNC_LRUGET(*cncp)) { - if (CFSNC_VALID(cncp)) { + for (cncp = CODA_NC_LRUGET(coda_nc_lru); + cncp != (struct coda_cache *)&coda_nc_lru; + cncp = CODA_NC_LRUGET(*cncp)) { + if (CODA_NC_VALID(cncp)) { - CFSNC_HSHREM(cncp); /* only zero valid nodes */ - CFSNC_HSHNUL(cncp); + CODA_NC_HSHREM(cncp); /* only zero valid nodes */ + CODA_NC_HSHNUL(cncp); if ((dcstat == IS_DOWNCALL) && (CTOV(cncp->dcp)->v_usecount == 1)) { @@ -750,9 +746,9 @@ cfsnc_flush(dcstat) vrele(CTOV(cncp->dcp)); if (CTOV(cncp->cp)->v_flag & VTEXT) { - if (cfs_vmflush(cncp->cp)) - CFSDEBUG(CFS_FLUSH, - myprintf(("cfsnc_flush: (%lx.%lx.%lx) busy\n", cncp->cp->c_fid.Volume, cncp->cp->c_fid.Vnode, cncp->cp->c_fid.Unique)); ) + if (coda_vmflush(cncp->cp)) + CODADEBUG(CODA_FLUSH, + myprintf(("coda_nc_flush: (%lx.%lx.%lx) busy\n", cncp->cp->c_fid.Volume, cncp->cp->c_fid.Vnode, cncp->cp->c_fid.Unique)); ) } if ((dcstat == IS_DOWNCALL) @@ -767,8 +763,8 @@ cfsnc_flush(dcstat) } } - for (i = 0; i < cfsnc_hashsize; i++) - cfsnchash[i].length = 0; + for (i = 0; i < coda_nc_hashsize; i++) + coda_nc_hash[i].length = 0; } /* @@ -779,16 +775,16 @@ cfsnc_flush(dcstat) * This routine should print out all the hash chains to the console. */ void -print_cfsnc(void) +print_coda_nc(void) { int hash; - struct cfscache *cncp; + struct coda_cache *cncp; - for (hash = 0; hash < cfsnc_hashsize; hash++) { + for (hash = 0; hash < coda_nc_hashsize; hash++) { myprintf(("\nhash %d\n",hash)); - for (cncp = cfsnchash[hash].hash_next; - cncp != (struct cfscache *)&cfsnchash[hash]; + for (cncp = coda_nc_hash[hash].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[hash]; cncp = cncp->hash_next) { myprintf(("cp %p dcp %p cred %p name %s\n", cncp->cp, cncp->dcp, @@ -798,42 +794,42 @@ print_cfsnc(void) } void -cfsnc_gather_stats(void) +coda_nc_gather_stats(void) { int i, max = 0, sum = 0, temp, zeros = 0, ave, n; - for (i = 0; i < cfsnc_hashsize; i++) { - if (cfsnchash[i].length) { - sum += cfsnchash[i].length; + for (i = 0; i < coda_nc_hashsize; i++) { + if (coda_nc_hash[i].length) { + sum += coda_nc_hash[i].length; } else { zeros++; } - if (cfsnchash[i].length > max) - max = cfsnchash[i].length; + if (coda_nc_hash[i].length > max) + max = coda_nc_hash[i].length; } /* * When computing the Arithmetic mean, only count slots which * are not empty in the distribution. */ - cfsnc_stat.Sum_bucket_len = sum; - cfsnc_stat.Num_zero_len = zeros; - cfsnc_stat.Max_bucket_len = max; + coda_nc_stat.Sum_bucket_len = sum; + coda_nc_stat.Num_zero_len = zeros; + coda_nc_stat.Max_bucket_len = max; - if ((n = cfsnc_hashsize - zeros) > 0) + if ((n = coda_nc_hashsize - zeros) > 0) ave = sum / n; else ave = 0; sum = 0; - for (i = 0; i < cfsnc_hashsize; i++) { - if (cfsnchash[i].length) { - temp = cfsnchash[i].length - ave; + for (i = 0; i < coda_nc_hashsize; i++) { + if (coda_nc_hash[i].length) { + temp = coda_nc_hash[i].length - ave; sum += temp * temp; } } - cfsnc_stat.Sum2_bucket_len = sum; + coda_nc_stat.Sum2_bucket_len = sum; } /* @@ -843,7 +839,7 @@ cfsnc_gather_stats(void) * is in an improper state (except by turning the cache off). */ int -cfsnc_resize(hashsize, heapsize, dcstat) +coda_nc_resize(hashsize, heapsize, dcstat) int hashsize, heapsize; enum dc_status dcstat; { @@ -851,46 +847,49 @@ cfsnc_resize(hashsize, heapsize, dcstat) return(EINVAL); } - cfsnc_use = 0; /* Turn the cache off */ + coda_nc_use = 0; /* Turn the cache off */ - cfsnc_flush(dcstat); /* free any cnodes in the cache */ + coda_nc_flush(dcstat); /* free any cnodes in the cache */ /* WARNING: free must happen *before* size is reset */ - CFS_FREE(cfsncheap,TOTAL_CACHE_SIZE); - CFS_FREE(cfsnchash,TOTAL_HASH_SIZE); + CODA_FREE(coda_nc_heap,TOTAL_CACHE_SIZE); + CODA_FREE(coda_nc_hash,TOTAL_HASH_SIZE); - cfsnc_hashsize = hashsize; - cfsnc_size = heapsize; + coda_nc_hashsize = hashsize; + coda_nc_size = heapsize; - cfsnc_init(); /* Set up a cache with the new size */ + coda_nc_init(); /* Set up a cache with the new size */ - cfsnc_use = 1; /* Turn the cache back on */ + coda_nc_use = 1; /* Turn the cache back on */ return(0); } -char cfsnc_name_buf[CFS_MAXNAMLEN+1]; +#define DEBUG +#ifdef DEBUG +char coda_nc_name_buf[CODA_MAXNAMLEN+1]; void -cfsnc_name(struct cnode *cp) +coda_nc_name(struct cnode *cp) { - struct cfscache *cncp, *ncncp; + struct coda_cache *cncp, *ncncp; int i; - if (cfsnc_use == 0) /* Cache is off */ + if (coda_nc_use == 0) /* Cache is off */ return; - for (i = 0; i < cfsnc_hashsize; i++) { - for (cncp = cfsnchash[i].hash_next; - cncp != (struct cfscache *)&cfsnchash[i]; + for (i = 0; i < coda_nc_hashsize; i++) { + for (cncp = coda_nc_hash[i].hash_next; + cncp != (struct coda_cache *)&coda_nc_hash[i]; cncp = ncncp) { ncncp = cncp->hash_next; if (cncp->cp == cp) { - bcopy(cncp->name, cfsnc_name_buf, cncp->namelen); - cfsnc_name_buf[cncp->namelen] = 0; + bcopy(cncp->name, coda_nc_name_buf, cncp->namelen); + coda_nc_name_buf[cncp->namelen] = 0; printf(" is %s (%p,%p)@%p", - cfsnc_name_buf, cncp->cp, cncp->dcp, cncp); + coda_nc_name_buf, cncp->cp, cncp->dcp, cncp); } } } } +#endif diff --git a/sys/fs/coda/coda_namecache.h b/sys/fs/coda/coda_namecache.h index d3d8945..8606365 100644 --- a/sys/fs/coda/coda_namecache.h +++ b/sys/fs/coda/coda_namecache.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfsnc.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfsnc.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -47,6 +47,9 @@ /* * HISTORY * $Log: cfsnc.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -63,7 +66,7 @@ * Sync the code for NetBSD -current; test on 1.3 later * * Revision 1.5 98/01/23 11:53:51 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.4.2.1 97/12/16 12:40:23 rvb * Sync with 1.3 @@ -81,7 +84,7 @@ * don't include headers in headers * * Revision 1.3 97/08/05 11:08:19 lily - * Removed cfsnc_replace, replaced it with a cfs_find, unhash, and + * Removed cfsnc_replace, replaced it with a coda_find, unhash, and * rehash. This fixes a cnode leak and a bug in which the fid is * not actually replaced. (cfs_namecache.c, cfsnc.h, cfs_subr.c) * @@ -89,7 +92,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:45 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:22 bnoble * Branch for NetBSD port revisions @@ -98,20 +101,20 @@ * Bump to major revision 3 to prepare for NetBSD port * * Revision 2.2 1994/08/28 19:37:39 luqi - * Add a new CFS_REPLACE call to allow venus to replace a ViceFid in the + * Add a new CODA_REPLACE call to allow venus to replace a ViceFid in the * mini-cache. * * In "cfs.h": - * Add CFS_REPLACE decl. + * Add CODA_REPLACE decl. * * In "cfs_namecache.c": * Add routine cfsnc_replace. * * In "cfs_subr.c": - * Add case-statement to process CFS_REPLACE. + * Add case-statement to process CODA_REPLACE. * * In "cfsnc.h": - * Add decl for CFSNC_REPLACE. + * Add decl for CODA_NC_REPLACE. * * Revision 2.1 94/07/21 16:25:27 satya * Conversion to C++ 3.0; start of Coda Release 2.0 @@ -128,15 +131,15 @@ * * */ -#ifndef _CFSNC_HEADER_ -#define _CFSNC_HEADER_ +#ifndef _CODA_NC_HEADER_ +#define _CODA_NC_HEADER_ /* - * Cfs constants + * Coda constants */ -#define CFSNC_NAMELEN 15 /* longest name stored in cache */ -#define CFSNC_CACHESIZE 256 /* Default cache size */ -#define CFSNC_HASHSIZE 64 /* Must be multiple of 2 */ +#define CODA_NC_NAMELEN 15 /* longest name stored in cache */ +#define CODA_NC_CACHESIZE 256 /* Default cache size */ +#define CODA_NC_HASHSIZE 64 /* Must be multiple of 2 */ /* * Hash function for the primary hash. @@ -148,14 +151,14 @@ */ #ifdef oldhash -#define CFSNC_HASH(name, namelen, cp) \ - ((name[0] + name[namelen-1] + namelen + (int)(cp)) & (cfsnc_hashsize-1)) +#define CODA_NC_HASH(name, namelen, cp) \ + ((name[0] + name[namelen-1] + namelen + (int)(cp)) & (coda_nc_hashsize-1)) #else -#define CFSNC_HASH(name, namelen, cp) \ - ((name[0] + (name[namelen-1]<<4) + namelen + (((int)cp)>>8)) & (cfsnc_hashsize-1)) +#define CODA_NC_HASH(name, namelen, cp) \ + ((name[0] + (name[namelen-1]<<4) + namelen + (((int)cp)>>8)) & (coda_nc_hashsize-1)) #endif -#define CFS_NAMEMATCH(cp, name, namelen, dcp) \ +#define CODA_NAMEMATCH(cp, name, namelen, dcp) \ ((namelen == cp->namelen) && (dcp == cp->dcp) && \ (bcmp(cp->name,name,namelen) == 0)) @@ -165,82 +168,82 @@ * in the list node, thus the trickery for lru. */ -#define CFSNC_HSHINS(elem, pred) insque(elem,pred) -#define CFSNC_HSHREM(elem) remque(elem) -#define CFSNC_HSHNUL(elem) (elem)->hash_next = \ +#define CODA_NC_HSHINS(elem, pred) insque(elem,pred) +#define CODA_NC_HSHREM(elem) remque(elem) +#define CODA_NC_HSHNUL(elem) (elem)->hash_next = \ (elem)->hash_prev = (elem) -#define CFSNC_LRUINS(elem, pred) insque(LRU_PART(elem), LRU_PART(pred)) -#define CFSNC_LRUREM(elem) remque(LRU_PART(elem)); -#define CFSNC_LRUGET(lruhead) LRU_TOP((lruhead).lru_prev) +#define CODA_NC_LRUINS(elem, pred) insque(LRU_PART(elem), LRU_PART(pred)) +#define CODA_NC_LRUREM(elem) remque(LRU_PART(elem)); +#define CODA_NC_LRUGET(lruhead) LRU_TOP((lruhead).lru_prev) -#define CFSNC_VALID(cncp) (cncp->dcp != (struct cnode *)0) +#define CODA_NC_VALID(cncp) (cncp->dcp != (struct cnode *)0) -#define LRU_PART(cncp) (struct cfscache *) \ - ((char *)cncp + (2*sizeof(struct cfscache *))) -#define LRU_TOP(cncp) (struct cfscache *) \ - ((char *)cncp - (2*sizeof(struct cfscache *))) -#define DATA_PART(cncp) (struct cfscache *) \ - ((char *)cncp + (4*sizeof(struct cfscache *))) -#define DATA_SIZE (sizeof(struct cfscache)-(4*sizeof(struct cfscache *))) +#define LRU_PART(cncp) (struct coda_cache *) \ + ((char *)cncp + (2*sizeof(struct coda_cache *))) +#define LRU_TOP(cncp) (struct coda_cache *) \ + ((char *)cncp - (2*sizeof(struct coda_cache *))) +#define DATA_PART(cncp) (struct coda_cache *) \ + ((char *)cncp + (4*sizeof(struct coda_cache *))) +#define DATA_SIZE (sizeof(struct coda_cache)-(4*sizeof(struct coda_cache *))) /* - * Structure for an element in the CFS Name Cache. + * Structure for an element in the CODA Name Cache. * NOTE: I use the position of arguments and their size in the - * implementation of the functions CFSNC_LRUINS, CFSNC_LRUREM, and + * implementation of the functions CODA_NC_LRUINS, CODA_NC_LRUREM, and * DATA_PART. */ -struct cfscache { - struct cfscache *hash_next,*hash_prev; /* Hash list */ - struct cfscache *lru_next, *lru_prev; /* LRU list */ +struct coda_cache { + struct coda_cache *hash_next,*hash_prev; /* Hash list */ + struct coda_cache *lru_next, *lru_prev; /* LRU list */ struct cnode *cp; /* vnode of the file */ struct cnode *dcp; /* parent's cnode */ struct ucred *cred; /* user credentials */ - char name[CFSNC_NAMELEN]; /* segment name */ + char name[CODA_NC_NAMELEN]; /* segment name */ int namelen; /* length of name */ }; -struct cfslru { /* Start of LRU chain */ +struct coda_lru { /* Start of LRU chain */ char *dummy1, *dummy2; /* place holders */ - struct cfscache *lru_next, *lru_prev; /* position of pointers is important */ + struct coda_cache *lru_next, *lru_prev; /* position of pointers is important */ }; -struct cfshash { /* Start of Hash chain */ - struct cfscache *hash_next, *hash_prev; /* NOTE: chain pointers must be first */ +struct coda_hash { /* Start of Hash chain */ + struct coda_cache *hash_next, *hash_prev; /* NOTE: chain pointers must be first */ int length; /* used for tuning purposes */ }; /* * Symbols to aid in debugging the namecache code. Assumes the existence - * of the variable cfsnc_debug, which is defined in cfs_namecache.c + * of the variable coda_nc_debug, which is defined in cfs_namecache.c */ -#define CFSNC_DEBUG(N, STMT) { if (cfsnc_debug & (1 < +#include #include #include @@ -171,11 +174,11 @@ extern int cfsnc_initialized; /* Set if cache has been initialized */ #define CTL_C -int cfs_psdev_print_entry = 0; +int coda_psdev_print_entry = 0; -#define ENTRY if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) +#define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -void vcfsattach(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); @@ -198,9 +201,9 @@ struct vmsg { #define VM_WRITE 2 #define VM_INTR 4 -/* vcfsattach: do nothing */ +/* vcodaattach: do nothing */ void -vcfsattach(n) +vcodaattach(n) int n; { } @@ -216,13 +219,13 @@ vc_nb_open(dev, flag, mode, p) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - if (!cfsnc_initialized) - cfsnc_init(); + if (!coda_nc_initialized) + coda_nc_init(); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; if (VC_OPEN(vcp)) return(EBUSY); @@ -231,8 +234,8 @@ vc_nb_open(dev, flag, mode, p) INIT_QUEUE(vcp->vc_replys); MARK_VC_OPEN(vcp); - cfs_mnttbl[minor(dev)].mi_vfsp = NULL; - cfs_mnttbl[minor(dev)].mi_rootvp = NULL; + coda_mnttbl[minor(dev)].mi_vfsp = NULL; + coda_mnttbl[minor(dev)].mi_rootvp = NULL; return(0); } @@ -246,15 +249,15 @@ vc_nb_close (dev, flag, mode, p) { register struct vcomm *vcp; register struct vmsg *vmp; - struct cfs_mntinfo *mi; + struct coda_mntinfo *mi; int err; ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - mi = &cfs_mnttbl[minor(dev)]; + mi = &coda_mnttbl[minor(dev)]; vcp = &(mi->mi_vcomm); if (!VC_OPEN(vcp)) @@ -269,7 +272,7 @@ vc_nb_close (dev, flag, mode, p) if (mi->mi_rootvp) { /* Let unmount know this is for real */ VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING; - cfs_unmounting(mi->mi_vfsp); + coda_unmounting(mi->mi_vfsp); err = dounmount(mi->mi_vfsp, flag, p); if (err) myprintf(("Error %d unmounting vfs in vcclose(%d)\n", @@ -283,9 +286,9 @@ vc_nb_close (dev, flag, mode, p) { /* Free signal request messages and don't wakeup cause no one is waiting. */ - if (vmp->vm_opcode == CFS_SIGNAL) { - CFS_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); - CFS_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); + if (vmp->vm_opcode == CODA_SIGNAL) { + CODA_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); + CODA_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); continue; } @@ -315,10 +318,10 @@ vc_nb_read(dev, uiop, flag) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; /* Get message at head of request queue. */ if (EMPTY(vcp->vc_requests)) return(0); /* Nothing to read */ @@ -342,12 +345,12 @@ vc_nb_read(dev, uiop, flag) /* If request was a signal, free up the message and don't enqueue it in the reply queue. */ - if (vmp->vm_opcode == CFS_SIGNAL) { - if (cfsdebug) + if (vmp->vm_opcode == CODA_SIGNAL) { + if (codadebug) myprintf(("vcread: signal msg (%d, %d)\n", vmp->vm_opcode, vmp->vm_unique)); - CFS_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); - CFS_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); + CODA_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA); + CODA_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg)); return(error); } @@ -365,7 +368,7 @@ vc_nb_write(dev, uiop, flag) { register struct vcomm * vcp; register struct vmsg *vmp; - struct cfs_out_hdr *out; + struct coda_out_hdr *out; u_long seq; u_long opcode; int buf[2]; @@ -373,10 +376,10 @@ vc_nb_write(dev, uiop, flag) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; /* Peek at the opcode, unique without transfering the data. */ uiop->uio_rw = UIO_WRITE; @@ -389,7 +392,7 @@ vc_nb_write(dev, uiop, flag) opcode = buf[0]; seq = buf[1]; - if (cfsdebug) + if (codadebug) myprintf(("vcwrite got a call for %ld.%ld\n", opcode, seq)); if (DOWNCALL(opcode)) { @@ -397,7 +400,7 @@ vc_nb_write(dev, uiop, flag) /* get the rest of the data. */ uiop->uio_rw = UIO_WRITE; - error = uiomove((caddr_t)&pbuf.cfs_purgeuser.oh.result, sizeof(pbuf) - (sizeof(int)*2), uiop); + error = uiomove((caddr_t)&pbuf.coda_purgeuser.oh.result, sizeof(pbuf) - (sizeof(int)*2), uiop); if (error) { myprintf(("vcwrite: error (%d) on uiomove (Op %ld seq %ld)\n", error, opcode, seq)); @@ -416,7 +419,7 @@ vc_nb_write(dev, uiop, flag) } if (EOQ(vmp, vcp->vc_replys)) { - if (cfsdebug) + if (codadebug) myprintf(("vcwrite: msg (%ld, %ld) not found\n", opcode, seq)); return(ESRCH); @@ -426,7 +429,7 @@ vc_nb_write(dev, uiop, flag) REMQUE(vmp->vm_chain); /* move data into response buffer. */ - out = (struct cfs_out_hdr *)vmp->vm_data; + out = (struct coda_out_hdr *)vmp->vm_data; /* Don't need to copy opcode and uniquifier. */ /* get the rest of the data. */ @@ -468,22 +471,22 @@ vc_nb_ioctl(dev, cmd, addr, flag, p) ENTRY; switch(cmd) { - case CFSRESIZE: { - struct cfs_resize *data = (struct cfs_resize *)addr; - return(cfsnc_resize(data->hashsize, data->heapsize, IS_DOWNCALL)); + case CODARESIZE: { + struct coda_resize *data = (struct coda_resize *)addr; + return(coda_nc_resize(data->hashsize, data->heapsize, IS_DOWNCALL)); break; } - case CFSSTATS: - if (cfsnc_use) { - cfsnc_gather_stats(); + case CODASTATS: + if (coda_nc_use) { + coda_nc_gather_stats(); return(0); } else { return(ENODEV); } break; - case CFSPRINT: - if (cfsnc_use) { - print_cfsnc(); + case CODAPRINT: + if (coda_nc_use) { + print_coda_nc(); return(0); } else { return(ENODEV); @@ -506,10 +509,10 @@ vc_nb_poll(dev, events, p) ENTRY; - if (minor(dev) >= NVCFS || minor(dev) < 0) + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); - vcp = &cfs_mnttbl[minor(dev)].mi_vcomm; + vcp = &coda_mnttbl[minor(dev)].mi_vcomm; event_msk = events & (POLLIN|POLLRDNORM); if (!event_msk) @@ -526,7 +529,7 @@ vc_nb_poll(dev, events, p) /* * Statistics */ -struct cfs_clstat cfs_clstat; +struct coda_clstat coda_clstat; /* * Key question: whether to sleep interuptably or uninteruptably when @@ -537,15 +540,15 @@ struct cfs_clstat cfs_clstat; * (e.g. kill -9). */ -int cfscall_sleep = PZERO - 1; +int coda_call_sleep = PZERO - 1; #ifdef CTL_C -int cfs_pcatch = PCATCH; +int coda_pcatch = PCATCH; #else #endif int -cfscall(mntinfo, inSize, outSize, buffer) - struct cfs_mntinfo *mntinfo; int inSize; int *outSize; caddr_t buffer; +coda_call(mntinfo, inSize, outSize, buffer) + struct coda_mntinfo *mntinfo; int inSize; int *outSize; caddr_t buffer; { struct vcomm *vcp; struct vmsg *vmp; @@ -562,27 +565,27 @@ cfscall(mntinfo, inSize, outSize, buffer) vcp = &(mntinfo->mi_vcomm); - cfs_clstat.ncalls++; - cfs_clstat.reqs[((struct cfs_in_hdr *)buffer)->opcode]++; + coda_clstat.ncalls++; + coda_clstat.reqs[((struct coda_in_hdr *)buffer)->opcode]++; if (!VC_OPEN(vcp)) return(ENODEV); - CFS_ALLOC(vmp,struct vmsg *,sizeof(struct vmsg)); + CODA_ALLOC(vmp,struct vmsg *,sizeof(struct vmsg)); /* Format the request message. */ vmp->vm_data = buffer; vmp->vm_flags = 0; vmp->vm_inSize = inSize; vmp->vm_outSize = *outSize ? *outSize : inSize; /* |buffer| >= inSize */ - vmp->vm_opcode = ((struct cfs_in_hdr *)buffer)->opcode; + vmp->vm_opcode = ((struct coda_in_hdr *)buffer)->opcode; vmp->vm_unique = ++vcp->vc_seq; - if (cfsdebug) + if (codadebug) myprintf(("Doing a call for %d.%d\n", vmp->vm_opcode, vmp->vm_unique)); /* Fill in the common input args. */ - ((struct cfs_in_hdr *)buffer)->unique = vmp->vm_unique; + ((struct coda_in_hdr *)buffer)->unique = vmp->vm_unique; /* Append msg to request queue and poke Venus. */ INSQUE(vmp->vm_chain, vcp->vc_requests); @@ -599,7 +602,7 @@ cfscall(mntinfo, inSize, outSize, buffer) /* Ignore return, We have to check anyway */ #ifdef CTL_C - /* This is work in progress. Setting cfs_pcatch lets tsleep reawaken + /* This is work in progress. Setting coda_pcatch lets tsleep reawaken on a ^c or ^z. The problem is that emacs sets certain interrupts as SA_RESTART. This means that we should exit sleep handle the "signal" and then go to sleep again. Mostly this is done by letting @@ -608,29 +611,29 @@ cfscall(mntinfo, inSize, outSize, buffer) */ i = 0; do { - error = tsleep(&vmp->vm_sleep, (cfscall_sleep|cfs_pcatch), "cfscall", hz*2); + error = tsleep(&vmp->vm_sleep, (coda_call_sleep|coda_pcatch), "coda_call", hz*2); if (error == 0) break; else if (error == EWOULDBLOCK) { - printf("cfscall: tsleep TIMEOUT %d sec\n", 2+2*i); + printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i); } else if (p->p_siglist == sigmask(SIGIO)) { p->p_sigmask |= p->p_siglist; - printf("cfscall: tsleep returns %d SIGIO, cnt %d\n", error, i); + printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); } else { - printf("cfscall: tsleep returns %d, cnt %d\n", error, i); - printf("cfscall: siglist = %x, sigmask = %x, mask %x\n", + 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; p->p_sigmask |= p->p_siglist; - printf("cfscall: 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); } } while (error && i++ < 128); p->p_sigmask = psig_omask; #else - (void) tsleep(&vmp->vm_sleep, cfscall_sleep, "cfscall", 0); + (void) tsleep(&vmp->vm_sleep, coda_call_sleep, "coda_call", 0); #endif if (VC_OPEN(vcp)) { /* Venus is still alive */ /* Op went through, interrupt or not... */ @@ -641,7 +644,7 @@ cfscall(mntinfo, inSize, outSize, buffer) else if (!(vmp->vm_flags & VM_READ)) { /* Interrupted before venus read it. */ - if (cfsdebug||1) + if (codadebug||1) myprintf(("interrupted before read: op = %d.%d, flags = %x\n", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); REMQUE(vmp->vm_chain); @@ -652,29 +655,29 @@ cfscall(mntinfo, inSize, outSize, buffer) /* (!(vmp->vm_flags & VM_WRITE)) means interrupted after upcall started */ /* Interrupted after start of upcall, send venus a signal */ - struct cfs_in_hdr *dog; + struct coda_in_hdr *dog; struct vmsg *svmp; - if (cfsdebug||1) + if (codadebug||1) myprintf(("Sending Venus a signal: op = %d.%d, flags = %x\n", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); REMQUE(vmp->vm_chain); error = EINTR; - CFS_ALLOC(svmp, struct vmsg *, sizeof (struct vmsg)); + CODA_ALLOC(svmp, struct vmsg *, sizeof (struct vmsg)); - CFS_ALLOC((svmp->vm_data), char *, sizeof (struct cfs_in_hdr)); - dog = (struct cfs_in_hdr *)svmp->vm_data; + CODA_ALLOC((svmp->vm_data), char *, sizeof (struct coda_in_hdr)); + dog = (struct coda_in_hdr *)svmp->vm_data; svmp->vm_flags = 0; - dog->opcode = svmp->vm_opcode = CFS_SIGNAL; + dog->opcode = svmp->vm_opcode = CODA_SIGNAL; dog->unique = svmp->vm_unique = vmp->vm_unique; - svmp->vm_inSize = sizeof (struct cfs_in_hdr); -/*??? rvb */ svmp->vm_outSize = sizeof (struct cfs_in_hdr); + svmp->vm_inSize = sizeof (struct coda_in_hdr); +/*??? rvb */ svmp->vm_outSize = sizeof (struct coda_in_hdr); - if (cfsdebug) - myprintf(("cfscall: enqueing signal msg (%d, %d)\n", + if (codadebug) + myprintf(("coda_call: enqueing signal msg (%d, %d)\n", svmp->vm_opcode, svmp->vm_unique)); /* insert at head of queue! */ @@ -684,16 +687,16 @@ cfscall(mntinfo, inSize, outSize, buffer) } else { /* If venus died (!VC_OPEN(vcp)) */ - if (cfsdebug) + if (codadebug) myprintf(("vcclose woke op %d.%d flags %d\n", vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags)); error = ENODEV; } - CFS_FREE(vmp, sizeof(struct vmsg)); + CODA_FREE(vmp, sizeof(struct vmsg)); if (!error) - error = ((struct cfs_out_hdr *)buffer)->result; + error = ((struct coda_out_hdr *)buffer)->result; return(error); } diff --git a/sys/fs/coda/coda_subr.c b/sys/fs/coda/coda_subr.c index 5a55e8a..3e6472d 100644 --- a/sys/fs/coda/coda_subr.c +++ b/sys/fs/coda/coda_subr.c @@ -68,7 +68,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.7 98/01/23 11:53:42 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.6.2.3 98/01/23 11:21:05 rvb * Sync with 2.2.5 @@ -108,7 +108,7 @@ * >64Meg; venus can be killed! * * Revision 1.5 97/08/05 11:08:17 lily - * Removed cfsnc_replace, replaced it with a cfs_find, unhash, and + * Removed cfsnc_replace, replaced it with a coda_find, unhash, and * rehash. This fixes a cnode leak and a bug in which the fid is * not actually replaced. (cfs_namecache.c, cfsnc.h, cfs_subr.c) * @@ -123,7 +123,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:27 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:07:59 bnoble * Branch for NetBSD port revisions @@ -161,7 +161,7 @@ * * Revision 2.4 92/09/30 14:16:26 mja * Incorporated Dave Steere's fix for the GNU-Emacs bug. - * Also, included his cfs_flush routine in place of the former cfsnc_flush. + * Also, included his coda_flush routine in place of the former coda_nc_flush. * [91/02/07 jjk] * * Added contributors blurb. @@ -196,17 +196,17 @@ */ /* NOTES: rvb - * 1. Added cfs_unmounting to mark all cnodes as being UNMOUNTING. This has to + * 1. Added coda_unmounting to mark all cnodes as being UNMOUNTING. This has to * be done before dounmount is called. Because some of the routines that - * dounmount calls before cfs_unmounted might try to force flushes to venus. + * dounmount calls before coda_unmounted might try to force flushes to venus. * The vnode pager does this. - * 2. cfs_unmounting marks all cnodes scanning cfs_cache. + * 2. coda_unmounting marks all cnodes scanning coda_cache. * 3. cfs_checkunmounting (under DEBUG) checks all cnodes by chasing the vnodes * under the /coda mount point. - * 4. cfs_cacheprint (under DEBUG) prints names with vnode/cnode address + * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address */ -#include +#include #include #include @@ -220,14 +220,14 @@ #include #include -int cfs_active = 0; -int cfs_reuse = 0; -int cfs_new = 0; +int coda_active = 0; +int coda_reuse = 0; +int coda_new = 0; -struct cnode *cfs_freelist = NULL; -struct cnode *cfs_cache[CFS_CACHESIZE]; +struct cnode *coda_freelist = NULL; +struct cnode *coda_cache[CODA_CACHESIZE]; -#define cfshash(fid) (((fid)->Volume + (fid)->Vnode) & (CFS_CACHESIZE-1)) +#define coda_hash(fid) (((fid)->Volume + (fid)->Vnode) & (CODA_CACHESIZE-1)) #define CNODE_NEXT(cp) ((cp)->c_next) #define ODD(vnode) ((vnode) & 0x1) @@ -235,22 +235,22 @@ struct cnode *cfs_cache[CFS_CACHESIZE]; * Allocate a cnode. */ struct cnode * -cfs_alloc(void) +coda_alloc(void) { struct cnode *cp; - if (cfs_freelist) { - cp = cfs_freelist; - cfs_freelist = CNODE_NEXT(cp); - cfs_reuse++; + if (coda_freelist) { + cp = coda_freelist; + coda_freelist = CNODE_NEXT(cp); + coda_reuse++; } else { - CFS_ALLOC(cp, struct cnode *, sizeof(struct cnode)); + CODA_ALLOC(cp, struct cnode *, sizeof(struct cnode)); /* NetBSD vnodes don't have any Pager info in them ('cause there are no external pagers, duh!) */ #define VNODE_VM_INFO_INIT(vp) /* MT */ VNODE_VM_INFO_INIT(CTOV(cp)); - cfs_new++; + coda_new++; } bzero(cp, sizeof (struct cnode)); @@ -261,40 +261,40 @@ cfs_alloc(void) * Deallocate a cnode. */ void -cfs_free(cp) +coda_free(cp) register struct cnode *cp; { - CNODE_NEXT(cp) = cfs_freelist; - cfs_freelist = cp; + CNODE_NEXT(cp) = coda_freelist; + coda_freelist = cp; } /* * Put a cnode in the hash table */ void -cfs_save(cp) +coda_save(cp) struct cnode *cp; { - CNODE_NEXT(cp) = cfs_cache[cfshash(&cp->c_fid)]; - cfs_cache[cfshash(&cp->c_fid)] = cp; + CNODE_NEXT(cp) = coda_cache[coda_hash(&cp->c_fid)]; + coda_cache[coda_hash(&cp->c_fid)] = cp; } /* * Remove a cnode from the hash table */ void -cfs_unsave(cp) +coda_unsave(cp) struct cnode *cp; { struct cnode *ptr; struct cnode *ptrprev = NULL; - ptr = cfs_cache[cfshash(&cp->c_fid)]; + ptr = coda_cache[coda_hash(&cp->c_fid)]; while (ptr != NULL) { if (ptr == cp) { if (ptrprev == NULL) { - cfs_cache[cfshash(&cp->c_fid)] + coda_cache[coda_hash(&cp->c_fid)] = CNODE_NEXT(ptr); } else { CNODE_NEXT(ptrprev) = CNODE_NEXT(ptr); @@ -313,19 +313,19 @@ cfs_unsave(cp) * NOTE: this allows multiple cnodes with same fid -- dcs 1/25/95 */ struct cnode * -cfs_find(fid) +coda_find(fid) ViceFid *fid; { struct cnode *cp; - cp = cfs_cache[cfshash(fid)]; + cp = coda_cache[coda_hash(fid)]; while (cp) { if ((cp->c_fid.Vnode == fid->Vnode) && (cp->c_fid.Volume == fid->Volume) && (cp->c_fid.Unique == fid->Unique) && (!IS_UNMOUNTING(cp))) { - cfs_active++; + coda_active++; return(cp); } cp = CNODE_NEXT(cp); @@ -334,16 +334,16 @@ cfs_find(fid) } /* - * cfs_kill is called as a side effect to vcopen. To prevent any + * coda_kill is called as a side effect to vcopen. To prevent any * cnodes left around from an earlier run of a venus or warden from * causing problems with the new instance, mark any outstanding cnodes * as dying. Future operations on these cnodes should fail (excepting - * cfs_inactive of course!). Since multiple venii/wardens can be + * coda_inactive of course!). Since multiple venii/wardens can be * running, only kill the cnodes for a particular entry in the - * cfs_mnttbl. -- DCS 12/1/94 */ + * coda_mnttbl. -- DCS 12/1/94 */ int -cfs_kill(whoIam, dcstat) +coda_kill(whoIam, dcstat) struct mount *whoIam; enum dc_status dcstat; { @@ -361,16 +361,16 @@ cfs_kill(whoIam, dcstat) /* This is slightly overkill, but should work. Eventually it'd be * nice to only flush those entries from the namecache that * reference a vnode in this vfs. */ - cfsnc_flush(dcstat); + coda_nc_flush(dcstat); - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (CTOV(cp)->v_mount == whoIam) { #ifdef DEBUG - printf("cfs_kill: vp %p, cp %p\n", CTOV(cp), cp); + printf("coda_kill: vp %p, cp %p\n", CTOV(cp), cp); #endif count++; - CFSDEBUG(CFS_FLUSH, + CODADEBUG(CODA_FLUSH, myprintf(("Live cnode fid %lx.%lx.%lx flags %d count %d\n", (cp->c_fid).Volume, (cp->c_fid).Vnode, @@ -388,21 +388,21 @@ cfs_kill(whoIam, dcstat) * name cache or it may be executing. */ void -cfs_flush(dcstat) +coda_flush(dcstat) enum dc_status dcstat; { int hash; struct cnode *cp; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_FLUSH]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_FLUSH]++; - cfsnc_flush(dcstat); /* flush files from the name cache */ + coda_nc_flush(dcstat); /* flush files from the name cache */ - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (!ODD(cp->c_fid.Vnode)) /* only files can be executed */ - cfs_vmflush(cp); + coda_vmflush(cp); } } } @@ -412,13 +412,13 @@ cfs_flush(dcstat) * name cache flush. */ void -cfs_testflush(void) +coda_testflush(void) { int hash; struct cnode *cp; - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { myprintf(("Live cnode fid %lx.%lx.%lx count %d\n", @@ -435,17 +435,17 @@ cfs_testflush(void) * */ void -cfs_unmounting(whoIam) +coda_unmounting(whoIam) struct mount *whoIam; { int hash; struct cnode *cp; - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (CTOV(cp)->v_mount == whoIam) { if (cp->c_flags & (C_LOCKED|C_WANTED)) { - printf("cfs_unmounting: Unlocking %p\n", cp); + printf("coda_unmounting: Unlocking %p\n", cp); cp->c_flags &= ~(C_LOCKED|C_WANTED); wakeup((caddr_t) cp); } @@ -456,8 +456,7 @@ cfs_unmounting(whoIam) } #ifdef DEBUG -void -cfs_checkunmounting(mp) +coda_checkunmounting(mp) struct mount *mp; { register struct vnode *vp, *nvp; @@ -478,29 +477,29 @@ loop: } } -void -cfs_cacheprint(whoIam) +int +coda_cacheprint(whoIam) struct mount *whoIam; { int hash; struct cnode *cp; int count = 0; - printf("cfs_cacheprint: cfs_ctlvp %p, cp %p", cfs_ctlvp, VTOC(cfs_ctlvp)); - cfsnc_name(VTOC(cfs_ctlvp)); + printf("coda_cacheprint: coda_ctlvp %p, cp %p", coda_ctlvp, VTOC(coda_ctlvp)); + coda_nc_name(coda_ctlvp); printf("\n"); - for (hash = 0; hash < CFS_CACHESIZE; hash++) { - for (cp = cfs_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { + for (hash = 0; hash < CODA_CACHESIZE; hash++) { + for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) { if (CTOV(cp)->v_mount == whoIam) { - printf("cfs_cacheprint: vp %p, cp %p", CTOV(cp), cp); - cfsnc_name(cp); + printf("coda_cacheprint: vp %p, cp %p", CTOV(cp), cp); + coda_nc_name(cp); printf("\n"); count++; } } } - printf("cfs_cacheprint: count %d\n", count); + printf("coda_cacheprint: count %d\n", count); } #endif @@ -508,17 +507,17 @@ cfs_cacheprint(whoIam) * There are 6 cases where invalidations occur. The semantics of each * is listed here. * - * CFS_FLUSH -- flush all entries from the name cache and the cnode cache. - * CFS_PURGEUSER -- flush all entries from the name cache for a specific user + * CODA_FLUSH -- flush all entries from the name cache and the cnode cache. + * CODA_PURGEUSER -- flush all entries from the name cache for a specific user * This call is a result of token expiration. * * The next two are the result of callbacks on a file or directory. - * CFS_ZAPDIR -- flush the attributes for the dir from its cnode. + * CODA_ZAPDIR -- flush the attributes for the dir from its cnode. * Zap all children of this directory from the namecache. - * CFS_ZAPFILE -- flush the attributes for a file. + * CODA_ZAPFILE -- flush the attributes for a file. * * The fifth is a result of Venus detecting an inconsistent file. - * CFS_PURGEFID -- flush the attribute for the file + * CODA_PURGEFID -- flush the attribute for the file * If it is a dir (odd vnode), purge its * children from the namecache * remove the file from the namecache. @@ -526,7 +525,7 @@ cfs_cacheprint(whoIam) * The sixth allows Venus to replace local fids with global ones * during reintegration. * - * CFS_REPLACE -- replace one ViceFid with another throughout the name cache + * CODA_REPLACE -- replace one ViceFid with another throughout the name cache */ int handleDownCall(opcode, out) @@ -536,38 +535,38 @@ int handleDownCall(opcode, out) /* Handle invalidate requests. */ switch (opcode) { - case CFS_FLUSH : { + case CODA_FLUSH : { - cfs_flush(IS_DOWNCALL); + coda_flush(IS_DOWNCALL); - CFSDEBUG(CFS_FLUSH,cfs_testflush();) /* print remaining cnodes */ + CODADEBUG(CODA_FLUSH,coda_testflush();) /* print remaining cnodes */ return(0); } - case CFS_PURGEUSER : { - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_PURGEUSER]++; + case CODA_PURGEUSER : { + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_PURGEUSER]++; /* XXX - need to prevent fsync's */ - cfsnc_purge_user(out->cfs_purgeuser.cred.cr_uid, IS_DOWNCALL); + coda_nc_purge_user(out->coda_purgeuser.cred.cr_uid, IS_DOWNCALL); return(0); } - case CFS_ZAPFILE : { + case CODA_ZAPFILE : { struct cnode *cp; error = 0; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_ZAPFILE]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_ZAPFILE]++; - cp = cfs_find(&out->cfs_zapfile.CodaFid); + cp = coda_find(&out->coda_zapfile.CodaFid); if (cp != NULL) { vref(CTOV(cp)); cp->c_flags &= ~C_VATTR; if (CTOV(cp)->v_flag & VTEXT) - error = cfs_vmflush(cp); - CFSDEBUG(CFS_ZAPFILE, myprintf(("zapfile: fid = (%lx.%lx.%lx), + error = coda_vmflush(cp); + CODADEBUG(CODA_ZAPFILE, myprintf(("zapfile: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, @@ -582,20 +581,20 @@ int handleDownCall(opcode, out) return(error); } - case CFS_ZAPDIR : { + case CODA_ZAPDIR : { struct cnode *cp; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_ZAPDIR]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_ZAPDIR]++; - cp = cfs_find(&out->cfs_zapdir.CodaFid); + cp = coda_find(&out->coda_zapdir.CodaFid); if (cp != NULL) { vref(CTOV(cp)); cp->c_flags &= ~C_VATTR; - cfsnc_zapParentfid(&out->cfs_zapdir.CodaFid, IS_DOWNCALL); + coda_nc_zapParentfid(&out->coda_zapdir.CodaFid, IS_DOWNCALL); - CFSDEBUG(CFS_ZAPDIR, myprintf(("zapdir: fid = (%lx.%lx.%lx), + CODADEBUG(CODA_ZAPDIR, myprintf(("zapdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, @@ -609,44 +608,44 @@ int handleDownCall(opcode, out) return(0); } - case CFS_ZAPVNODE : { - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_ZAPVNODE]++; + case CODA_ZAPVNODE : { + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_ZAPVNODE]++; - myprintf(("CFS_ZAPVNODE: Called, but uniplemented\n")); + myprintf(("CODA_ZAPVNODE: Called, but uniplemented\n")); /* * Not that below we must really translate the returned coda_cred to * a netbsd cred. This is a bit muddled at present and the cfsnc_zapnode * is further unimplemented, so punt! * I suppose we could use just the uid. */ - /* cfsnc_zapvnode(&out->cfs_zapvnode.VFid, &out->cfs_zapvnode.cred, + /* coda_nc_zapvnode(&out->coda_zapvnode.VFid, &out->coda_zapvnode.cred, IS_DOWNCALL); */ return(0); } - case CFS_PURGEFID : { + case CODA_PURGEFID : { struct cnode *cp; error = 0; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_PURGEFID]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_PURGEFID]++; - cp = cfs_find(&out->cfs_purgefid.CodaFid); + cp = coda_find(&out->coda_purgefid.CodaFid); if (cp != NULL) { vref(CTOV(cp)); - if (ODD(out->cfs_purgefid.CodaFid.Vnode)) { /* Vnode is a directory */ - cfsnc_zapParentfid(&out->cfs_purgefid.CodaFid, + if (ODD(out->coda_purgefid.CodaFid.Vnode)) { /* Vnode is a directory */ + coda_nc_zapParentfid(&out->coda_purgefid.CodaFid, IS_DOWNCALL); } cp->c_flags &= ~C_VATTR; - cfsnc_zapfid(&out->cfs_purgefid.CodaFid, IS_DOWNCALL); - if (!(ODD(out->cfs_purgefid.CodaFid.Vnode)) + coda_nc_zapfid(&out->coda_purgefid.CodaFid, IS_DOWNCALL); + if (!(ODD(out->coda_purgefid.CodaFid.Vnode)) && (CTOV(cp)->v_flag & VTEXT)) { - error = cfs_vmflush(cp); + error = coda_vmflush(cp); } - CFSDEBUG(CFS_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", + CODADEBUG(CODA_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, CTOV(cp)->v_usecount - 1, error));); @@ -658,24 +657,24 @@ int handleDownCall(opcode, out) return(error); } - case CFS_REPLACE : { + case CODA_REPLACE : { struct cnode *cp = NULL; - cfs_clstat.ncalls++; - cfs_clstat.reqs[CFS_REPLACE]++; + coda_clstat.ncalls++; + coda_clstat.reqs[CODA_REPLACE]++; - cp = cfs_find(&out->cfs_replace.OldFid); + cp = coda_find(&out->coda_replace.OldFid); if (cp != NULL) { /* remove the cnode from the hash table, replace the fid, and reinsert */ vref(CTOV(cp)); - cfs_unsave(cp); - cp->c_fid = out->cfs_replace.NewFid; - cfs_save(cp); - - CFSDEBUG(CFS_REPLACE, myprintf(("replace: oldfid = (%lx.%lx.%lx), newfid = (%lx.%lx.%lx), cp = %p\n", - out->cfs_replace.OldFid.Volume, - out->cfs_replace.OldFid.Vnode, - out->cfs_replace.OldFid.Unique, + coda_unsave(cp); + cp->c_fid = out->coda_replace.NewFid; + coda_save(cp); + + CODADEBUG(CODA_REPLACE, myprintf(("replace: oldfid = (%lx.%lx.%lx), newfid = (%lx.%lx.%lx), cp = %p\n", + out->coda_replace.OldFid.Volume, + out->coda_replace.OldFid.Vnode, + out->coda_replace.OldFid.Unique, cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, cp));) vrele(CTOV(cp)); @@ -688,10 +687,10 @@ int handleDownCall(opcode, out) } } -/* cfs_grab_vnode: lives in either cfs_mach.c or cfs_nbsd.c */ +/* coda_grab_vnode: lives in either cfs_mach.c or cfs_nbsd.c */ int -cfs_vmflush(cp) +coda_vmflush(cp) struct cnode *cp; { return 0; @@ -701,22 +700,22 @@ cfs_vmflush(cp) /* * kernel-internal debugging switches */ -void cfs_debugon(void) +void coda_debugon(void) { - cfsdebug = -1; - cfsnc_debug = -1; - cfs_vnop_print_entry = 1; - cfs_psdev_print_entry = 1; - cfs_vfsop_print_entry = 1; + codadebug = -1; + coda_nc_debug = -1; + coda_vnop_print_entry = 1; + coda_psdev_print_entry = 1; + coda_vfsop_print_entry = 1; } -void cfs_debugoff(void) +void coda_debugoff(void) { - cfsdebug = 0; - cfsnc_debug = 0; - cfs_vnop_print_entry = 0; - cfs_psdev_print_entry = 0; - cfs_vfsop_print_entry = 0; + codadebug = 0; + coda_nc_debug = 0; + coda_vnop_print_entry = 0; + coda_psdev_print_entry = 0; + coda_vfsop_print_entry = 0; } /* diff --git a/sys/fs/coda/coda_subr.h b/sys/fs/coda/coda_subr.h index 0263432..7a68e58 100644 --- a/sys/fs/coda/coda_subr.h +++ b/sys/fs/coda/coda_subr.h @@ -31,15 +31,15 @@ * */ -struct cnode *cfs_alloc(void); -void cfs_free(struct cnode *cp); -struct cnode *cfs_find(ViceFid *fid); -void cfs_flush(enum dc_status dcstat); -void cfs_testflush(void); -void cfs_checkunmounting(struct mount *mp); -void cfs_cacheprint(struct mount *whoIam); -void cfs_debugon(void); -void cfs_debugoff(void); -int cfs_kill(struct mount *whoIam, enum dc_status dcstat); -void cfs_save(struct cnode *cp); -void cfs_unsave(struct cnode *cp); +struct cnode *coda_alloc(void); +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_debugon(void); +void coda_debugoff(void); +int coda_kill(struct mount *whoIam, enum dc_status dcstat); +void coda_save(struct cnode *cp); +void coda_unsave(struct cnode *cp); diff --git a/sys/fs/coda/coda_venus.c b/sys/fs/coda/coda_venus.c index 7f7b30b..586d30d 100644 --- a/sys/fs/coda/coda_venus.c +++ b/sys/fs/coda/coda_venus.c @@ -26,8 +26,8 @@ * improvements or extensions that they make, and to grant Carnegie * Mellon the rights to redistribute these changes without encumbrance. * - * @(#) src/sys/cfs/cfs_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * @(#) src/sys/cfs/coda_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: coda_venus.c,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -45,10 +45,10 @@ #include #define DECL_NO_IN(name) \ - struct cfs_in_hdr *inp; \ + struct coda_in_hdr *inp; \ struct name ## _out *outp; \ - int name ## _size = sizeof (struct cfs_in_hdr); \ - int Isize = sizeof (struct cfs_in_hdr); \ + int name ## _size = sizeof (struct coda_in_hdr); \ + int Isize = sizeof (struct coda_in_hdr); \ int Osize = sizeof (struct name ## _out); \ int error @@ -62,29 +62,29 @@ #define DECL_NO_OUT(name) \ struct name ## _in *inp; \ - struct cfs_out_hdr *outp; \ + struct coda_out_hdr *outp; \ int name ## _size = sizeof (struct name ## _in); \ int Isize = sizeof (struct name ## _in); \ - int Osize = sizeof (struct cfs_out_hdr); \ + int Osize = sizeof (struct coda_out_hdr); \ int error #define ALLOC_NO_IN(name) \ if (Osize > name ## _size) \ name ## _size = Osize; \ - CFS_ALLOC(inp, struct cfs_in_hdr *, name ## _size);\ + CODA_ALLOC(inp, struct coda_in_hdr *, name ## _size);\ outp = (struct name ## _out *) inp #define ALLOC(name) \ if (Osize > name ## _size) \ name ## _size = Osize; \ - CFS_ALLOC(inp, struct name ## _in *, name ## _size);\ + CODA_ALLOC(inp, struct name ## _in *, name ## _size);\ outp = (struct name ## _out *) inp #define ALLOC_NO_OUT(name) \ if (Osize > name ## _size) \ name ## _size = Osize; \ - CFS_ALLOC(inp, struct name ## _in *, name ## _size);\ - outp = (struct cfs_out_hdr *) inp + CODA_ALLOC(inp, struct name ## _in *, name ## _size);\ + outp = (struct coda_out_hdr *) inp #define STRCPY(struc, name, len) \ bcopy(name, (char *)inp + (int)inp->struc, len); \ @@ -163,17 +163,17 @@ venus_root(void *mdp, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid) { - DECL_NO_IN(cfs_root); /* sets Isize & Osize */ - ALLOC_NO_IN(cfs_root); /* sets inp & outp */ + DECL_NO_IN(coda_root); /* sets Isize & Osize */ + ALLOC_NO_IN(coda_root); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(inp, CFS_ROOT, cred, p); + INIT_IN(inp, CODA_ROOT, cred, p); - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) *VFid = outp->VFid; - CFS_FREE(inp, cfs_root_size); + CODA_FREE(inp, coda_root_size); return error; } @@ -183,22 +183,22 @@ venus_open(void *mdp, ViceFid *fid, int flag, /*out*/ dev_t *dev, ino_t *inode) { int cflag; - DECL(cfs_open); /* sets Isize & Osize */ - ALLOC(cfs_open); /* sets inp & outp */ + DECL(coda_open); /* sets Isize & Osize */ + ALLOC(coda_open); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_OPEN, cred, p); + INIT_IN(&inp->ih, CODA_OPEN, cred, p); inp->VFid = *fid; CNV_OFLAG(cflag, flag); inp->flags = cflag; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *dev = outp->dev; *inode = outp->inode; } - CFS_FREE(inp, cfs_open_size); + CODA_FREE(inp, coda_open_size); return error; } @@ -207,17 +207,17 @@ venus_close(void *mdp, ViceFid *fid, int flag, struct ucred *cred, struct proc *p) { int cflag; - DECL_NO_OUT(cfs_close); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_close); /* sets inp & outp */ + DECL_NO_OUT(coda_close); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_close); /* sets inp & outp */ - INIT_IN(&inp->ih, CFS_CLOSE, cred, p); + INIT_IN(&inp->ih, CODA_CLOSE, cred, p); inp->VFid = *fid; CNV_OFLAG(cflag, flag); inp->flags = cflag; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_close_size); + CODA_FREE(inp, coda_close_size); return error; } @@ -244,14 +244,14 @@ venus_ioctl(void *mdp, ViceFid *fid, int com, int flag, caddr_t data, struct ucred *cred, struct proc *p) { - DECL(cfs_ioctl); /* sets Isize & Osize */ + DECL(coda_ioctl); /* sets Isize & Osize */ struct PioctlData *iap = (struct PioctlData *)data; int tmp; - cfs_ioctl_size = VC_MAXMSGSIZE; - ALLOC(cfs_ioctl); /* sets inp & outp */ + coda_ioctl_size = VC_MAXMSGSIZE; + ALLOC(coda_ioctl); /* sets inp & outp */ - INIT_IN(&inp->ih, CFS_IOCTL, cred, p); + INIT_IN(&inp->ih, CODA_IOCTL, cred, p); inp->VFid = *fid; /* command was mutated by increasing its size field to reflect the @@ -264,17 +264,17 @@ venus_ioctl(void *mdp, ViceFid *fid, inp->rwflag = flag; inp->len = iap->vi.in_size; - inp->data = (char *)(sizeof (struct cfs_ioctl_in)); + inp->data = (char *)(sizeof (struct coda_ioctl_in)); error = copyin(iap->vi.in, (char*)inp + (int)inp->data, iap->vi.in_size); if (error) { - CFS_FREE(inp, cfs_ioctl_size); + CODA_FREE(inp, coda_ioctl_size); return(error); } Osize = VC_MAXMSGSIZE; - error = cfscall(mdp, Isize + iap->vi.in_size, &Osize, (char *)inp); + error = coda_call(mdp, Isize + iap->vi.in_size, &Osize, (char *)inp); /* copy out the out buffer. */ if (!error) { @@ -286,7 +286,7 @@ venus_ioctl(void *mdp, ViceFid *fid, } } - CFS_FREE(inp, cfs_ioctl_size); + CODA_FREE(inp, coda_ioctl_size); return error; } @@ -295,19 +295,19 @@ venus_getattr(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ struct vattr *vap) { - DECL(cfs_getattr); /* sets Isize & Osize */ - ALLOC(cfs_getattr); /* sets inp & outp */ + DECL(coda_getattr); /* sets Isize & Osize */ + ALLOC(coda_getattr); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_GETATTR, cred, p); + INIT_IN(&inp->ih, CODA_GETATTR, cred, p); inp->VFid = *fid; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { CNV_VV2V_ATTR(vap, &outp->attr); } - CFS_FREE(inp, cfs_getattr_size); + CODA_FREE(inp, coda_getattr_size); return error; } @@ -315,17 +315,17 @@ int venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_setattr); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_setattr); /* sets inp & outp */ + DECL_NO_OUT(coda_setattr); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_setattr); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_SETATTR, cred, p); + INIT_IN(&inp->ih, CODA_SETATTR, cred, p); inp->VFid = *fid; CNV_V2VV_ATTR(&inp->attr, vap); - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_setattr_size); + CODA_FREE(inp, coda_setattr_size); return error; } @@ -333,11 +333,11 @@ int venus_access(void *mdp, ViceFid *fid, int mode, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_access); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_access); /* sets inp & outp */ + DECL_NO_OUT(coda_access); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_access); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_ACCESS, cred, p); + INIT_IN(&inp->ih, CODA_ACCESS, cred, p); inp->VFid = *fid; /* NOTE: * NetBSD and Venus internals use the "data" in the low 3 bits. @@ -345,9 +345,9 @@ venus_access(void *mdp, ViceFid *fid, int mode, */ inp->flags = mode>>6; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_access_size); + CODA_FREE(inp, coda_access_size); return error; } @@ -356,23 +356,23 @@ venus_readlink(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ char **str, int *len) { - DECL(cfs_readlink); /* sets Isize & Osize */ - cfs_readlink_size += CFS_MAXPATHLEN; - ALLOC(cfs_readlink); /* sets inp & outp */ + DECL(coda_readlink); /* sets Isize & Osize */ + coda_readlink_size += CODA_MAXPATHLEN; + ALLOC(coda_readlink); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_READLINK, cred, p); + INIT_IN(&inp->ih, CODA_READLINK, cred, p); inp->VFid = *fid; - Osize += CFS_MAXPATHLEN; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + Osize += CODA_MAXPATHLEN; + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { - CFS_ALLOC(*str, char *, outp->count); + CODA_ALLOC(*str, char *, outp->count); *len = outp->count; bcopy((char *)outp + (int)outp->data, *str, *len); } - CFS_FREE(inp, cfs_readlink_size); + CODA_FREE(inp, coda_readlink_size); return error; } @@ -380,16 +380,16 @@ int venus_fsync(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_fsync); /* sets Isize & Osize */ - ALLOC_NO_OUT(cfs_fsync); /* sets inp & outp */ + DECL_NO_OUT(coda_fsync); /* sets Isize & Osize */ + ALLOC_NO_OUT(coda_fsync); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_FSYNC, cred, p); + INIT_IN(&inp->ih, CODA_FSYNC, cred, p); inp->VFid = *fid; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_fsync_size); + CODA_FREE(inp, coda_fsync_size); return error; } @@ -399,24 +399,24 @@ venus_lookup(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, int *vtype) { - DECL(cfs_lookup); /* sets Isize & Osize */ - cfs_lookup_size += len + 1; - ALLOC(cfs_lookup); /* sets inp & outp */ + DECL(coda_lookup); /* sets Isize & Osize */ + coda_lookup_size += len + 1; + ALLOC(coda_lookup); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_LOOKUP, cred, p); + INIT_IN(&inp->ih, CODA_LOOKUP, cred, p); inp->VFid = *fid; inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; *vtype = outp->vtype; } - CFS_FREE(inp, cfs_lookup_size); + CODA_FREE(inp, coda_lookup_size); return error; } @@ -426,12 +426,12 @@ venus_create(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, struct vattr *attr) { - DECL(cfs_create); /* sets Isize & Osize */ - cfs_create_size += len + 1; - ALLOC(cfs_create); /* sets inp & outp */ + DECL(coda_create); /* sets Isize & Osize */ + coda_create_size += len + 1; + ALLOC(coda_create); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_CREATE, cred, p); + INIT_IN(&inp->ih, CODA_CREATE, cred, p); inp->VFid = *fid; inp->excl = exclusive ? C_O_EXCL : 0; inp->mode = mode; @@ -440,13 +440,13 @@ venus_create(void *mdp, ViceFid *fid, inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; CNV_VV2V_ATTR(attr, &outp->attr); } - CFS_FREE(inp, cfs_create_size); + CODA_FREE(inp, coda_create_size); return error; } @@ -455,20 +455,20 @@ venus_remove(void *mdp, ViceFid *fid, const char *nm, int len, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_remove); /* sets Isize & Osize */ - cfs_remove_size += len + 1; - ALLOC_NO_OUT(cfs_remove); /* sets inp & outp */ + DECL_NO_OUT(coda_remove); /* sets Isize & Osize */ + coda_remove_size += len + 1; + ALLOC_NO_OUT(coda_remove); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_REMOVE, cred, p); + INIT_IN(&inp->ih, CODA_REMOVE, cred, p); inp->VFid = *fid; inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_remove_size); + CODA_FREE(inp, coda_remove_size); return error; } @@ -477,21 +477,21 @@ venus_link(void *mdp, ViceFid *fid, ViceFid *tfid, const char *nm, int len, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_link); /* sets Isize & Osize */ - cfs_link_size += len + 1; - ALLOC_NO_OUT(cfs_link); /* sets inp & outp */ + DECL_NO_OUT(coda_link); /* sets Isize & Osize */ + coda_link_size += len + 1; + ALLOC_NO_OUT(coda_link); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_LINK, cred, p); + INIT_IN(&inp->ih, CODA_LINK, cred, p); inp->sourceFid = *fid; inp->destFid = *tfid; inp->tname = Isize; STRCPY(tname, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_link_size); + CODA_FREE(inp, coda_link_size); return error; } @@ -500,12 +500,12 @@ venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid, const char *nm, int len, const char *tnm, int tlen, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_rename); /* sets Isize & Osize */ - cfs_rename_size += len + 1 + tlen + 1; - ALLOC_NO_OUT(cfs_rename); /* sets inp & outp */ + DECL_NO_OUT(coda_rename); /* sets Isize & Osize */ + coda_rename_size += len + 1 + tlen + 1; + ALLOC_NO_OUT(coda_rename); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_RENAME, cred, p); + INIT_IN(&inp->ih, CODA_RENAME, cred, p); inp->sourceFid = *fid; inp->destFid = *tfid; @@ -515,9 +515,9 @@ venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid, inp->destname = Isize; STRCPY(destname, tnm, tlen); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_rename_size); + CODA_FREE(inp, coda_rename_size); return error; } @@ -527,25 +527,25 @@ venus_mkdir(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, struct vattr *ova) { - DECL(cfs_mkdir); /* sets Isize & Osize */ - cfs_mkdir_size += len + 1; - ALLOC(cfs_mkdir); /* sets inp & outp */ + DECL(coda_mkdir); /* sets Isize & Osize */ + coda_mkdir_size += len + 1; + ALLOC(coda_mkdir); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_MKDIR, cred, p); + INIT_IN(&inp->ih, CODA_MKDIR, cred, p); inp->VFid = *fid; CNV_V2VV_ATTR(&inp->attr, va); inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; CNV_VV2V_ATTR(ova, &outp->attr); } - CFS_FREE(inp, cfs_mkdir_size); + CODA_FREE(inp, coda_mkdir_size); return error; } @@ -554,20 +554,20 @@ venus_rmdir(void *mdp, ViceFid *fid, const char *nm, int len, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_rmdir); /* sets Isize & Osize */ - cfs_rmdir_size += len + 1; - ALLOC_NO_OUT(cfs_rmdir); /* sets inp & outp */ + DECL_NO_OUT(coda_rmdir); /* sets Isize & Osize */ + coda_rmdir_size += len + 1; + ALLOC_NO_OUT(coda_rmdir); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_RMDIR, cred, p); + INIT_IN(&inp->ih, CODA_RMDIR, cred, p); inp->VFid = *fid; inp->name = Isize; STRCPY(name, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_rmdir_size); + CODA_FREE(inp, coda_rmdir_size); return error; } @@ -576,12 +576,12 @@ venus_symlink(void *mdp, ViceFid *fid, const char *lnm, int llen, const char *nm, int len, struct vattr *va, struct ucred *cred, struct proc *p) { - DECL_NO_OUT(cfs_symlink); /* sets Isize & Osize */ - cfs_symlink_size += llen + 1 + len + 1; - ALLOC_NO_OUT(cfs_symlink); /* sets inp & outp */ + DECL_NO_OUT(coda_symlink); /* sets Isize & Osize */ + coda_symlink_size += llen + 1 + len + 1; + ALLOC_NO_OUT(coda_symlink); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_SYMLINK, cred, p); + INIT_IN(&inp->ih, CODA_SYMLINK, cred, p); inp->VFid = *fid; CNV_V2VV_ATTR(&inp->attr, va); @@ -591,9 +591,9 @@ venus_symlink(void *mdp, ViceFid *fid, inp->tname = Isize; STRCPY(tname, nm, len); /* increments Isize */ - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); - CFS_FREE(inp, cfs_symlink_size); + CODA_FREE(inp, coda_symlink_size); return error; } @@ -603,24 +603,24 @@ venus_readdir(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ char *buffer, int *len) { - DECL(cfs_readdir); /* sets Isize & Osize */ - cfs_readdir_size = VC_MAXMSGSIZE; - ALLOC(cfs_readdir); /* sets inp & outp */ + DECL(coda_readdir); /* sets Isize & Osize */ + coda_readdir_size = VC_MAXMSGSIZE; + ALLOC(coda_readdir); /* sets inp & outp */ /* send the open to venus. */ - INIT_IN(&inp->ih, CFS_READDIR, cred, p); + INIT_IN(&inp->ih, CODA_READDIR, cred, p); inp->VFid = *fid; inp->count = count; inp->offset = offset; Osize = VC_MAXMSGSIZE; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { bcopy((char *)outp + (int)outp->data, buffer, outp->size); *len = outp->size; } - CFS_FREE(inp, cfs_readdir_size); + CODA_FREE(inp, coda_readdir_size); return error; } @@ -629,19 +629,19 @@ venus_fhtovp(void *mdp, ViceFid *fid, struct ucred *cred, struct proc *p, /*out*/ ViceFid *VFid, int *vtype) { - DECL(cfs_vget); /* sets Isize & Osize */ - ALLOC(cfs_vget); /* sets inp & outp */ + DECL(coda_vget); /* sets Isize & Osize */ + ALLOC(coda_vget); /* sets inp & outp */ /* Send the open to Venus. */ - INIT_IN(&inp->ih, CFS_VGET, cred, p); + INIT_IN(&inp->ih, CODA_VGET, cred, p); inp->VFid = *fid; - error = cfscall(mdp, Isize, &Osize, (char *)inp); + error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { *VFid = outp->VFid; *vtype = outp->vtype; } - CFS_FREE(inp, cfs_vget_size); + CODA_FREE(inp, coda_vget_size); return error; } diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c index 0831e17..0abddd3 100644 --- a/sys/fs/coda/coda_vfsops.c +++ b/sys/fs/coda/coda_vfsops.c @@ -26,8 +26,8 @@ * improvements or extensions that they make, and to grant Carnegie * Mellon the rights to redistribute these changes without encumbrance. * - * @(#) src/sys/cfs/cfs_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: cfs_vfsops.c,v 1.2 1998/09/02 19:09:53 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.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -46,7 +46,7 @@ /* * HISTORY - * $Log: cfs_vfsops.c,v $ + * $Log: coda_vfsops.c,v $ * Revision 1.2 1998/09/02 19:09:53 rvb * Pass2 complete * @@ -69,13 +69,13 @@ * Fixes up mainly to flush iopen and friends * * Revision 1.7 98/01/23 11:53:45 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.6.2.6 98/01/23 11:21:07 rvb * Sync with 2.2.5 * * Revision 1.6.2.5 98/01/22 13:05:33 rvb - * Move makecfsnode ctlfid later so vfsp is known + * Move make_coda_node ctlfid later so vfsp is known * * Revision 1.6.2.4 97/12/19 14:26:05 rvb * session id @@ -96,7 +96,7 @@ * Final cfs_venus.c w/o macros, but one locking bug * * Revision 1.5.14.7 97/11/21 13:22:03 rvb - * Catch a few cfscalls in cfs_vfsops.c + * Catch a few coda_calls in coda_vfsops.c * * Revision 1.5.14.6 97/11/20 11:46:48 rvb * Capture current cfs_venus @@ -134,7 +134,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:32 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:02 bnoble * Branch for NetBSD port revisions @@ -162,7 +162,7 @@ * merge kernel/latest and alpha/src/cfs * * Revision 2.3 92/09/30 14:16:32 mja - * Added call to cfs_flush to cfs_unmount. + * Added call to coda_flush to coda_unmount. * [90/12/15 dcs] * * Added contributors blurb. @@ -177,7 +177,7 @@ * * */ -#include +#include #include #include @@ -198,56 +198,56 @@ #include -MALLOC_DEFINE(M_CFS, "CFS storage", "Various Coda Structures"); +MALLOC_DEFINE(M_CODA, "CODA storage", "Various Coda Structures"); -int cfsdebug = 0; -int cfs_vfsop_print_entry = 0; -#define ENTRY if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) +int codadebug = 0; +int coda_vfsop_print_entry = 0; +#define ENTRY if(coda_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) -struct vnode *cfs_ctlvp; -struct cfs_mntinfo cfs_mnttbl[NVCFS]; /* indexed by minor device number */ +struct vnode *coda_ctlvp; +struct coda_mntinfo coda_mnttbl[NVCODA]; /* indexed by minor device number */ /* structure to keep statistics of internally generated/satisfied calls */ -struct cfs_op_stats cfs_vfsopstats[CFS_VFSOPS_SIZE]; +struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE]; -#define MARK_ENTRY(op) (cfs_vfsopstats[op].entries++) -#define MARK_INT_SAT(op) (cfs_vfsopstats[op].sat_intrn++) -#define MARK_INT_FAIL(op) (cfs_vfsopstats[op].unsat_intrn++) -#define MRAK_INT_GEN(op) (cfs_vfsopstats[op].gen_intrn++) +#define MARK_ENTRY(op) (coda_vfsopstats[op].entries++) +#define MARK_INT_SAT(op) (coda_vfsopstats[op].sat_intrn++) +#define MARK_INT_FAIL(op) (coda_vfsopstats[op].unsat_intrn++) +#define MRAK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++) -extern int cfsnc_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 *)); -struct vfsops cfs_vfsops = { - cfs_mount, - cfs_start, - cfs_unmount, - cfs_root, - cfs_quotactl, - cfs_nb_statfs, - cfs_sync, - cfs_vget, +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, - cfs_init, + coda_init, }; -VFS_SET(cfs_vfsops, cfs, VFCF_NETWORK); +VFS_SET(coda_vfsops, coda, VFCF_NETWORK); int -cfs_vfsopstats_init(void) +coda_vfsopstats_init(void) { register int i; - for (i=0;ini_vp; if (error) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return (error); } if (dvp->v_type != VCHR) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); vrele(dvp); return(ENXIO); } dev = dvp->v_specinfo->si_rdev; vrele(dvp); if (major(dev) >= nchrdev || major(dev) < 0) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENXIO); } @@ -313,22 +313,22 @@ cfs_mount(vfsp, path, data, ndp, p) */ if (cdevsw[major(dev)]->d_open != vc_nb_open) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENXIO); } - if (minor(dev) >= NVCFS || minor(dev) < 0) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + if (minor(dev) >= NVCODA || minor(dev) < 0) { + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENXIO); } /* * Initialize the mount record and link it to the vfs struct */ - mi = &cfs_mnttbl[minor(dev)]; + mi = &coda_mnttbl[minor(dev)]; if (!VC_OPEN(&mi->mi_vcomm)) { - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); return(ENODEV); } @@ -340,27 +340,27 @@ cfs_mount(vfsp, path, data, ndp, p) /* * Make a root vnode to placate the Vnode interface, but don't - * actually make the CFS_ROOT call to venus until the first call - * to cfs_root in case a server is down while venus is starting. + * actually make the CODA_ROOT call to venus until the first call + * to coda_root in case a server is down while venus is starting. */ rootfid.Volume = 0; rootfid.Vnode = 0; rootfid.Unique = 0; - cp = makecfsnode(&rootfid, vfsp, VDIR); + cp = make_coda_node(&rootfid, vfsp, VDIR); rootvp = CTOV(cp); rootvp->v_flag |= VROOT; ctlfid.Volume = CTL_VOL; ctlfid.Vnode = CTL_VNO; ctlfid.Unique = CTL_UNI; -/* cp = makecfsnode(&ctlfid, vfsp, VCHR); +/* cp = make_coda_node(&ctlfid, vfsp, VCHR); The above code seems to cause a loop in the cnode links. I don't totally understand when it happens, it is caught when closing down the system. */ - cp = makecfsnode(&ctlfid, 0, VCHR); + cp = make_coda_node(&ctlfid, 0, VCHR); - cfs_ctlvp = CTOV(cp); + coda_ctlvp = CTOV(cp); /* Add vfs and rootvp to chain of vfs hanging off mntinfo */ mi->mi_vfsp = vfsp; @@ -377,18 +377,18 @@ cfs_mount(vfsp, path, data, ndp, p) /* error is currently guaranteed to be zero, but in case some code changes... */ - CFSDEBUG(1, - myprintf(("cfs_mount returned %d\n",error));); + CODADEBUG(1, + myprintf(("coda_mount returned %d\n",error));); if (error) - MARK_INT_FAIL(CFS_MOUNT_STATS); + MARK_INT_FAIL(CODA_MOUNT_STATS); else - MARK_INT_SAT(CFS_MOUNT_STATS); + MARK_INT_SAT(CODA_MOUNT_STATS); return(error); } int -cfs_start(vfsp, flags, p) +coda_start(vfsp, flags, p) struct mount *vfsp; int flags; struct proc *p; @@ -398,18 +398,18 @@ cfs_start(vfsp, flags, p) } int -cfs_unmount(vfsp, mntflags, p) +coda_unmount(vfsp, mntflags, p) struct mount *vfsp; int mntflags; struct proc *p; { - struct cfs_mntinfo *mi = vftomi(vfsp); + struct coda_mntinfo *mi = vftomi(vfsp); int active, error = 0; ENTRY; - MARK_ENTRY(CFS_UMOUNT_STATS); - if (!CFS_MOUNTED(vfsp)) { - MARK_INT_FAIL(CFS_UMOUNT_STATS); + MARK_ENTRY(CODA_UMOUNT_STATS); + if (!CODA_MOUNTED(vfsp)) { + MARK_INT_FAIL(CODA_UMOUNT_STATS); return(EINVAL); } @@ -418,13 +418,13 @@ cfs_unmount(vfsp, mntflags, p) return (EBUSY); /* Venus is still running */ #ifdef DEBUG - printf("cfs_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp)); + printf("coda_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp)); #endif vrele(mi->mi_rootvp); - active = cfs_kill(vfsp, NOT_DOWNCALL); + active = coda_kill(vfsp, NOT_DOWNCALL); error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE); - printf("cfs_unmount: active = %d, vflush active %d\n", active, error); + printf("coda_unmount: active = %d, vflush active %d\n", active, error); error = 0; /* I'm going to take this out to allow lookups to go through. I'm * not sure it's important anyway. -- DCS 2/2/94 @@ -436,9 +436,9 @@ cfs_unmount(vfsp, mntflags, p) mi->mi_rootvp = NULL; if (error) - MARK_INT_FAIL(CFS_UMOUNT_STATS); + MARK_INT_FAIL(CODA_UMOUNT_STATS); else - MARK_INT_SAT(CFS_UMOUNT_STATS); + MARK_INT_SAT(CODA_UMOUNT_STATS); return(error); } @@ -449,18 +449,18 @@ cfs_unmount(vfsp, mntflags, p) * find root of cfs */ int -cfs_root(vfsp, vpp) +coda_root(vfsp, vpp) struct mount *vfsp; struct vnode **vpp; { - struct cfs_mntinfo *mi = vftomi(vfsp); + struct coda_mntinfo *mi = vftomi(vfsp); struct vnode **result; int error; struct proc *p = curproc; /* XXX - bnoble */ ViceFid VFid; ENTRY; - MARK_ENTRY(CFS_ROOT_STATS); + MARK_ENTRY(CODA_ROOT_STATS); result = NULL; if (vfsp == mi->mi_vfsp) { @@ -476,7 +476,7 @@ cfs_root(vfsp, vpp) #else vget(*vpp, LK_EXCLUSIVE, p); #endif - MARK_INT_SAT(CFS_ROOT_STATS); + MARK_INT_SAT(CODA_ROOT_STATS); return(0); } } @@ -488,9 +488,9 @@ cfs_root(vfsp, vpp) * Save the new rootfid in the cnode, and rehash the cnode into the * cnode hash with the new fid key. */ - cfs_unsave(VTOC(mi->mi_rootvp)); + coda_unsave(VTOC(mi->mi_rootvp)); VTOC(mi->mi_rootvp)->c_fid = VFid; - cfs_save(VTOC(mi->mi_rootvp)); + coda_save(VTOC(mi->mi_rootvp)); *vpp = mi->mi_rootvp; #if 1 @@ -500,16 +500,16 @@ cfs_root(vfsp, vpp) vget(*vpp, LK_EXCLUSIVE, p); #endif - MARK_INT_SAT(CFS_ROOT_STATS); + MARK_INT_SAT(CODA_ROOT_STATS); goto exit; } else if (error == ENODEV) { /* Gross hack here! */ /* - * If Venus fails to respond to the CFS_ROOT call, cfscall returns + * If Venus fails to respond to the CODA_ROOT call, coda_call returns * ENODEV. Return the uninitialized root vnode to allow vfs * operations such as unmount to continue. Without this hack, * there is no way to do an unmount if Venus dies before a - * successful CFS_ROOT call is done. All vnode operations + * successful CODA_ROOT call is done. All vnode operations * will fail. */ *vpp = mi->mi_rootvp; @@ -520,12 +520,12 @@ cfs_root(vfsp, vpp) vget(*vpp, LK_EXCLUSIVE, p); #endif - MARK_INT_FAIL(CFS_ROOT_STATS); + MARK_INT_FAIL(CODA_ROOT_STATS); error = 0; goto exit; } else { - CFSDEBUG( CFS_ROOT, myprintf(("error %d in CFS_ROOT\n", error)); ); - MARK_INT_FAIL(CFS_ROOT_STATS); + CODADEBUG( CODA_ROOT, myprintf(("error %d in CODA_ROOT\n", error)); ); + MARK_INT_FAIL(CODA_ROOT_STATS); goto exit; } @@ -535,7 +535,7 @@ cfs_root(vfsp, vpp) } int -cfs_quotactl(vfsp, cmd, uid, arg, p) +coda_quotactl(vfsp, cmd, uid, arg, p) struct mount *vfsp; int cmd; uid_t uid; @@ -550,15 +550,15 @@ cfs_quotactl(vfsp, cmd, uid, arg, p) * Get file system statistics. */ int -cfs_nb_statfs(vfsp, sbp, p) +coda_nb_statfs(vfsp, sbp, p) register struct mount *vfsp; struct statfs *sbp; struct proc *p; { ENTRY; -/* MARK_ENTRY(CFS_STATFS_STATS); */ - if (!CFS_MOUNTED(vfsp)) { -/* MARK_INT_FAIL(CFS_STATFS_STATS);*/ +/* MARK_ENTRY(CODA_STATFS_STATS); */ + if (!CODA_MOUNTED(vfsp)) { +/* MARK_INT_FAIL(CODA_STATFS_STATS);*/ return(EINVAL); } @@ -579,8 +579,8 @@ cfs_nb_statfs(vfsp, sbp, p) sbp->f_ffree = NB_SFS_SIZ; bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t)); strcpy(sbp->f_mntonname, "/coda"); - strcpy(sbp->f_mntfromname, "CFS"); -/* MARK_INT_SAT(CFS_STATFS_STATS); */ + strcpy(sbp->f_mntfromname, "CODA"); +/* MARK_INT_SAT(CODA_STATFS_STATS); */ return(0); } @@ -588,20 +588,20 @@ cfs_nb_statfs(vfsp, sbp, p) * Flush any pending I/O. */ int -cfs_sync(vfsp, waitfor, cred, p) +coda_sync(vfsp, waitfor, cred, p) struct mount *vfsp; int waitfor; struct ucred *cred; struct proc *p; { ENTRY; - MARK_ENTRY(CFS_SYNC_STATS); - MARK_INT_SAT(CFS_SYNC_STATS); + MARK_ENTRY(CODA_SYNC_STATS); + MARK_INT_SAT(CODA_SYNC_STATS); return(0); } int -cfs_vget(vfsp, ino, vpp) +coda_vget(vfsp, ino, vpp) struct mount *vfsp; ino_t ino; struct vnode **vpp; @@ -616,7 +616,7 @@ cfs_vget(vfsp, ino, vpp) * a type-specific fid. */ int -cfs_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp) +coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp) register struct mount *vfsp; struct fid *fhp; struct mbuf *nam; @@ -633,33 +633,33 @@ cfs_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp) ENTRY; - MARK_ENTRY(CFS_VGET_STATS); + MARK_ENTRY(CODA_VGET_STATS); /* Check for vget of control object. */ if (IS_CTL_FID(&cfid->cfid_fid)) { - *vpp = cfs_ctlvp; - vref(cfs_ctlvp); - MARK_INT_SAT(CFS_VGET_STATS); + *vpp = coda_ctlvp; + vref(coda_ctlvp); + MARK_INT_SAT(CODA_VGET_STATS); return(0); } error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, p->p_cred->pc_ucred, p, &VFid, &vtype); if (error) { - CFSDEBUG(CFS_VGET, myprintf(("vget error %d\n",error));) + CODADEBUG(CODA_VGET, myprintf(("vget error %d\n",error));) *vpp = (struct vnode *)0; } else { - CFSDEBUG(CFS_VGET, + CODADEBUG(CODA_VGET, myprintf(("vget: vol %lx vno %lx uni %lx type %d result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, vtype, error)); ) - cp = makecfsnode(&VFid, vfsp, vtype); + cp = make_coda_node(&VFid, vfsp, vtype); *vpp = CTOV(cp); } return(error); } int -cfs_vptofh(vnp, fidp) +coda_vptofh(vnp, fidp) struct vnode *vnp; struct fid *fidp; { @@ -668,7 +668,7 @@ cfs_vptofh(vnp, fidp) } int -cfs_init(struct vfsconf *vfsp) +coda_init(struct vfsconf *vfsp) { ENTRY; return 0; @@ -685,7 +685,7 @@ getNewVnode(vpp) struct vnode **vpp; { struct cfid cfid; - struct cfs_mntinfo *mi = vftomi((*vpp)->v_mount); + struct coda_mntinfo *mi = vftomi((*vpp)->v_mount); ENTRY; @@ -699,7 +699,7 @@ getNewVnode(vpp) if (mi->mi_vfsp == NULL) return ENODEV; - return cfs_fhtovp(mi->mi_vfsp, (struct fid*)&cfid, NULL, vpp, + return coda_fhtovp(mi->mi_vfsp, (struct fid*)&cfid, NULL, vpp, NULL, NULL); } diff --git a/sys/fs/coda/coda_vfsops.h b/sys/fs/coda/coda_vfsops.h index 754bbf3..ef23c3f 100644 --- a/sys/fs/coda/coda_vfsops.h +++ b/sys/fs/coda/coda_vfsops.h @@ -26,8 +26,8 @@ * improvements or extensions that they make, and to grant Carnegie * Mellon the rights to redistribute these changes without encumbrance. * - * @(#) src/sys/cfs/cfs_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * @(#) src/sys/cfs/coda_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ + * $Id: coda_vfsops.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -45,19 +45,19 @@ struct cfid { struct mount; -int cfs_vfsopstats_init(void); -int cfs_mount(struct mount *, char *, caddr_t, struct nameidata *, +int coda_vfsopstats_init(void); +int coda_mount(struct mount *, char *, caddr_t, struct nameidata *, struct proc *); -int cfs_start(struct mount *, int, struct proc *); -int cfs_unmount(struct mount *, int, struct proc *); -int cfs_root(struct mount *, struct vnode **); -int cfs_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *); -int cfs_nb_statfs(struct mount *, struct statfs *, struct proc *); -int cfs_sync(struct mount *, int, struct ucred *, struct proc *); -int cfs_vget(struct mount *, ino_t, struct vnode **); -int cfs_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, +int coda_start(struct mount *, int, struct proc *); +int coda_unmount(struct mount *, int, struct proc *); +int coda_root(struct mount *, struct vnode **); +int coda_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *); +int coda_nb_statfs(struct mount *, struct statfs *, struct proc *); +int coda_sync(struct mount *, int, struct ucred *, struct proc *); +int coda_vget(struct mount *, ino_t, struct vnode **); +int coda_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **); -int cfs_vptofh(struct vnode *, struct fid *); -int cfs_init(struct vfsconf *vfsp); +int coda_vptofh(struct vnode *, struct fid *); +int coda_init(struct vfsconf *vfsp); int getNewVnode(struct vnode **vpp); diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index c5c8203..f505af5 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/cfs/cfs_vnodeops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfs_vnodeops.c,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -48,6 +48,9 @@ /* * HISTORY * $Log: cfs_vnodeops.c,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -73,7 +76,7 @@ * First version that works on FreeBSD 2.2.5 * * Revision 1.6 98/01/23 11:53:47 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.5.2.8 98/01/23 11:21:11 rvb * Sync with 2.2.5 @@ -88,7 +91,7 @@ * Sync with 1.3 * * Revision 1.5.2.4 97/12/10 14:08:31 rvb - * Fix O_ flags; check result in cfscall + * Fix O_ flags; check result in coda_call * * Revision 1.5.2.3 97/12/10 11:40:27 rvb * No more ody @@ -134,7 +137,7 @@ * >64Meg; venus can be killed! * * Revision 1.4 1997/02/20 13:54:50 lily - * check for NULL return from cfsnc_lookup before CTOV + * check for NULL return from coda_nc_lookup before CTOV * * Revision 1.3 1996/12/12 22:11:02 bnoble * Fixed the "downcall invokes venus operation" deadlock in all known cases. @@ -144,7 +147,7 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:34 bnoble - * Added CFS-specific files + * Added CODA-specific files * * Revision 3.1.1.1 1995/03/04 19:08:06 bnoble * Branch for NetBSD port revisions @@ -249,76 +252,76 @@ /* * These flags select various performance enhancements. */ -int cfs_attr_cache = 1; /* Set to cache attributes in the kernel */ -int cfs_symlink_cache = 1; /* Set to cache symbolic link information */ -int cfs_access_cache = 1; /* Set to handle some access checks directly */ +int coda_attr_cache = 1; /* Set to cache attributes in the kernel */ +int coda_symlink_cache = 1; /* Set to cache symbolic link information */ +int coda_access_cache = 1; /* Set to handle some access checks directly */ /* structure to keep track of vfs calls */ -struct cfs_op_stats cfs_vnodeopstats[CFS_VNODEOPS_SIZE]; +struct coda_op_stats coda_vnodeopstats[CODA_VNODEOPS_SIZE]; -#define MARK_ENTRY(op) (cfs_vnodeopstats[op].entries++) -#define MARK_INT_SAT(op) (cfs_vnodeopstats[op].sat_intrn++) -#define MARK_INT_FAIL(op) (cfs_vnodeopstats[op].unsat_intrn++) -#define MARK_INT_GEN(op) (cfs_vnodeopstats[op].gen_intrn++) +#define MARK_ENTRY(op) (coda_vnodeopstats[op].entries++) +#define MARK_INT_SAT(op) (coda_vnodeopstats[op].sat_intrn++) +#define MARK_INT_FAIL(op) (coda_vnodeopstats[op].unsat_intrn++) +#define MARK_INT_GEN(op) (coda_vnodeopstats[op].gen_intrn++) /* What we are delaying for in printf */ -int cfs_printf_delay = 0; /* in microseconds */ -int cfs_vnop_print_entry = 0; -static int cfs_lockdebug = 0; +int coda_printf_delay = 0; /* in microseconds */ +int coda_vnop_print_entry = 0; +static int coda_lockdebug = 0; /* Definition of the vfs operation vector */ /* * Some NetBSD details: * - * cfs_start is called at the end of the mount syscall. - * cfs_init is called at boot time. + * coda_start is called at the end of the mount syscall. + * coda_init is called at boot time. */ -#define ENTRY if(cfs_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) +#define ENTRY if(coda_vnop_print_entry) myprintf(("Entered %s\n",__FUNCTION__)) /* Definition of the vnode operation vector */ -struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { - { &vop_default_desc, cfs_vop_error }, - { &vop_lookup_desc, cfs_lookup }, /* lookup */ - { &vop_create_desc, cfs_create }, /* create */ - { &vop_mknod_desc, cfs_vop_error }, /* mknod */ - { &vop_open_desc, cfs_open }, /* open */ - { &vop_close_desc, cfs_close }, /* close */ - { &vop_access_desc, cfs_access }, /* access */ - { &vop_getattr_desc, cfs_getattr }, /* getattr */ - { &vop_setattr_desc, cfs_setattr }, /* setattr */ - { &vop_read_desc, cfs_read }, /* read */ - { &vop_write_desc, cfs_write }, /* write */ - { &vop_ioctl_desc, cfs_ioctl }, /* ioctl */ - { &vop_mmap_desc, cfs_vop_error }, /* mmap */ - { &vop_fsync_desc, cfs_fsync }, /* fsync */ - { &vop_remove_desc, cfs_remove }, /* remove */ - { &vop_link_desc, cfs_link }, /* link */ - { &vop_rename_desc, cfs_rename }, /* rename */ - { &vop_mkdir_desc, cfs_mkdir }, /* mkdir */ - { &vop_rmdir_desc, cfs_rmdir }, /* rmdir */ - { &vop_symlink_desc, cfs_symlink }, /* symlink */ - { &vop_readdir_desc, cfs_readdir }, /* readdir */ - { &vop_readlink_desc, cfs_readlink }, /* readlink */ - { &vop_abortop_desc, cfs_abortop }, /* abortop */ - { &vop_inactive_desc, cfs_inactive }, /* inactive */ - { &vop_reclaim_desc, cfs_reclaim }, /* reclaim */ - { &vop_lock_desc, cfs_lock }, /* lock */ - { &vop_unlock_desc, cfs_unlock }, /* unlock */ - { &vop_bmap_desc, cfs_bmap }, /* bmap */ - { &vop_strategy_desc, cfs_strategy }, /* strategy */ - { &vop_print_desc, cfs_vop_error }, /* print */ - { &vop_islocked_desc, cfs_islocked }, /* islocked */ - { &vop_pathconf_desc, cfs_vop_error }, /* pathconf */ - { &vop_advlock_desc, cfs_vop_nop }, /* advlock */ - { &vop_bwrite_desc, cfs_vop_error }, /* bwrite */ - { &vop_lease_desc, cfs_vop_nop }, /* lease */ +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_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_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_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_readlink_desc, coda_readlink }, /* readlink */ + { &vop_abortop_desc, coda_abortop }, /* abortop */ + { &vop_inactive_desc, coda_inactive }, /* inactive */ + { &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_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_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_getpages_desc, cfs_fbsd_getpages }, /* pager intf.*/ - { &vop_putpages_desc, cfs_fbsd_putpages }, /* pager intf.*/ + { &vop_getpages_desc, coda_fbsd_getpages }, /* pager intf.*/ + { &vop_putpages_desc, coda_fbsd_putpages }, /* pager intf.*/ #if 0 @@ -337,28 +340,28 @@ struct vnodeopv_entry_desc cfs_vnodeop_entries[] = { { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } }; -static struct vnodeopv_desc cfs_vnodeop_opv_desc = - { &cfs_vnodeop_p, cfs_vnodeop_entries }; +static struct vnodeopv_desc coda_vnodeop_opv_desc = + { &coda_vnodeop_p, coda_vnodeop_entries }; -VNODEOP_SET(cfs_vnodeop_opv_desc); +VNODEOP_SET(coda_vnodeop_opv_desc); /* A generic panic: we were called with something we didn't define yet */ int -cfs_vop_error(void *anon) { +coda_vop_error(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; myprintf(("Vnode operation %s called, but not defined\n", (*desc)->vdesc_name)); - panic("cfs_vop_error"); + panic("coda_vop_error"); return 0; } /* A generic do-nothing. For lease_check, advlock */ int -cfs_vop_nop(void *anon) { +coda_vop_nop(void *anon) { struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; - if (cfsdebug) { + if (codadebug) { myprintf(("Vnode operation %s called, but unsupported\n", (*desc)->vdesc_name)); } @@ -366,27 +369,27 @@ cfs_vop_nop(void *anon) { } int -cfs_vnodeopstats_init(void) +coda_vnodeopstats_init(void) { register int i; - for(i=0;i pair for the cache file into an inode pointer. */ - error = cfs_grab_vnode(dev, inode, &vp); + error = coda_grab_vnode(dev, inode, &vp); if (error) return (error); @@ -445,7 +448,7 @@ cfs_open(v) cp->c_ovp = vp; } else { if (cp->c_ovp != vp) - panic("cfs_open: cp->c_ovp != ITOV(ip)"); + panic("coda_open: cp->c_ovp != ITOV(ip)"); } cp->c_ocount++; @@ -463,13 +466,13 @@ cfs_open(v) /* Open the cache file. */ error = VOP_OPEN(vp, flag, cred, p); if (error) { - printf("cfs_open: VOP_OPEN on container failed %d\n", error); + printf("coda_open: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_open: vfs_object_create() returns %d\n", error); + printf("coda_open: vfs_object_create() returns %d\n", error); vput(vp); } } @@ -480,7 +483,7 @@ cfs_open(v) * Close the cache file used for I/O and notify Venus. */ int -cfs_close(v) +coda_close(v) void *v; { /* true args */ @@ -493,21 +496,21 @@ cfs_close(v) /* locals */ int error; - MARK_ENTRY(CFS_CLOSE_STATS); + MARK_ENTRY(CODA_CLOSE_STATS); /* Check for close of control file. */ if (IS_CTL_VP(vp)) { - MARK_INT_SAT(CFS_CLOSE_STATS); + MARK_INT_SAT(CODA_CLOSE_STATS); return(0); } if (IS_UNMOUNTING(cp)) { if (cp->c_ovp) { - printf("cfs_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); vgone(cp->c_ovp); } else { - printf("cfs_close: NO container vp %p/cp %p\n", vp, cp); + printf("coda_close: NO container vp %p/cp %p\n", vp, cp); } return ENODEV; } else { @@ -524,34 +527,34 @@ cfs_close(v) error = venus_close(vtomi(vp), &cp->c_fid, flag, cred, p); vrele(CTOV(cp)); - CFSDEBUG(CFS_CLOSE, myprintf(("close: result %d\n",error)); ) + CODADEBUG(CODA_CLOSE, myprintf(("close: result %d\n",error)); ) return(error); } int -cfs_read(v) +coda_read(v) void *v; { struct vop_read_args *ap = v; ENTRY; - return(cfs_rdwr(ap->a_vp, ap->a_uio, UIO_READ, + return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_READ, ap->a_ioflag, ap->a_cred, ap->a_uio->uio_procp)); } int -cfs_write(v) +coda_write(v) void *v; { struct vop_write_args *ap = v; ENTRY; - return(cfs_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE, + return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE, ap->a_ioflag, ap->a_cred, ap->a_uio->uio_procp)); } int -cfs_rdwr(vp, uiop, rw, ioflag, cred, p) +coda_rdwr(vp, uiop, rw, ioflag, cred, p) struct vnode *vp; struct uio *uiop; enum uio_rw rw; @@ -568,15 +571,15 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) int opened_internally = 0; int error = 0; - MARK_ENTRY(CFS_RDWR_STATS); + MARK_ENTRY(CODA_RDWR_STATS); - CFSDEBUG(CFS_RDWR, myprintf(("cfs_rdwr(%d, %p, %d, %qd, %d)\n", rw, + CODADEBUG(CODA_RDWR, myprintf(("coda_rdwr(%d, %p, %d, %qd, %d)\n", rw, uiop->uio_iov->iov_base, uiop->uio_resid, uiop->uio_offset, uiop->uio_segflg)); ) /* Check for rdwr of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); return(EINVAL); } @@ -595,9 +598,9 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) */ if (cp->c_inode != 0 && !(p && (p->p_acflag & ACORE))) { igot_internally = 1; - error = cfs_grab_vnode(cp->c_device, cp->c_inode, &cfvp); + error = coda_grab_vnode(cp->c_device, cp->c_inode, &cfvp); if (error) { - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); return(error); } /* @@ -608,23 +611,23 @@ cfs_rdwr(vp, uiop, rw, ioflag, cred, p) } else { opened_internally = 1; - MARK_INT_GEN(CFS_OPEN_STATS); + MARK_INT_GEN(CODA_OPEN_STATS); error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p); -printf("cfs_rdwr: Internally Opening %p\n", vp); +printf("coda_rdwr: Internally Opening %p\n", vp); if (error) { - printf("cfs_rdwr: VOP_OPEN on container failed %d\n", error); + printf("coda_rdwr: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_rdwr: vfs_object_create() returns %d\n", error); + printf("coda_rdwr: vfs_object_create() returns %d\n", error); vput(vp); } } if (error) { - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); return(error); } cfvp = cp->c_ovp; @@ -632,7 +635,7 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); } /* Have UFS handle the call. */ - CFSDEBUG(CFS_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n", + CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, CTOV(cp)->v_usecount)); ) @@ -650,13 +653,13 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); } if (error) - MARK_INT_FAIL(CFS_RDWR_STATS); + MARK_INT_FAIL(CODA_RDWR_STATS); else - MARK_INT_SAT(CFS_RDWR_STATS); + MARK_INT_SAT(CODA_RDWR_STATS); /* Do an internal close if necessary. */ if (opened_internally) { - MARK_INT_GEN(CFS_CLOSE_STATS); + MARK_INT_GEN(CODA_CLOSE_STATS); (void)VOP_CLOSE(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p); } @@ -667,7 +670,7 @@ printf("cfs_rdwr: Internally Opening %p\n", vp); } int -cfs_ioctl(v) +coda_ioctl(v) void *v; { /* true args */ @@ -684,17 +687,17 @@ cfs_ioctl(v) struct nameidata ndp; struct PioctlData *iap = (struct PioctlData *)data; - MARK_ENTRY(CFS_IOCTL_STATS); + MARK_ENTRY(CODA_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, myprintf(("in cfs_ioctl on %s\n", iap->path));) + CODADEBUG(CODA_IOCTL, myprintf(("in coda_ioctl on %s\n", iap->path));) /* Don't check for operation on a dying object, for ctlvp it shouldn't matter */ /* Must be control object to succeed. */ if (!IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, myprintf(("cfs_ioctl error: vp != ctlvp"));) + MARK_INT_FAIL(CODA_IOCTL_STATS); + CODADEBUG(CODA_IOCTL, myprintf(("coda_ioctl error: vp != ctlvp"));) return (EOPNOTSUPP); } /* Look up the pathname. */ @@ -707,8 +710,8 @@ cfs_ioctl(v) tvp = ndp.ni_vp; if (error) { - MARK_INT_FAIL(CFS_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, myprintf(("cfs_ioctl error: lookup returns %d\n", + MARK_INT_FAIL(CODA_IOCTL_STATS); + CODADEBUG(CODA_IOCTL, myprintf(("coda_ioctl error: lookup returns %d\n", error));) return(error); } @@ -718,11 +721,11 @@ cfs_ioctl(v) * different vfsp */ /* XXX: this totally violates the comment about vtagtype in vnode.h */ - if (tvp->v_tag != VT_CFS) { + if (tvp->v_tag != VT_CODA) { vrele(tvp); - MARK_INT_FAIL(CFS_IOCTL_STATS); - CFSDEBUG(CFS_IOCTL, - myprintf(("cfs_ioctl error: %s not a coda object\n", + MARK_INT_FAIL(CODA_IOCTL_STATS); + CODADEBUG(CODA_IOCTL, + myprintf(("coda_ioctl error: %s not a coda object\n", iap->path));) return(EINVAL); } @@ -734,9 +737,9 @@ cfs_ioctl(v) error = venus_ioctl(vtomi(tvp), &((VTOC(tvp))->c_fid), com, flag, data, cred, p); if (error) - MARK_INT_FAIL(CFS_IOCTL_STATS); + MARK_INT_FAIL(CODA_IOCTL_STATS); else - CFSDEBUG(CFS_IOCTL, myprintf(("Ioctl returns %d \n", error)); ) + CODADEBUG(CODA_IOCTL, myprintf(("Ioctl returns %d \n", error)); ) vrele(tvp); return(error); @@ -752,7 +755,7 @@ cfs_ioctl(v) * opened the file, and therefore should already have access. */ int -cfs_getattr(v) +coda_getattr(v) void *v; { /* true args */ @@ -765,41 +768,41 @@ cfs_getattr(v) /* locals */ int error; - MARK_ENTRY(CFS_GETATTR_STATS); + MARK_ENTRY(CODA_GETATTR_STATS); if (IS_UNMOUNTING(cp)) return ENODEV; /* Check for getattr of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_GETATTR_STATS); + MARK_INT_FAIL(CODA_GETATTR_STATS); return(ENOENT); } /* Check to see if the attributes have already been cached */ if (VALID_VATTR(cp)) { - CFSDEBUG(CFS_GETATTR, { myprintf(("attr cache hit: (%lx.%lx.%lx)\n", + CODADEBUG(CODA_GETATTR, { myprintf(("attr cache hit: (%lx.%lx.%lx)\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));}); - CFSDEBUG(CFS_GETATTR, if (!(cfsdebug & ~CFS_GETATTR)) + CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR)) print_vattr(&cp->c_vattr); ); *vap = cp->c_vattr; - MARK_INT_SAT(CFS_GETATTR_STATS); + MARK_INT_SAT(CODA_GETATTR_STATS); return(0); } error = venus_getattr(vtomi(vp), &cp->c_fid, cred, p, vap); if (!error) { - CFSDEBUG(CFS_GETATTR, myprintf(("getattr miss (%lx.%lx.%lx): result %d\n", + CODADEBUG(CODA_GETATTR, myprintf(("getattr miss (%lx.%lx.%lx): result %d\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, error)); ) - CFSDEBUG(CFS_GETATTR, if (!(cfsdebug & ~CFS_GETATTR)) + CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR)) print_vattr(vap); ); { int size = vap->va_size; @@ -809,7 +812,7 @@ cfs_getattr(v) } } /* If not open for write, store attributes in cnode */ - if ((cp->c_owrite == 0) && (cfs_attr_cache)) { + if ((cp->c_owrite == 0) && (coda_attr_cache)) { cp->c_vattr = *vap; cp->c_flags |= C_VATTR; } @@ -819,7 +822,7 @@ cfs_getattr(v) } int -cfs_setattr(v) +coda_setattr(v) void *v; { /* true args */ @@ -832,15 +835,15 @@ cfs_setattr(v) /* locals */ int error; - MARK_ENTRY(CFS_SETATTR_STATS); + MARK_ENTRY(CODA_SETATTR_STATS); /* Check for setattr of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_SETATTR_STATS); + MARK_INT_FAIL(CODA_SETATTR_STATS); return(ENOENT); } - if (cfsdebug & CFSDBGMSK(CFS_SETATTR)) { + if (codadebug & CODADBGMSK(CODA_SETATTR)) { print_vattr(vap); } error = venus_setattr(vtomi(vp), &cp->c_fid, vap, cred, p); @@ -854,12 +857,12 @@ cfs_setattr(v) vnode_pager_setsize(convp, size); } } - CFSDEBUG(CFS_SETATTR, myprintf(("setattr %d\n", error)); ) + CODADEBUG(CODA_SETATTR, myprintf(("setattr %d\n", error)); ) return(error); } int -cfs_access(v) +coda_access(v) void *v; { /* true args */ @@ -872,13 +875,13 @@ cfs_access(v) /* locals */ int error; - MARK_ENTRY(CFS_ACCESS_STATS); + MARK_ENTRY(CODA_ACCESS_STATS); /* Check for access of control object. Only read access is allowed on it. */ if (IS_CTL_VP(vp)) { /* bogus hack - all will be marked as successes */ - MARK_INT_SAT(CFS_ACCESS_STATS); + MARK_INT_SAT(CODA_ACCESS_STATS); return(((mode & VREAD) && !(mode & (VWRITE | VEXEC))) ? 0 : EACCES); } @@ -888,10 +891,10 @@ cfs_access(v) * access, and the file is in the namecache, then the user must have * lookup access to it. */ - if (cfs_access_cache) { + if (coda_access_cache) { if ((vp->v_type == VDIR) && (mode & VEXEC)) { - if (cfsnc_lookup(cp, ".", 1, cred)) { - MARK_INT_SAT(CFS_ACCESS_STATS); + if (coda_nc_lookup(cp, ".", 1, cred)) { + MARK_INT_SAT(CODA_ACCESS_STATS); return(0); /* it was in the cache */ } } @@ -903,13 +906,13 @@ cfs_access(v) } /* - * CFS abort op, called after namei() when a CREATE/DELETE isn't actually - * done. If a buffer has been saved in anticipation of a cfs_create or - * a cfs_remove, delete it. + * CODA abort op, called after namei() when a CREATE/DELETE isn't actually + * done. If a buffer has been saved in anticipation of a coda_create or + * a coda_remove, delete it. */ /* ARGSUSED */ int -cfs_abortop(v) +coda_abortop(v) void *v; { /* true args */ @@ -926,7 +929,7 @@ cfs_abortop(v) } int -cfs_readlink(v) +coda_readlink(v) void *v; { /* true args */ @@ -941,21 +944,21 @@ cfs_readlink(v) char *str; int len; - MARK_ENTRY(CFS_READLINK_STATS); + MARK_ENTRY(CODA_READLINK_STATS); /* Check for readlink of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_READLINK_STATS); + MARK_INT_FAIL(CODA_READLINK_STATS); return(ENOENT); } - if ((cfs_symlink_cache) && (VALID_SYMLINK(cp))) { /* symlink was cached */ + if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) { /* symlink was cached */ uiop->uio_rw = UIO_READ; error = uiomove(cp->c_symlink, (int)cp->c_symlen, uiop); if (error) - MARK_INT_FAIL(CFS_READLINK_STATS); + MARK_INT_FAIL(CODA_READLINK_STATS); else - MARK_INT_SAT(CFS_READLINK_STATS); + MARK_INT_SAT(CODA_READLINK_STATS); return(error); } @@ -965,20 +968,20 @@ cfs_readlink(v) uiop->uio_rw = UIO_READ; error = uiomove(str, len, uiop); - if (cfs_symlink_cache) { + if (coda_symlink_cache) { cp->c_symlink = str; cp->c_symlen = len; cp->c_flags |= C_SYMLINK; } else - CFS_FREE(str, len); + CODA_FREE(str, len); } - CFSDEBUG(CFS_READLINK, myprintf(("in readlink result %d\n",error));) + CODADEBUG(CODA_READLINK, myprintf(("in readlink result %d\n",error));) return(error); } int -cfs_fsync(v) +coda_fsync(v) void *v; { /* true args */ @@ -991,7 +994,7 @@ cfs_fsync(v) struct vnode *convp = cp->c_ovp; int error; - MARK_ENTRY(CFS_FSYNC_STATS); + MARK_ENTRY(CODA_FSYNC_STATS); /* Check for fsync on an unmounting object */ /* The NetBSD kernel, in it's infinite wisdom, can try to fsync @@ -1004,7 +1007,7 @@ cfs_fsync(v) /* Check for fsync of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_SAT(CFS_FSYNC_STATS); + MARK_INT_SAT(CODA_FSYNC_STATS); return(0); } @@ -1017,7 +1020,7 @@ cfs_fsync(v) */ /* if (!vp->v_usecount) { - printf("cfs_fsync on vnode %p with %d usecount. c_flags = %x (%x)\n", + printf("coda_fsync on vnode %p with %d usecount. c_flags = %x (%x)\n", vp, vp->v_usecount, cp->c_flags, cp->c_flags&C_PURGING); } */ @@ -1037,12 +1040,12 @@ cfs_fsync(v) return 0; error = venus_fsync(vtomi(vp), &cp->c_fid, cred, p); - CFSDEBUG(CFS_FSYNC, myprintf(("in fsync result %d\n",error)); ); + CODADEBUG(CODA_FSYNC, myprintf(("in fsync result %d\n",error)); ); return(error); } int -cfs_inactive(v) +coda_inactive(v) void *v; { /* XXX - at the moment, inactive doesn't look at cred, and doesn't @@ -1057,56 +1060,56 @@ cfs_inactive(v) /* locals */ /* We don't need to send inactive to venus - DCS */ - MARK_ENTRY(CFS_INACTIVE_STATS); + MARK_ENTRY(CODA_INACTIVE_STATS); if (IS_CTL_VP(vp)) { - MARK_INT_SAT(CFS_INACTIVE_STATS); + MARK_INT_SAT(CODA_INACTIVE_STATS); return 0; } - CFSDEBUG(CFS_INACTIVE, myprintf(("in inactive, %lx.%lx.%lx. vfsp %p\n", + CODADEBUG(CODA_INACTIVE, myprintf(("in inactive, %lx.%lx.%lx. vfsp %p\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_mount));) /* If an array has been allocated to hold the symlink, deallocate it */ - if ((cfs_symlink_cache) && (VALID_SYMLINK(cp))) { + if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) { if (cp->c_symlink == NULL) - panic("cfs_inactive: null symlink pointer in cnode"); + panic("coda_inactive: null symlink pointer in cnode"); - CFS_FREE(cp->c_symlink, cp->c_symlen); + CODA_FREE(cp->c_symlink, cp->c_symlen); cp->c_flags &= ~C_SYMLINK; cp->c_symlen = 0; } /* Remove it from the table so it can't be found. */ - cfs_unsave(cp); - if ((struct cfs_mntinfo *)(vp->v_mount->mnt_data) == NULL) { + coda_unsave(cp); + if ((struct coda_mntinfo *)(vp->v_mount->mnt_data) == NULL) { myprintf(("Help! vfsp->vfs_data was NULL, but vnode %p wasn't dying\n", vp)); - panic("badness in cfs_inactive\n"); + panic("badness in coda_inactive\n"); } if (IS_UNMOUNTING(cp)) { #ifdef DEBUG - printf("cfs_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); + printf("coda_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); if (cp->c_ovp != NULL) - printf("cfs_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", + printf("coda_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); #endif lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); } else { #ifdef DIAGNOSTIC if (CTOV(cp)->v_usecount) { - panic("cfs_inactive: nonzero reference count"); + panic("coda_inactive: nonzero reference count"); } if (cp->c_ovp != NULL) { - panic("cfs_inactive: cp->ovp != NULL"); + panic("coda_inactive: cp->ovp != NULL"); } #endif VOP_UNLOCK(vp, 0, p); vgone(vp); } - MARK_INT_SAT(CFS_INACTIVE_STATS); + MARK_INT_SAT(CODA_INACTIVE_STATS); return(0); } @@ -1118,7 +1121,7 @@ cfs_inactive(v) * It appears that in NetBSD, lookup is supposed to return the vnode locked */ int -cfs_lookup(v) +coda_lookup(v) void *v; { /* true args */ @@ -1143,23 +1146,23 @@ cfs_lookup(v) int vtype; int error = 0; - MARK_ENTRY(CFS_LOOKUP_STATS); + MARK_ENTRY(CODA_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, myprintf(("lookup: %s in %lx.%lx.%lx\n", + CODADEBUG(CODA_LOOKUP, myprintf(("lookup: %s in %lx.%lx.%lx\n", nm, dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique));); /* Check for lookup of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { - *vpp = cfs_ctlvp; + *vpp = coda_ctlvp; vref(*vpp); - MARK_INT_SAT(CFS_LOOKUP_STATS); + MARK_INT_SAT(CODA_LOOKUP_STATS); goto exit; } - if (len+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, myprintf(("name too long: lookup, %lx.%lx.%lx(%s)\n", + if (len+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_LOOKUP_STATS); + CODADEBUG(CODA_LOOKUP, myprintf(("name too long: lookup, %lx.%lx.%lx(%s)\n", dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique, nm));); *vpp = (struct vnode *)0; @@ -1168,11 +1171,11 @@ cfs_lookup(v) } /* First try to look the file up in the cfs name cache */ /* lock the parent vnode? */ - cp = cfsnc_lookup(dcp, nm, len, cred); + cp = coda_nc_lookup(dcp, nm, len, cred); if (cp) { *vpp = CTOV(cp); vref(*vpp); - CFSDEBUG(CFS_LOOKUP, + CODADEBUG(CODA_LOOKUP, myprintf(("lookup result %d vpp %p\n",error,*vpp));) } else { @@ -1180,24 +1183,24 @@ cfs_lookup(v) error = venus_lookup(vtomi(dvp), &dcp->c_fid, nm, len, cred, p, &VFid, &vtype); if (error) { - MARK_INT_FAIL(CFS_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, myprintf(("lookup error on %lx.%lx.%lx(%s)%d\n", + MARK_INT_FAIL(CODA_LOOKUP_STATS); + CODADEBUG(CODA_LOOKUP, myprintf(("lookup error on %lx.%lx.%lx(%s)%d\n", dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique, nm, error));) *vpp = (struct vnode *)0; } else { - MARK_INT_SAT(CFS_LOOKUP_STATS); - CFSDEBUG(CFS_LOOKUP, + MARK_INT_SAT(CODA_LOOKUP_STATS); + CODADEBUG(CODA_LOOKUP, myprintf(("lookup: vol %lx vno %lx uni %lx type %o result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, vtype, error)); ) - cp = makecfsnode(&VFid, dvp->v_mount, vtype); + cp = make_coda_node(&VFid, dvp->v_mount, vtype); *vpp = CTOV(cp); /* enter the new vnode in the Name Cache only if the top bit isn't set */ /* And don't enter a new vnode for an invalid one! */ - if (!(vtype & CFS_NOCACHE)) - cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); + if (!(vtype & CODA_NOCACHE)) + coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); } } @@ -1226,8 +1229,8 @@ cfs_lookup(v) * removal will go ahead as planned. Unfortunately, this will * probably also lock the to-be-removed vnode, which may or may * not be a good idea. I'll have to look at the bits of - * cfs_remove to make sure. We'll only save the name if we did in - * fact find the name, otherwise cfs_remove won't have a chance + * coda_remove to make sure. We'll only save the name if we did in + * fact find the name, otherwise coda_remove won't have a chance * to free the pathname. */ if ((cnp->cn_nameiop == DELETE) @@ -1257,7 +1260,7 @@ cfs_lookup(v) */ if (*ap->a_vpp) { if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { - printf("cfs_lookup: "); + printf("coda_lookup: "); panic("unlocked parent but couldn't lock child"); } } @@ -1266,7 +1269,7 @@ cfs_lookup(v) if (*ap->a_vpp && (*ap->a_vpp != dvp)) { /* Different, go ahead and lock it. */ if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { - printf("cfs_lookup: "); + printf("coda_lookup: "); panic("unlocked parent but couldn't lock child"); } } @@ -1281,7 +1284,7 @@ cfs_lookup(v) /*ARGSUSED*/ int -cfs_create(v) +coda_create(v) void *v; { /* true args */ @@ -1303,7 +1306,7 @@ cfs_create(v) ViceFid VFid; struct vattr attr; - MARK_ENTRY(CFS_CREATE_STATS); + MARK_ENTRY(CODA_CREATE_STATS); /* All creates are exclusive XXX */ /* I'm assuming the 'mode' argument is the file mode bits XXX */ @@ -1311,7 +1314,7 @@ cfs_create(v) /* Check for create of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { *vpp = (struct vnode *)0; - MARK_INT_FAIL(CFS_CREATE_STATS); + MARK_INT_FAIL(CODA_CREATE_STATS); return(EACCES); } @@ -1323,17 +1326,17 @@ cfs_create(v) /* Venus should have detected the file and reported EEXIST. */ if ((exclusive == 1) && - (cfs_find(&VFid) != NULL)) + (coda_find(&VFid) != NULL)) panic("cnode existed for newly created file!"); - cp = makecfsnode(&VFid, dvp->v_mount, attr.va_type); + cp = make_coda_node(&VFid, dvp->v_mount, attr.va_type); *vpp = CTOV(cp); /* Update va to reflect the new attributes. */ (*va) = attr; /* Update the attribute cache and mark it as valid */ - if (cfs_attr_cache) { + if (coda_attr_cache) { VTOC(*vpp)->c_vattr = attr; VTOC(*vpp)->c_flags |= C_VATTR; } @@ -1342,26 +1345,26 @@ cfs_create(v) VTOC(dvp)->c_flags &= ~C_VATTR; /* enter the new vnode in the Name Cache */ - cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); + coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); - CFSDEBUG(CFS_CREATE, + CODADEBUG(CODA_CREATE, myprintf(("create: (%lx.%lx.%lx), result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, error)); ) } else { *vpp = (struct vnode *)0; - CFSDEBUG(CFS_CREATE, myprintf(("create error %d\n", error));) + CODADEBUG(CODA_CREATE, myprintf(("create error %d\n", error));) } if (!error) { if (cnp->cn_flags & LOCKLEAF) { if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { - printf("cfs_create: "); + printf("coda_create: "); panic("unlocked parent but couldn't lock child"); } } #ifdef DIAGNOSTIC else { - printf("cfs_create: LOCKLEAF not set!\n"); + printf("coda_create: LOCKLEAF not set!\n"); } #endif /* DIAGNOSTIC */ } @@ -1377,7 +1380,7 @@ cfs_create(v) } int -cfs_remove(v) +coda_remove(v) void *v; { /* true args */ @@ -1393,13 +1396,13 @@ cfs_remove(v) int len = cnp->cn_namelen; struct cnode *tp; - MARK_ENTRY(CFS_REMOVE_STATS); + MARK_ENTRY(CODA_REMOVE_STATS); - CFSDEBUG(CFS_REMOVE, myprintf(("remove: %s in %lx.%lx.%lx\n", + CODADEBUG(CODA_REMOVE, myprintf(("remove: %s in %lx.%lx.%lx\n", nm, cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));); - /* Remove the file's entry from the CFS Name Cache */ + /* Remove the file's entry from the CODA Name Cache */ /* We're being conservative here, it might be that this person * doesn't really have sufficient access to delete the file * but we feel zapping the entry won't really hurt anyone -- dcs @@ -1409,7 +1412,7 @@ cfs_remove(v) * off by 1. We could either invalidate the attrs if cached, or * fix them. I'll try to fix them. DCS 11/8/94 */ - tp = cfsnc_lookup(VTOC(dvp), nm, len, cred); + tp = coda_nc_lookup(VTOC(dvp), nm, len, cred); if (tp) { if (VALID_VATTR(tp)) { /* If attrs are cached */ if (tp->c_vattr.va_nlink > 1) { /* If it's a hard link */ @@ -1417,7 +1420,7 @@ cfs_remove(v) } } - cfsnc_zapfile(VTOC(dvp), nm, len); + coda_nc_zapfile(VTOC(dvp), nm, len); /* No need to flush it if it doesn't exist! */ } /* Invalidate the parent's attr cache, the modification time has changed */ @@ -1425,13 +1428,13 @@ cfs_remove(v) /* Check for remove of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { - MARK_INT_FAIL(CFS_REMOVE_STATS); + MARK_INT_FAIL(CODA_REMOVE_STATS); return(ENOENT); } error = venus_remove(vtomi(dvp), &cp->c_fid, nm, len, cred, p); - CFSDEBUG(CFS_REMOVE, myprintf(("in remove result %d\n",error)); ) + CODADEBUG(CODA_REMOVE, myprintf(("in remove result %d\n",error)); ) if ((cnp->cn_flags & SAVESTART) == 0) { zfree(namei_zone, cnp->cn_pnbuf); @@ -1440,7 +1443,7 @@ cfs_remove(v) } int -cfs_link(v) +coda_link(v) void *v; { /* true args */ @@ -1457,9 +1460,9 @@ cfs_link(v) const char *nm = cnp->cn_nameptr; int len = cnp->cn_namelen; - MARK_ENTRY(CFS_LINK_STATS); + MARK_ENTRY(CODA_LINK_STATS); - if (cfsdebug & CFSDBGMSK(CFS_LINK)) { + if (codadebug & CODADBGMSK(CODA_LINK)) { myprintf(("nb_link: vp fid: (%lx.%lx.%lx)\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); @@ -1467,7 +1470,7 @@ cfs_link(v) tdcp->c_fid.Volume, tdcp->c_fid.Vnode, tdcp->c_fid.Unique)); } - if (cfsdebug & CFSDBGMSK(CFS_LINK)) { + if (codadebug & CODADBGMSK(CODA_LINK)) { myprintf(("link: vp fid: (%lx.%lx.%lx)\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); myprintf(("link: tdvp fid: (%lx.%lx.%lx)\n", @@ -1477,7 +1480,7 @@ cfs_link(v) /* Check for link to/from control object. */ if (IS_CTL_NAME(tdvp, nm, len) || IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_LINK_STATS); + MARK_INT_FAIL(CODA_LINK_STATS); return(EACCES); } @@ -1487,7 +1490,7 @@ cfs_link(v) VTOC(tdvp)->c_flags &= ~C_VATTR; VTOC(vp)->c_flags &= ~C_VATTR; - CFSDEBUG(CFS_LINK, myprintf(("in link result %d\n",error)); ) + CODADEBUG(CODA_LINK, myprintf(("in link result %d\n",error)); ) exit: @@ -1499,7 +1502,7 @@ exit: } int -cfs_rename(v) +coda_rename(v) void *v; { /* true args */ @@ -1519,7 +1522,7 @@ cfs_rename(v) const char *tnm = tcnp->cn_nameptr; int tlen = tcnp->cn_namelen; - MARK_ENTRY(CFS_RENAME_STATS); + MARK_ENTRY(CODA_RENAME_STATS); /* Hmmm. The vnodes are already looked up. Perhaps they are locked? This could be Bad. XXX */ @@ -1527,43 +1530,43 @@ cfs_rename(v) if ((fcnp->cn_cred != tcnp->cn_cred) || (fcnp->cn_proc != tcnp->cn_proc)) { - panic("cfs_rename: component names don't agree"); + panic("coda_rename: component names don't agree"); } #endif DIAGNOSTIC /* Check for rename involving control object. */ if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) { - MARK_INT_FAIL(CFS_RENAME_STATS); + MARK_INT_FAIL(CODA_RENAME_STATS); return(EACCES); } /* Problem with moving directories -- need to flush entry for .. */ if (odvp != ndvp) { - struct cnode *ovcp = cfsnc_lookup(VTOC(odvp), fnm, flen, cred); + struct cnode *ovcp = coda_nc_lookup(VTOC(odvp), fnm, flen, cred); if (ovcp) { struct vnode *ovp = CTOV(ovcp); if ((ovp) && (ovp->v_type == VDIR)) /* If it's a directory */ - cfsnc_zapfile(VTOC(ovp),"..", 2); + coda_nc_zapfile(VTOC(ovp),"..", 2); } } /* Remove the entries for both source and target files */ - cfsnc_zapfile(VTOC(odvp), fnm, flen); - cfsnc_zapfile(VTOC(ndvp), tnm, tlen); + coda_nc_zapfile(VTOC(odvp), fnm, flen); + coda_nc_zapfile(VTOC(ndvp), tnm, tlen); /* Invalidate the parent's attr cache, the modification time has changed */ VTOC(odvp)->c_flags &= ~C_VATTR; VTOC(ndvp)->c_flags &= ~C_VATTR; - if (flen+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_RENAME_STATS); + if (flen+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_RENAME_STATS); error = EINVAL; goto exit; } - if (tlen+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_RENAME_STATS); + if (tlen+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_RENAME_STATS); error = EINVAL; goto exit; } @@ -1571,7 +1574,7 @@ cfs_rename(v) error = venus_rename(vtomi(odvp), &odcp->c_fid, &ndcp->c_fid, fnm, flen, tnm, tlen, cred, p); exit: - CFSDEBUG(CFS_RENAME, myprintf(("in rename result %d\n",error));) + CODADEBUG(CODA_RENAME, myprintf(("in rename result %d\n",error));) /* XXX - do we need to call cache pureg on the moved vnode? */ cache_purge(ap->a_fvp); @@ -1594,7 +1597,7 @@ cfs_rename(v) } int -cfs_mkdir(v) +coda_mkdir(v) void *v; { /* true args */ @@ -1614,39 +1617,39 @@ cfs_mkdir(v) ViceFid VFid; struct vattr ova; - MARK_ENTRY(CFS_MKDIR_STATS); + MARK_ENTRY(CODA_MKDIR_STATS); /* Check for mkdir of target object. */ if (IS_CTL_NAME(dvp, nm, len)) { *vpp = (struct vnode *)0; - MARK_INT_FAIL(CFS_MKDIR_STATS); + MARK_INT_FAIL(CODA_MKDIR_STATS); return(EACCES); } - if (len+1 > CFS_MAXNAMLEN) { + if (len+1 > CODA_MAXNAMLEN) { *vpp = (struct vnode *)0; - MARK_INT_FAIL(CFS_MKDIR_STATS); + MARK_INT_FAIL(CODA_MKDIR_STATS); return(EACCES); } error = venus_mkdir(vtomi(dvp), &dcp->c_fid, nm, len, va, cred, p, &VFid, &ova); if (!error) { - if (cfs_find(&VFid) != NULL) + if (coda_find(&VFid) != NULL) panic("cnode existed for newly created directory!"); - cp = makecfsnode(&VFid, dvp->v_mount, va->va_type); + cp = make_coda_node(&VFid, dvp->v_mount, va->va_type); *vpp = CTOV(cp); /* enter the new vnode in the Name Cache */ - cfsnc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); + coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp)); /* as a side effect, enter "." and ".." for the directory */ - cfsnc_enter(VTOC(*vpp), ".", 1, cred, VTOC(*vpp)); - cfsnc_enter(VTOC(*vpp), "..", 2, cred, VTOC(dvp)); + coda_nc_enter(VTOC(*vpp), ".", 1, cred, VTOC(*vpp)); + coda_nc_enter(VTOC(*vpp), "..", 2, cred, VTOC(dvp)); - if (cfs_attr_cache) { + if (coda_attr_cache) { VTOC(*vpp)->c_vattr = ova; /* update the attr cache */ VTOC(*vpp)->c_flags |= C_VATTR; /* Valid attributes in cnode */ } @@ -1654,11 +1657,11 @@ cfs_mkdir(v) /* Invalidate the parent's attr cache, the modification time has changed */ VTOC(dvp)->c_flags &= ~C_VATTR; - CFSDEBUG( CFS_MKDIR, myprintf(("mkdir: (%lx.%lx.%lx) result %d\n", + CODADEBUG( CODA_MKDIR, myprintf(("mkdir: (%lx.%lx.%lx) result %d\n", VFid.Volume, VFid.Vnode, VFid.Unique, error)); ) } else { *vpp = (struct vnode *)0; - CFSDEBUG(CFS_MKDIR, myprintf(("mkdir error %d\n",error));) + CODADEBUG(CODA_MKDIR, myprintf(("mkdir error %d\n",error));) } /* Have to free the previously saved name */ @@ -1673,7 +1676,7 @@ cfs_mkdir(v) } int -cfs_rmdir(v) +coda_rmdir(v) void *v; { /* true args */ @@ -1689,11 +1692,11 @@ cfs_rmdir(v) int len = cnp->cn_namelen; struct cnode *cp; - MARK_ENTRY(CFS_RMDIR_STATS); + MARK_ENTRY(CODA_RMDIR_STATS); /* Check for rmdir of control object. */ if (IS_CTL_NAME(dvp, nm, len)) { - MARK_INT_FAIL(CFS_RMDIR_STATS); + MARK_INT_FAIL(CODA_RMDIR_STATS); return(ENOENT); } @@ -1705,18 +1708,18 @@ cfs_rmdir(v) * As a side effect of the rmdir, remove any entries for children of * the directory, especially "." and "..". */ - cp = cfsnc_lookup(dcp, nm, len, cred); - if (cp) cfsnc_zapParentfid(&(cp->c_fid), NOT_DOWNCALL); + cp = coda_nc_lookup(dcp, nm, len, cred); + if (cp) coda_nc_zapParentfid(&(cp->c_fid), NOT_DOWNCALL); - /* Remove the file's entry from the CFS Name Cache */ - cfsnc_zapfile(dcp, nm, len); + /* Remove the file's entry from the CODA Name Cache */ + coda_nc_zapfile(dcp, nm, len); /* Invalidate the parent's attr cache, the modification time has changed */ dcp->c_flags &= ~C_VATTR; error = venus_rmdir(vtomi(dvp), &dcp->c_fid, nm, len, cred, p); - CFSDEBUG(CFS_RMDIR, myprintf(("in rmdir result %d\n", error)); ) + CODADEBUG(CODA_RMDIR, myprintf(("in rmdir result %d\n", error)); ) if ((cnp->cn_flags & SAVESTART) == 0) { zfree(namei_zone, cnp->cn_pnbuf); @@ -1725,7 +1728,7 @@ cfs_rmdir(v) } int -cfs_symlink(v) +coda_symlink(v) void *v; { /* true args */ @@ -1740,7 +1743,7 @@ cfs_symlink(v) /* locals */ int error; /* - * XXX I'm assuming the following things about cfs_symlink's + * XXX I'm assuming the following things about coda_symlink's * arguments: * t(foo) is the new name/parent/etc being created. * lname is the contents of the new symlink. @@ -1760,21 +1763,21 @@ cfs_symlink(v) * returns the resultant vnode in a vpp argument. */ - MARK_ENTRY(CFS_SYMLINK_STATS); + MARK_ENTRY(CODA_SYMLINK_STATS); /* Check for symlink of control object. */ if (IS_CTL_NAME(tdvp, nm, len)) { - MARK_INT_FAIL(CFS_SYMLINK_STATS); + MARK_INT_FAIL(CODA_SYMLINK_STATS); return(EACCES); } - if (plen+1 > CFS_MAXPATHLEN) { - MARK_INT_FAIL(CFS_SYMLINK_STATS); + if (plen+1 > CODA_MAXPATHLEN) { + MARK_INT_FAIL(CODA_SYMLINK_STATS); return(EINVAL); } - if (len+1 > CFS_MAXNAMLEN) { - MARK_INT_FAIL(CFS_SYMLINK_STATS); + if (len+1 > CODA_MAXNAMLEN) { + MARK_INT_FAIL(CODA_SYMLINK_STATS); error = EINVAL; goto exit; } @@ -1792,7 +1795,7 @@ cfs_symlink(v) } exit: - CFSDEBUG(CFS_SYMLINK, myprintf(("in symlink result %d\n",error)); ) + CODADEBUG(CODA_SYMLINK, myprintf(("in symlink result %d\n",error)); ) return(error); } @@ -1800,7 +1803,7 @@ cfs_symlink(v) * Read directory entries. */ int -cfs_readdir(v) +coda_readdir(v) void *v; { /* true args */ @@ -1817,13 +1820,13 @@ cfs_readdir(v) /* locals */ int error = 0; - MARK_ENTRY(CFS_READDIR_STATS); + MARK_ENTRY(CODA_READDIR_STATS); - CFSDEBUG(CFS_READDIR, myprintf(("cfs_readdir(%p, %d, %qd, %d)\n", uiop->uio_iov->iov_base, uiop->uio_resid, uiop->uio_offset, uiop->uio_segflg)); ) + CODADEBUG(CODA_READDIR, myprintf(("coda_readdir(%p, %d, %qd, %d)\n", uiop->uio_iov->iov_base, uiop->uio_resid, uiop->uio_offset, uiop->uio_segflg)); ) /* Check for readdir of control object. */ if (IS_CTL_VP(vp)) { - MARK_INT_FAIL(CFS_READDIR_STATS); + MARK_INT_FAIL(CODA_READDIR_STATS); return(ENOENT); } @@ -1832,17 +1835,17 @@ cfs_readdir(v) int opened_internally = 0; if (cp->c_ovp == NULL) { opened_internally = 1; - MARK_INT_GEN(CFS_OPEN_STATS); + MARK_INT_GEN(CODA_OPEN_STATS); error = VOP_OPEN(vp, FREAD, cred, p); -printf("cfs_readdir: Internally Opening %p\n", vp); +printf("coda_readdir: Internally Opening %p\n", vp); if (error) { - printf("cfs_readdir: VOP_OPEN on container failed %d\n", error); + printf("coda_readdir: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { error = vfs_object_create(vp, p, cred, 1); if (error != 0) { - printf("cfs_readdir: vfs_object_create() returns %d\n", error); + printf("coda_readdir: vfs_object_create() returns %d\n", error); vput(vp); } } @@ -1850,18 +1853,18 @@ printf("cfs_readdir: Internally Opening %p\n", vp); } /* Have UFS handle the call. */ - CFSDEBUG(CFS_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) + CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); ) error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies, cookies); if (error) - MARK_INT_FAIL(CFS_READDIR_STATS); + MARK_INT_FAIL(CODA_READDIR_STATS); else - MARK_INT_SAT(CFS_READDIR_STATS); + MARK_INT_SAT(CODA_READDIR_STATS); /* Do an "internal close" if necessary. */ if (opened_internally) { - MARK_INT_GEN(CFS_CLOSE_STATS); + MARK_INT_GEN(CODA_CLOSE_STATS); (void)VOP_CLOSE(vp, FREAD, cred, p); } } @@ -1873,7 +1876,7 @@ printf("cfs_readdir: Internally Opening %p\n", vp); * Convert from file system blocks to device blocks */ int -cfs_bmap(v) +coda_bmap(v) void *v; { /* XXX on the global proc */ @@ -1892,13 +1895,13 @@ cfs_bmap(v) cp = VTOC(vp); if (cp->c_ovp) { - printf("cfs_bmap: container .. "); + printf("coda_bmap: container .. "); ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb); 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); return ret; } else { - printf("cfs_bmap: no container\n"); + printf("coda_bmap: no container\n"); return(EOPNOTSUPP); } } @@ -1911,7 +1914,7 @@ cfs_bmap(v) * int async_daemon_count; */ int -cfs_strategy(v) +coda_strategy(v) void *v; { /* true args */ @@ -1921,12 +1924,12 @@ cfs_strategy(v) /* upcall decl */ /* locals */ - printf("cfs_strategy: called ???\n"); + printf("coda_strategy: called ???\n"); return(EOPNOTSUPP); } int -cfs_reclaim(v) +coda_reclaim(v) void *v; { /* true args */ @@ -1945,26 +1948,26 @@ cfs_reclaim(v) #ifdef DEBUG if (VTOC(vp)->c_ovp) { if (IS_UNMOUNTING(cp)) - printf("cfs_reclaim: c_ovp not void: vp %p, cp %p\n", vp, cp); + printf("coda_reclaim: c_ovp not void: vp %p, cp %p\n", vp, cp); } #endif } else { #ifdef DIAGNOSTIC if (vp->v_usecount != 0) - vprint("cfs_reclaim: pushing active", vp); + vprint("coda_reclaim: pushing active", vp); if (VTOC(vp)->c_ovp) { - panic("cfs_reclaim: c_ovp not void"); + panic("coda_reclaim: c_ovp not void"); } #endif DIAGNOSTIC } cache_purge(vp); - cfs_free(VTOC(vp)); + coda_free(VTOC(vp)); VTOC(vp) = NULL; return (0); } int -cfs_lock(v) +coda_lock(v) void *v; { /* true args */ @@ -1977,7 +1980,7 @@ cfs_lock(v) ENTRY; - if (cfs_lockdebug) { + if (coda_lockdebug) { myprintf(("Attempting lock on %lx.%lx.%lx\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } @@ -1986,7 +1989,7 @@ cfs_lock(v) } int -cfs_unlock(v) +coda_unlock(v) void *v; { /* true args */ @@ -1998,7 +2001,7 @@ cfs_unlock(v) /* locals */ ENTRY; - if (cfs_lockdebug) { + if (coda_lockdebug) { myprintf(("Attempting unlock on %lx.%lx.%lx\n", cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } @@ -2007,7 +2010,7 @@ cfs_unlock(v) } int -cfs_islocked(v) +coda_islocked(v) void *v; { /* true args */ @@ -2020,21 +2023,21 @@ cfs_islocked(v) /* How one looks up a vnode given a device/inode pair: */ int -cfs_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp) +coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp) { /* This is like VFS_VGET() or igetinode()! */ int error; struct mount *mp; if (!(mp = devtomp(dev))) { - myprintf(("cfs_grab_vnode: devtomp(%d) returns NULL\n", dev)); + myprintf(("coda_grab_vnode: devtomp(%d) returns NULL\n", dev)); return(ENXIO); } /* XXX - ensure that nonzero-return means failure */ error = VFS_VGET(mp,ino,vpp); if (error) { - myprintf(("cfs_grab_vnode: iget/vget(%d, %d) returns %p, err %d\n", + myprintf(("coda_grab_vnode: iget/vget(%d, %d) returns %p, err %d\n", dev, ino, *vpp, error)); return(ENOENT); } @@ -2120,31 +2123,31 @@ print_cred(cred) * If no cnode exists for this fid create one and put it * in a table hashed by fid.Volume and fid.Vnode. If the cnode for * this fid is already in the table return it (ref count is - * incremented by cfs_find. The cnode will be flushed from the - * table when cfs_inactive calls cfs_unsave. + * incremented by coda_find. The cnode will be flushed from the + * table when coda_inactive calls coda_unsave. */ struct cnode * -makecfsnode(fid, vfsp, type) +make_coda_node(fid, vfsp, type) ViceFid *fid; struct mount *vfsp; short type; { struct cnode *cp; int err; - if ((cp = cfs_find(fid)) == NULL) { + if ((cp = coda_find(fid)) == NULL) { struct vnode *vp; - cp = cfs_alloc(); + cp = coda_alloc(); lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); cp->c_fid = *fid; - err = getnewvnode(VT_CFS, vfsp, cfs_vnodeop_p, &vp); + err = getnewvnode(VT_CODA, vfsp, coda_vnodeop_p, &vp); if (err) { - panic("cfs: getnewvnode returned error %d\n", err); + panic("coda: getnewvnode returned error %d\n", err); } vp->v_data = cp; vp->v_type = type; cp->c_vnode = vp; - cfs_save(cp); + coda_save(cp); } else { vref(CTOV(cp)); diff --git a/sys/fs/coda/coda_vnops.h b/sys/fs/coda/coda_vnops.h index f965c93..9ed3387 100644 --- a/sys/fs/coda/coda_vnops.h +++ b/sys/fs/coda/coda_vnops.h @@ -27,7 +27,7 @@ * Mellon the rights to redistribute these changes without encumbrance. * * @(#) src/sys/cfs/cfs_vnodeops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ - * $Id: $ + * $Id: cfs_vnodeops.h,v 1.2 1998/09/02 19:09:53 rvb Exp $ * */ @@ -48,6 +48,9 @@ /* * HISTORY * $Log: cfs_vnodeops.h,v $ + * Revision 1.2 1998/09/02 19:09:53 rvb + * Pass2 complete + * * Revision 1.1.1.1 1998/08/29 21:14:52 rvb * Very Preliminary Coda * @@ -64,7 +67,7 @@ * Sync the code for NetBSD -current; test on 1.3 later * * Revision 1.4 98/01/23 11:53:49 rvb - * Bring RVB_CFS1_1 to HEAD + * Bring RVB_CODA1_1 to HEAD * * Revision 1.3.2.3 98/01/23 11:21:13 rvb * Sync with 2.2.5 @@ -73,7 +76,7 @@ * Sync with 1.3 * * Revision 1.3.2.1 97/12/10 14:08:34 rvb - * Fix O_ flags; check result in cfscall + * Fix O_ flags; check result in coda_call * * Revision 1.3 97/12/05 10:39:25 rvb * Read CHANGES @@ -88,48 +91,48 @@ * Added support for Coda MiniCache and raw inode calls (final commit) * * Revision 1.1.2.1 1995/12/20 01:57:40 bnoble - * Added CFS-specific files + * Added CODA-specific files * */ /* NetBSD interfaces to the vnodeops */ -int cfs_open __P((void *)); -int cfs_close __P((void *)); -int cfs_read __P((void *)); -int cfs_write __P((void *)); -int cfs_ioctl __P((void *)); +int coda_open __P((void *)); +int coda_close __P((void *)); +int coda_read __P((void *)); +int coda_write __P((void *)); +int coda_ioctl __P((void *)); /* 1.3 int cfs_select __P((void *));*/ -int cfs_getattr __P((void *)); -int cfs_setattr __P((void *)); -int cfs_access __P((void *)); -int cfs_abortop __P((void *)); -int cfs_readlink __P((void *)); -int cfs_fsync __P((void *)); -int cfs_inactive __P((void *)); -int cfs_lookup __P((void *)); -int cfs_create __P((void *)); -int cfs_remove __P((void *)); -int cfs_link __P((void *)); -int cfs_rename __P((void *)); -int cfs_mkdir __P((void *)); -int cfs_rmdir __P((void *)); -int cfs_symlink __P((void *)); -int cfs_readdir __P((void *)); -int cfs_bmap __P((void *)); -int cfs_strategy __P((void *)); -int cfs_reclaim __P((void *)); -int cfs_lock __P((void *)); -int cfs_unlock __P((void *)); -int cfs_islocked __P((void *)); -int cfs_vop_error __P((void *)); -int cfs_vop_nop __P((void *)); -int cfs_fbsd_getpages __P((void *)); -int cfs_fbsd_putpages __P((void *)); +int coda_getattr __P((void *)); +int coda_setattr __P((void *)); +int coda_access __P((void *)); +int coda_abortop __P((void *)); +int coda_readlink __P((void *)); +int coda_fsync __P((void *)); +int coda_inactive __P((void *)); +int coda_lookup __P((void *)); +int coda_create __P((void *)); +int coda_remove __P((void *)); +int coda_link __P((void *)); +int coda_rename __P((void *)); +int coda_mkdir __P((void *)); +int coda_rmdir __P((void *)); +int coda_symlink __P((void *)); +int coda_readdir __P((void *)); +int coda_bmap __P((void *)); +int coda_strategy __P((void *)); +int coda_reclaim __P((void *)); +int coda_lock __P((void *)); +int coda_unlock __P((void *)); +int coda_islocked __P((void *)); +int coda_vop_error __P((void *)); +int coda_vop_nop __P((void *)); +int coda_fbsd_getpages __P((void *)); +int coda_fbsd_putpages __P((void *)); -int (**cfs_vnodeop_p)(void *); +int (**coda_vnodeop_p)(void *); -int cfs_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, +int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct proc *p); -int cfs_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); +int coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); void print_vattr(struct vattr *attr); void print_cred(struct ucred *cred); diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT index 21566c3..a78f954 100644 --- a/sys/i386/conf/LINT +++ b/sys/i386/conf/LINT @@ -2,7 +2,7 @@ # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.460 1998/09/10 08:20:46 sos Exp $ +# $Id: LINT,v 1.461 1998/09/10 11:23:08 sos Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -552,9 +552,9 @@ options "NFS_WDELAYHASHSIZ=16" # and with this options "NFS_MUIDHASHSIZ=63" # Tune the size of nfsmount with this options NFS_DEBUG # Enable NFS Debugging -# CFS stuff: -#options CFS #CODA filesystem. -#pseudo-device vcfs 4 #coda minicache <-> venus comm. +# Coda stuff: +options CODA #CODA filesystem. +pseudo-device vcoda 4 #coda minicache <-> venus comm. ##################################################################### diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index 21566c3..a78f954 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -2,7 +2,7 @@ # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.460 1998/09/10 08:20:46 sos Exp $ +# $Id: LINT,v 1.461 1998/09/10 11:23:08 sos Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -552,9 +552,9 @@ options "NFS_WDELAYHASHSIZ=16" # and with this options "NFS_MUIDHASHSIZ=63" # Tune the size of nfsmount with this options NFS_DEBUG # Enable NFS Debugging -# CFS stuff: -#options CFS #CODA filesystem. -#pseudo-device vcfs 4 #coda minicache <-> venus comm. +# Coda stuff: +options CODA #CODA filesystem. +pseudo-device vcoda 4 #coda minicache <-> venus comm. ##################################################################### diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 7e5b6bb..d7b6550 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)vnode.h 8.7 (Berkeley) 2/4/94 - * $Id: vnode.h,v 1.72 1998/08/27 02:34:30 jkh Exp $ + * $Id: vnode.h,v 1.73 1998/09/10 02:27:52 tegge Exp $ */ #ifndef _SYS_VNODE_H_ @@ -62,7 +62,7 @@ enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; enum vtagtype { VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, - VT_UNION, VT_MSDOSFS, VT_DEVFS, VT_TFS, VT_VFS, VT_CFS + VT_UNION, VT_MSDOSFS, VT_DEVFS, VT_TFS, VT_VFS, VT_CODA }; /* -- cgit v1.1