1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

All the references to cfs, in symbols, structs, and strings

have been changed to coda.  (Same for CFS.)
This commit is contained in:
Robert V. Baron 1998-09-11 18:50:17 +00:00
parent 90cf373d9b
commit 9afcea2f4a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39085
54 changed files with 4280 additions and 4223 deletions

View File

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

View File

@ -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 <cfs/coda.h>
#include <cfs/cnode.h>
#include <cfs/cfsnc.h>
#ifdef DEBUG
/* for printcred */
#include <cfs/cfs_vnodeops.h>
#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

View File

@ -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 <vcfs.h>
#include <vcoda.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -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);
}

View File

@ -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 <vcfs.h>
#include <vcoda.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -220,14 +220,14 @@
#include <cfs/cfs_subr.h>
#include <cfs/cfsnc.h>
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 @@ cfs_checkunmounting(mp)
}
}
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);
coda_unsave(cp);
cp->c_fid = out->coda_replace.NewFid;
coda_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,
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;
}
/*

View File

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

View File

@ -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 <cfs/pioctl.h>
#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;
}

View File

@ -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 <vcfs.h>
#include <vcoda.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -198,56 +198,56 @@
#include <miscfs/specfs/specdev.h>
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;i<CFS_VFSOPS_SIZE;i++) {
cfs_vfsopstats[i].opcode = i;
cfs_vfsopstats[i].entries = 0;
cfs_vfsopstats[i].sat_intrn = 0;
cfs_vfsopstats[i].unsat_intrn = 0;
cfs_vfsopstats[i].gen_intrn = 0;
for (i=0;i<CODA_VFSOPS_SIZE;i++) {
coda_vfsopstats[i].opcode = i;
coda_vfsopstats[i].entries = 0;
coda_vfsopstats[i].sat_intrn = 0;
coda_vfsopstats[i].unsat_intrn = 0;
coda_vfsopstats[i].gen_intrn = 0;
}
return 0;
@ -259,7 +259,7 @@ cfs_vfsopstats_init(void)
*/
/*ARGSUSED*/
int
cfs_mount(vfsp, path, data, ndp, p)
coda_mount(vfsp, path, data, ndp, p)
struct mount *vfsp; /* Allocated and initialized by mount(2) */
char *path; /* path covered: ignored by the fs-layer */
caddr_t data; /* Need to define a data type for this in netbsd? */
@ -269,7 +269,7 @@ cfs_mount(vfsp, path, data, ndp, p)
struct vnode *dvp;
struct cnode *cp;
dev_t dev;
struct cfs_mntinfo *mi;
struct coda_mntinfo *mi;
struct vnode *rootvp;
ViceFid rootfid;
ViceFid ctlfid;
@ -277,12 +277,12 @@ cfs_mount(vfsp, path, data, ndp, p)
ENTRY;
cfs_vfsopstats_init();
cfs_vnodeopstats_init();
coda_vfsopstats_init();
coda_vnodeopstats_init();
MARK_ENTRY(CFS_MOUNT_STATS);
if (CFS_MOUNTED(vfsp)) {
MARK_INT_FAIL(CFS_MOUNT_STATS);
MARK_ENTRY(CODA_MOUNT_STATS);
if (CODA_MOUNTED(vfsp)) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
return(EBUSY);
}
@ -293,18 +293,18 @@ cfs_mount(vfsp, path, data, ndp, p)
dvp = ndp->ni_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);
}

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -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 <<N)) { STMT } }
#define CODA_NC_DEBUG(N, STMT) { if (coda_nc_debug & (1 <<N)) { STMT } }
/* Prototypes of functions exported within cfs */
extern void cfsnc_init(void);
extern void cfsnc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *);
extern struct cnode *cfsnc_lookup(struct cnode *, const char *, int, struct ucred *);
extern void coda_nc_init(void);
extern void coda_nc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *);
extern struct cnode *coda_nc_lookup(struct cnode *, const char *, int, struct ucred *);
extern void cfsnc_zapParentfid(ViceFid *, enum dc_status);
extern void cfsnc_zapfid(ViceFid *, enum dc_status);
extern void cfsnc_zapvnode(ViceFid *, struct ucred *, enum dc_status);
extern void cfsnc_zapfile(struct cnode *, const char *, int);
extern void cfsnc_purge_user(vuid_t, enum dc_status);
extern void cfsnc_flush(enum dc_status);
extern void coda_nc_zapParentfid(ViceFid *, enum dc_status);
extern void coda_nc_zapfid(ViceFid *, enum dc_status);
extern void coda_nc_zapvnode(ViceFid *, struct ucred *, enum dc_status);
extern void coda_nc_zapfile(struct cnode *, const char *, int);
extern void coda_nc_purge_user(vuid_t, enum dc_status);
extern void coda_nc_flush(enum dc_status);
extern void print_cfsnc(void);
extern void cfsnc_gather_stats(void);
extern int cfsnc_resize(int, int, enum dc_status);
extern void cfsnc_name(struct cnode *cp);
extern void print_coda_nc(void);
extern void coda_nc_gather_stats(void);
extern int coda_nc_resize(int, int, enum dc_status);
extern void coda_nc_name(struct cnode *cp);
/*
* Structure to contain statistics on the cache usage
*/
struct cfsnc_statistics {
struct coda_nc_statistics {
unsigned hits;
unsigned misses;
unsigned enters;
@ -261,18 +264,18 @@ struct cfsnc_statistics {
unsigned Search_len;
};
#define CFSNC_FIND ((u_long) 1)
#define CFSNC_REMOVE ((u_long) 2)
#define CFSNC_INIT ((u_long) 3)
#define CFSNC_ENTER ((u_long) 4)
#define CFSNC_LOOKUP ((u_long) 5)
#define CFSNC_ZAPPFID ((u_long) 6)
#define CFSNC_ZAPFID ((u_long) 7)
#define CFSNC_ZAPVNODE ((u_long) 8)
#define CFSNC_ZAPFILE ((u_long) 9)
#define CFSNC_PURGEUSER ((u_long) 10)
#define CFSNC_FLUSH ((u_long) 11)
#define CFSNC_PRINTCFSNC ((u_long) 12)
#define CFSNC_PRINTSTATS ((u_long) 13)
#define CODA_NC_FIND ((u_long) 1)
#define CODA_NC_REMOVE ((u_long) 2)
#define CODA_NC_INIT ((u_long) 3)
#define CODA_NC_ENTER ((u_long) 4)
#define CODA_NC_LOOKUP ((u_long) 5)
#define CODA_NC_ZAPPFID ((u_long) 6)
#define CODA_NC_ZAPFID ((u_long) 7)
#define CODA_NC_ZAPVNODE ((u_long) 8)
#define CODA_NC_ZAPFILE ((u_long) 9)
#define CODA_NC_PURGEUSER ((u_long) 10)
#define CODA_NC_FLUSH ((u_long) 11)
#define CODA_NC_PRINTCODA_NC ((u_long) 12)
#define CODA_NC_PRINTSTATS ((u_long) 13)
#endif

View File

@ -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 <sys/lock.h>
#include <machine/clock.h>
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_ */

View File

@ -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 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 >= CFS_REPLACE && opcode <= CFS_PURGEFID)
#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

View File

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

View File

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

View File

@ -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 <sys/lock.h>
#include <machine/clock.h>
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_ */

View File

@ -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 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 >= CFS_REPLACE && opcode <= CFS_PURGEFID)
#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

View File

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

View File

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

View File

@ -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 <cfs/coda.h>
#include <cfs/cnode.h>
#include <cfs/cfsnc.h>
#ifdef DEBUG
/* for printcred */
#include <cfs/cfs_vnodeops.h>
#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

View File

@ -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 <<N)) { STMT } }
#define CODA_NC_DEBUG(N, STMT) { if (coda_nc_debug & (1 <<N)) { STMT } }
/* Prototypes of functions exported within cfs */
extern void cfsnc_init(void);
extern void cfsnc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *);
extern struct cnode *cfsnc_lookup(struct cnode *, const char *, int, struct ucred *);
extern void coda_nc_init(void);
extern void coda_nc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *);
extern struct cnode *coda_nc_lookup(struct cnode *, const char *, int, struct ucred *);
extern void cfsnc_zapParentfid(ViceFid *, enum dc_status);
extern void cfsnc_zapfid(ViceFid *, enum dc_status);
extern void cfsnc_zapvnode(ViceFid *, struct ucred *, enum dc_status);
extern void cfsnc_zapfile(struct cnode *, const char *, int);
extern void cfsnc_purge_user(vuid_t, enum dc_status);
extern void cfsnc_flush(enum dc_status);
extern void coda_nc_zapParentfid(ViceFid *, enum dc_status);
extern void coda_nc_zapfid(ViceFid *, enum dc_status);
extern void coda_nc_zapvnode(ViceFid *, struct ucred *, enum dc_status);
extern void coda_nc_zapfile(struct cnode *, const char *, int);
extern void coda_nc_purge_user(vuid_t, enum dc_status);
extern void coda_nc_flush(enum dc_status);
extern void print_cfsnc(void);
extern void cfsnc_gather_stats(void);
extern int cfsnc_resize(int, int, enum dc_status);
extern void cfsnc_name(struct cnode *cp);
extern void print_coda_nc(void);
extern void coda_nc_gather_stats(void);
extern int coda_nc_resize(int, int, enum dc_status);
extern void coda_nc_name(struct cnode *cp);
/*
* Structure to contain statistics on the cache usage
*/
struct cfsnc_statistics {
struct coda_nc_statistics {
unsigned hits;
unsigned misses;
unsigned enters;
@ -261,18 +264,18 @@ struct cfsnc_statistics {
unsigned Search_len;
};
#define CFSNC_FIND ((u_long) 1)
#define CFSNC_REMOVE ((u_long) 2)
#define CFSNC_INIT ((u_long) 3)
#define CFSNC_ENTER ((u_long) 4)
#define CFSNC_LOOKUP ((u_long) 5)
#define CFSNC_ZAPPFID ((u_long) 6)
#define CFSNC_ZAPFID ((u_long) 7)
#define CFSNC_ZAPVNODE ((u_long) 8)
#define CFSNC_ZAPFILE ((u_long) 9)
#define CFSNC_PURGEUSER ((u_long) 10)
#define CFSNC_FLUSH ((u_long) 11)
#define CFSNC_PRINTCFSNC ((u_long) 12)
#define CFSNC_PRINTSTATS ((u_long) 13)
#define CODA_NC_FIND ((u_long) 1)
#define CODA_NC_REMOVE ((u_long) 2)
#define CODA_NC_INIT ((u_long) 3)
#define CODA_NC_ENTER ((u_long) 4)
#define CODA_NC_LOOKUP ((u_long) 5)
#define CODA_NC_ZAPPFID ((u_long) 6)
#define CODA_NC_ZAPFID ((u_long) 7)
#define CODA_NC_ZAPVNODE ((u_long) 8)
#define CODA_NC_ZAPFILE ((u_long) 9)
#define CODA_NC_PURGEUSER ((u_long) 10)
#define CODA_NC_FLUSH ((u_long) 11)
#define CODA_NC_PRINTCODA_NC ((u_long) 12)
#define CODA_NC_PRINTSTATS ((u_long) 13)
#endif

View File

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

View File

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

View File

@ -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 <vcfs.h>
#include <vcoda.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -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);
}

View File

@ -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 <vcfs.h>
#include <vcoda.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -220,14 +220,14 @@
#include <cfs/cfs_subr.h>
#include <cfs/cfsnc.h>
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 @@ cfs_checkunmounting(mp)
}
}
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);
coda_unsave(cp);
cp->c_fid = out->coda_replace.NewFid;
coda_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,
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;
}
/*

View File

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

View File

@ -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 <cfs/pioctl.h>
#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;
}

View File

@ -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 <vcfs.h>
#include <vcoda.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -198,56 +198,56 @@
#include <miscfs/specfs/specdev.h>
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;i<CFS_VFSOPS_SIZE;i++) {
cfs_vfsopstats[i].opcode = i;
cfs_vfsopstats[i].entries = 0;
cfs_vfsopstats[i].sat_intrn = 0;
cfs_vfsopstats[i].unsat_intrn = 0;
cfs_vfsopstats[i].gen_intrn = 0;
for (i=0;i<CODA_VFSOPS_SIZE;i++) {
coda_vfsopstats[i].opcode = i;
coda_vfsopstats[i].entries = 0;
coda_vfsopstats[i].sat_intrn = 0;
coda_vfsopstats[i].unsat_intrn = 0;
coda_vfsopstats[i].gen_intrn = 0;
}
return 0;
@ -259,7 +259,7 @@ cfs_vfsopstats_init(void)
*/
/*ARGSUSED*/
int
cfs_mount(vfsp, path, data, ndp, p)
coda_mount(vfsp, path, data, ndp, p)
struct mount *vfsp; /* Allocated and initialized by mount(2) */
char *path; /* path covered: ignored by the fs-layer */
caddr_t data; /* Need to define a data type for this in netbsd? */
@ -269,7 +269,7 @@ cfs_mount(vfsp, path, data, ndp, p)
struct vnode *dvp;
struct cnode *cp;
dev_t dev;
struct cfs_mntinfo *mi;
struct coda_mntinfo *mi;
struct vnode *rootvp;
ViceFid rootfid;
ViceFid ctlfid;
@ -277,12 +277,12 @@ cfs_mount(vfsp, path, data, ndp, p)
ENTRY;
cfs_vfsopstats_init();
cfs_vnodeopstats_init();
coda_vfsopstats_init();
coda_vnodeopstats_init();
MARK_ENTRY(CFS_MOUNT_STATS);
if (CFS_MOUNTED(vfsp)) {
MARK_INT_FAIL(CFS_MOUNT_STATS);
MARK_ENTRY(CODA_MOUNT_STATS);
if (CODA_MOUNTED(vfsp)) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
return(EBUSY);
}
@ -293,18 +293,18 @@ cfs_mount(vfsp, path, data, ndp, p)
dvp = ndp->ni_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);
}

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -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.
#####################################################################

View File

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

View File

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

View File

@ -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 <sys/lock.h>
#include <machine/clock.h>
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_ */

View File

@ -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 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 >= CFS_REPLACE && opcode <= CFS_PURGEFID)
#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

View File

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

View File

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

View File

@ -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 <cfs/coda.h>
#include <cfs/cnode.h>
#include <cfs/cfsnc.h>
#ifdef DEBUG
/* for printcred */
#include <cfs/cfs_vnodeops.h>
#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

View File

@ -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 <<N)) { STMT } }
#define CODA_NC_DEBUG(N, STMT) { if (coda_nc_debug & (1 <<N)) { STMT } }
/* Prototypes of functions exported within cfs */
extern void cfsnc_init(void);
extern void cfsnc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *);
extern struct cnode *cfsnc_lookup(struct cnode *, const char *, int, struct ucred *);
extern void coda_nc_init(void);
extern void coda_nc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *);
extern struct cnode *coda_nc_lookup(struct cnode *, const char *, int, struct ucred *);
extern void cfsnc_zapParentfid(ViceFid *, enum dc_status);
extern void cfsnc_zapfid(ViceFid *, enum dc_status);
extern void cfsnc_zapvnode(ViceFid *, struct ucred *, enum dc_status);
extern void cfsnc_zapfile(struct cnode *, const char *, int);
extern void cfsnc_purge_user(vuid_t, enum dc_status);
extern void cfsnc_flush(enum dc_status);
extern void coda_nc_zapParentfid(ViceFid *, enum dc_status);
extern void coda_nc_zapfid(ViceFid *, enum dc_status);
extern void coda_nc_zapvnode(ViceFid *, struct ucred *, enum dc_status);
extern void coda_nc_zapfile(struct cnode *, const char *, int);
extern void coda_nc_purge_user(vuid_t, enum dc_status);
extern void coda_nc_flush(enum dc_status);
extern void print_cfsnc(void);
extern void cfsnc_gather_stats(void);
extern int cfsnc_resize(int, int, enum dc_status);
extern void cfsnc_name(struct cnode *cp);
extern void print_coda_nc(void);
extern void coda_nc_gather_stats(void);
extern int coda_nc_resize(int, int, enum dc_status);
extern void coda_nc_name(struct cnode *cp);
/*
* Structure to contain statistics on the cache usage
*/
struct cfsnc_statistics {
struct coda_nc_statistics {
unsigned hits;
unsigned misses;
unsigned enters;
@ -261,18 +264,18 @@ struct cfsnc_statistics {
unsigned Search_len;
};
#define CFSNC_FIND ((u_long) 1)
#define CFSNC_REMOVE ((u_long) 2)
#define CFSNC_INIT ((u_long) 3)
#define CFSNC_ENTER ((u_long) 4)
#define CFSNC_LOOKUP ((u_long) 5)
#define CFSNC_ZAPPFID ((u_long) 6)
#define CFSNC_ZAPFID ((u_long) 7)
#define CFSNC_ZAPVNODE ((u_long) 8)
#define CFSNC_ZAPFILE ((u_long) 9)
#define CFSNC_PURGEUSER ((u_long) 10)
#define CFSNC_FLUSH ((u_long) 11)
#define CFSNC_PRINTCFSNC ((u_long) 12)
#define CFSNC_PRINTSTATS ((u_long) 13)
#define CODA_NC_FIND ((u_long) 1)
#define CODA_NC_REMOVE ((u_long) 2)
#define CODA_NC_INIT ((u_long) 3)
#define CODA_NC_ENTER ((u_long) 4)
#define CODA_NC_LOOKUP ((u_long) 5)
#define CODA_NC_ZAPPFID ((u_long) 6)
#define CODA_NC_ZAPFID ((u_long) 7)
#define CODA_NC_ZAPVNODE ((u_long) 8)
#define CODA_NC_ZAPFILE ((u_long) 9)
#define CODA_NC_PURGEUSER ((u_long) 10)
#define CODA_NC_FLUSH ((u_long) 11)
#define CODA_NC_PRINTCODA_NC ((u_long) 12)
#define CODA_NC_PRINTSTATS ((u_long) 13)
#endif

View File

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

View File

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

View File

@ -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 <vcfs.h>
#include <vcoda.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -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);
}

View File

@ -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 <vcfs.h>
#include <vcoda.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -220,14 +220,14 @@
#include <cfs/cfs_subr.h>
#include <cfs/cfsnc.h>
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 @@ cfs_checkunmounting(mp)
}
}
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);
coda_unsave(cp);
cp->c_fid = out->coda_replace.NewFid;
coda_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,
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;
}
/*

View File

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

View File

@ -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 <cfs/pioctl.h>
#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;
}

View File

@ -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 <vcfs.h>
#include <vcoda.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -198,56 +198,56 @@
#include <miscfs/specfs/specdev.h>
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;i<CFS_VFSOPS_SIZE;i++) {
cfs_vfsopstats[i].opcode = i;
cfs_vfsopstats[i].entries = 0;
cfs_vfsopstats[i].sat_intrn = 0;
cfs_vfsopstats[i].unsat_intrn = 0;
cfs_vfsopstats[i].gen_intrn = 0;
for (i=0;i<CODA_VFSOPS_SIZE;i++) {
coda_vfsopstats[i].opcode = i;
coda_vfsopstats[i].entries = 0;
coda_vfsopstats[i].sat_intrn = 0;
coda_vfsopstats[i].unsat_intrn = 0;
coda_vfsopstats[i].gen_intrn = 0;
}
return 0;
@ -259,7 +259,7 @@ cfs_vfsopstats_init(void)
*/
/*ARGSUSED*/
int
cfs_mount(vfsp, path, data, ndp, p)
coda_mount(vfsp, path, data, ndp, p)
struct mount *vfsp; /* Allocated and initialized by mount(2) */
char *path; /* path covered: ignored by the fs-layer */
caddr_t data; /* Need to define a data type for this in netbsd? */
@ -269,7 +269,7 @@ cfs_mount(vfsp, path, data, ndp, p)
struct vnode *dvp;
struct cnode *cp;
dev_t dev;
struct cfs_mntinfo *mi;
struct coda_mntinfo *mi;
struct vnode *rootvp;
ViceFid rootfid;
ViceFid ctlfid;
@ -277,12 +277,12 @@ cfs_mount(vfsp, path, data, ndp, p)
ENTRY;
cfs_vfsopstats_init();
cfs_vnodeopstats_init();
coda_vfsopstats_init();
coda_vnodeopstats_init();
MARK_ENTRY(CFS_MOUNT_STATS);
if (CFS_MOUNTED(vfsp)) {
MARK_INT_FAIL(CFS_MOUNT_STATS);
MARK_ENTRY(CODA_MOUNT_STATS);
if (CODA_MOUNTED(vfsp)) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
return(EBUSY);
}
@ -293,18 +293,18 @@ cfs_mount(vfsp, path, data, ndp, p)
dvp = ndp->ni_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);
}

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -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.
#####################################################################

View File

@ -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.
#####################################################################

View File

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