Change cfs/CFS in symbols, strings and constants to coda/CODA
to avoid fs conflicts.
This commit is contained in:
parent
e6b129450c
commit
0aa47cd025
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC,v 1.181 1998/09/08 20:56:08 rvb Exp $
|
||||
# $NetBSD: GENERIC,v 1.182 1998/09/12 15:05:47 rvb Exp $
|
||||
#
|
||||
# GENERIC -- everything that's currently supported
|
||||
#
|
||||
@ -99,7 +99,7 @@ file-system PORTAL # portal filesystem (still experimental)
|
||||
file-system PROCFS # /proc
|
||||
file-system UMAPFS # NULLFS + uid and gid remapping
|
||||
file-system UNION # union file system
|
||||
#file-system CFS # Coda File System; also needs vcfs (below)
|
||||
#file-system CODA # Coda File System; also needs vcoda (below)
|
||||
|
||||
# File system options
|
||||
options QUOTA # UFS quotas
|
||||
@ -541,5 +541,5 @@ pseudo-device sequencer 1 # MIDI sequencer
|
||||
#pseudo-device rnd # /dev/random and in-kernel generator
|
||||
#options RND_COM # use "com" randomness as well (BROKEN)
|
||||
|
||||
# a pseudo device needed for Coda # also needs CFS (above)
|
||||
#pseudo-device vcfs 4 # coda minicache <-> venus comm.
|
||||
# a pseudo device needed for Coda # also needs CODA (above)
|
||||
#pseudo-device vcoda 4 # coda minicache <-> venus comm.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: conf.c,v 1.102 1998/08/15 03:51:30 mycroft Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.103 1998/09/12 15:05:48 rvb Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -213,7 +213,7 @@ cdev_decl(uhid);
|
||||
cdev_decl(ugen);
|
||||
#include "ulpt.h"
|
||||
cdev_decl(ulpt);
|
||||
#include "vcfs.h"
|
||||
#include "vcoda.h"
|
||||
cdev_decl(vc_nb_);
|
||||
|
||||
#include "ipfilter.h"
|
||||
@ -355,7 +355,7 @@ struct cdevsw cdevsw[] =
|
||||
cdev_lpt_init(NULPT,ulpt), /* 57: USB printer */
|
||||
cdev_midi_init(NMIDI,midi), /* 58: MIDI I/O */
|
||||
cdev_midi_init(NSEQUENCER,sequencer), /* 59: sequencer I/O */
|
||||
cdev_vc_nb_init(NVCFS,vc_nb_), /* 60: coda file system psdev */
|
||||
cdev_vc_nb_init(NVCODA,vc_nb_), /* 60: coda file system psdev */
|
||||
};
|
||||
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfs_namecache.c,v 1.2 1998/09/08 17:12:46 rvb Exp $ */
|
||||
/* $NetBSD: cfs_namecache.c,v 1.3 1998/09/12 15:05:48 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -47,6 +47,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: cfs_namecache.c,v $
|
||||
* Revision 1.3 1998/09/12 15:05:48 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:46 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -69,7 +73,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 +113,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 +129,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 +141,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 +164,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 +184,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 +207,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.
|
||||
@ -228,76 +232,76 @@
|
||||
* Declaration of the name cache data structure.
|
||||
*/
|
||||
|
||||
int cfsnc_use = 1; /* Indicate use of CFS Name Cache */
|
||||
int coda_nc_use = 1; /* Indicate use of CODA Name Cache */
|
||||
|
||||
int cfsnc_size = CFSNC_CACHESIZE; /* size of the cache */
|
||||
int cfsnc_hashsize = CFSNC_HASHSIZE; /* size of the primary hash */
|
||||
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 cfscache 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);
|
||||
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;
|
||||
@ -308,28 +312,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,
|
||||
@ -340,7 +344,7 @@ cfsnc_find(dcp, name, namelen, cred, hash)
|
||||
#endif
|
||||
}
|
||||
|
||||
return((struct cfscache *)0);
|
||||
return((struct coda_cache *)0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -348,52 +352,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);
|
||||
@ -414,11 +418,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(); )
|
||||
}
|
||||
|
||||
/*
|
||||
@ -426,22 +430,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);
|
||||
}
|
||||
|
||||
@ -450,25 +454,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); )
|
||||
|
||||
@ -476,8 +480,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;
|
||||
{
|
||||
/*
|
||||
@ -485,14 +489,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;
|
||||
}
|
||||
@ -508,15 +512,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;
|
||||
{
|
||||
@ -525,34 +529,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -562,35 +566,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -600,7 +604,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;
|
||||
@ -609,10 +613,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)); )
|
||||
|
||||
@ -622,7 +626,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;
|
||||
@ -630,31 +634,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 */
|
||||
/* 1.3 */
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -663,7 +667,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;
|
||||
{
|
||||
@ -675,30 +679,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -707,7 +711,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
|
||||
@ -721,21 +725,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))
|
||||
{
|
||||
@ -744,9 +748,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)
|
||||
@ -761,8 +765,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;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -773,16 +777,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,
|
||||
@ -792,42 +796,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;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -837,7 +841,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;
|
||||
{
|
||||
@ -845,44 +849,44 @@ 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];
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfs_psdev.c,v 1.2 1998/09/08 17:12:47 rvb Exp $ */
|
||||
/* $NetBSD: cfs_psdev.c,v 1.3 1998/09/12 15:05:48 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -52,6 +52,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: cfs_psdev.c,v $
|
||||
* Revision 1.3 1998/09/12 15:05:48 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:47 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -80,7 +84,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
|
||||
@ -89,7 +93,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
|
||||
@ -142,7 +146,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
|
||||
@ -151,9 +155,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>
|
||||
#include <sys/kernel.h>
|
||||
@ -172,10 +176,11 @@ extern int cfsnc_initialized; /* Set if cache has been initialized */
|
||||
|
||||
#define CTL_C
|
||||
|
||||
int cfs_psdev_print_entry = 0;
|
||||
#define ENTRY if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
|
||||
int coda_psdev_print_entry = 0;
|
||||
|
||||
void vcfsattach(int n);
|
||||
#define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
|
||||
|
||||
void vcodaattach(int n);
|
||||
int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p);
|
||||
int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p);
|
||||
int vc_nb_read(dev_t dev, struct uio *uiop, int flag);
|
||||
@ -198,9 +203,9 @@ struct vmsg {
|
||||
#define VM_WRITE 2
|
||||
#define VM_INTR 4
|
||||
|
||||
/* vcfsattach: do nothing */
|
||||
/* vcodaattach: do nothing */
|
||||
void
|
||||
vcfsattach(n)
|
||||
vcodaattach(n)
|
||||
int n;
|
||||
{
|
||||
}
|
||||
@ -219,13 +224,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);
|
||||
|
||||
@ -234,8 +239,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);
|
||||
}
|
||||
@ -249,15 +254,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))
|
||||
@ -274,7 +279,7 @@ vc_nb_close (dev, flag, mode, p)
|
||||
VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING;
|
||||
if (vfs_busy(mi->mi_vfsp, 0, 0))
|
||||
return (EBUSY);
|
||||
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",
|
||||
@ -288,9 +293,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;
|
||||
}
|
||||
|
||||
@ -320,10 +325,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 */
|
||||
@ -347,12 +352,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);
|
||||
}
|
||||
|
||||
@ -370,7 +375,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];
|
||||
@ -378,10 +383,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;
|
||||
@ -394,7 +399,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)) {
|
||||
@ -402,7 +407,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));
|
||||
@ -421,7 +426,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);
|
||||
@ -431,7 +436,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. */
|
||||
@ -473,22 +478,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);
|
||||
@ -511,10 +516,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)
|
||||
@ -531,7 +536,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
|
||||
@ -543,15 +548,15 @@ struct cfs_clstat cfs_clstat;
|
||||
*/
|
||||
|
||||
/* If you want this to be interruptible, set this to > PZERO */
|
||||
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;
|
||||
@ -568,27 +573,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);
|
||||
@ -605,7 +610,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
|
||||
@ -614,29 +619,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... */
|
||||
@ -647,7 +652,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);
|
||||
@ -658,29 +663,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! */
|
||||
@ -690,16 +695,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);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfs_subr.c,v 1.2 1998/09/08 17:12:47 rvb Exp $ */
|
||||
/* $NetBSD: cfs_subr.c,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -46,6 +46,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: cfs_subr.c,v $
|
||||
* Revision 1.3 1998/09/12 15:05:49 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:47 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -68,7 +72,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 +112,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 +127,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 +165,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 +200,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,15 +224,15 @@
|
||||
#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)
|
||||
|
||||
@ -238,22 +242,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));
|
||||
|
||||
@ -264,40 +268,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);
|
||||
@ -316,19 +320,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);
|
||||
@ -337,16 +341,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;
|
||||
{
|
||||
@ -365,16 +369,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,
|
||||
@ -392,21 +396,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -416,13 +420,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",
|
||||
@ -439,17 +443,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);
|
||||
}
|
||||
@ -460,7 +464,7 @@ cfs_unmounting(whoIam)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
cfs_checkunmounting(mp)
|
||||
coda_checkunmounting(mp)
|
||||
struct mount *mp;
|
||||
{
|
||||
register struct vnode *vp, *nvp;
|
||||
@ -482,28 +486,28 @@ loop:
|
||||
}
|
||||
|
||||
int
|
||||
cfs_cacheprint(whoIam)
|
||||
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(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
|
||||
|
||||
@ -511,17 +515,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.
|
||||
@ -529,7 +533,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)
|
||||
@ -539,38 +543,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,
|
||||
@ -585,20 +589,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,
|
||||
@ -612,44 +616,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)););
|
||||
@ -661,24 +665,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));
|
||||
@ -691,10 +695,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;
|
||||
@ -705,22 +709,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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfs_subr.h,v 1.2 1998/09/08 17:12:47 rvb Exp $ */
|
||||
/* $NetBSD: cfs_subr.h,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -31,17 +31,17 @@
|
||||
* @(#) cfs/cfs_subr.h,v 1.1.1.1 1998/08/29 21:26:45 rvb Exp $
|
||||
*/
|
||||
|
||||
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);
|
||||
int cfs_checkunmounting(struct mount *mp);
|
||||
int 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);
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfs_venus.c,v 1.2 1998/09/08 17:12:47 rvb Exp $ */
|
||||
/* $NetBSD: cfs_venus.c,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -46,10 +46,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
|
||||
|
||||
@ -63,29 +63,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); \
|
||||
@ -164,17 +164,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;
|
||||
}
|
||||
|
||||
@ -184,22 +184,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;
|
||||
}
|
||||
|
||||
@ -208,17 +208,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;
|
||||
}
|
||||
|
||||
@ -245,14 +245,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
|
||||
@ -265,17 +265,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) {
|
||||
@ -287,7 +287,7 @@ venus_ioctl(void *mdp, ViceFid *fid,
|
||||
}
|
||||
}
|
||||
|
||||
CFS_FREE(inp, cfs_ioctl_size);
|
||||
CODA_FREE(inp, coda_ioctl_size);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -296,19 +296,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;
|
||||
}
|
||||
|
||||
@ -316,17 +316,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;
|
||||
}
|
||||
|
||||
@ -334,17 +334,17 @@ 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;
|
||||
inp->flags = mode;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -353,23 +353,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;
|
||||
}
|
||||
|
||||
@ -377,16 +377,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;
|
||||
}
|
||||
|
||||
@ -396,24 +396,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;
|
||||
}
|
||||
|
||||
@ -423,12 +423,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<<6;
|
||||
@ -437,13 +437,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;
|
||||
}
|
||||
|
||||
@ -452,20 +452,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;
|
||||
}
|
||||
|
||||
@ -474,21 +474,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;
|
||||
}
|
||||
|
||||
@ -497,12 +497,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;
|
||||
|
||||
@ -512,9 +512,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;
|
||||
}
|
||||
|
||||
@ -524,25 +524,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;
|
||||
}
|
||||
|
||||
@ -551,20 +551,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;
|
||||
}
|
||||
|
||||
@ -573,12 +573,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);
|
||||
|
||||
@ -588,9 +588,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;
|
||||
}
|
||||
|
||||
@ -600,24 +600,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;
|
||||
}
|
||||
|
||||
@ -626,19 +626,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;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfs_vfsops.c,v 1.2 1998/09/08 17:12:47 rvb Exp $ */
|
||||
/* $NetBSD: cfs_vfsops.c,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -28,7 +28,7 @@
|
||||
* improvements or extensions that they make, and to grant Carnegie
|
||||
* Mellon the rights to redistribute these changes without encumbrance.
|
||||
*
|
||||
* @(#) cfs/cfs_vfsops.c,v 1.1.1.1 1998/08/29 21:26:45 rvb Exp $
|
||||
* @(#) cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:26:45 rvb Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -47,6 +47,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: cfs_vfsops.c,v $
|
||||
* Revision 1.3 1998/09/12 15:05:49 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:47 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -69,13 +73,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 +100,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 +138,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 +166,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.
|
||||
@ -178,7 +182,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <vcfs.h>
|
||||
#include <vcoda.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -198,65 +202,65 @@
|
||||
/* for VN_RDEV */
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
int cfsdebug = 0;
|
||||
int codadebug = 0;
|
||||
|
||||
int cfs_vfsop_print_entry = 0;
|
||||
#define ENTRY if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
|
||||
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 *));
|
||||
extern struct cdevsw cdevsw[]; /* For sanity check in cfs_mount */
|
||||
extern struct vnodeopv_desc cfs_vnodeop_opv_desc;
|
||||
extern struct cdevsw cdevsw[]; /* For sanity check in coda_mount */
|
||||
extern struct vnodeopv_desc coda_vnodeop_opv_desc;
|
||||
|
||||
struct vnodeopv_desc *cfs_vnodeopv_descs[] = {
|
||||
&cfs_vnodeop_opv_desc,
|
||||
struct vnodeopv_desc *coda_vnodeopv_descs[] = {
|
||||
&coda_vnodeop_opv_desc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct vfsops cfs_vfsops = {
|
||||
MOUNT_CFS,
|
||||
cfs_mount,
|
||||
cfs_start,
|
||||
cfs_unmount,
|
||||
cfs_root,
|
||||
cfs_quotactl,
|
||||
cfs_nb_statfs,
|
||||
cfs_sync,
|
||||
cfs_vget,
|
||||
struct vfsops coda_vfsops = {
|
||||
MOUNT_CODA,
|
||||
coda_mount,
|
||||
coda_start,
|
||||
coda_unmount,
|
||||
coda_root,
|
||||
coda_quotactl,
|
||||
coda_nb_statfs,
|
||||
coda_sync,
|
||||
coda_vget,
|
||||
(int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **,
|
||||
int *, struct ucred **))
|
||||
eopnotsupp,
|
||||
(int (*) (struct vnode *, struct fid *)) eopnotsupp,
|
||||
cfs_init,
|
||||
cfs_sysctl,
|
||||
coda_init,
|
||||
coda_sysctl,
|
||||
(int (*)(void)) eopnotsupp,
|
||||
cfs_vnodeopv_descs,
|
||||
coda_vnodeopv_descs,
|
||||
0
|
||||
};
|
||||
|
||||
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;
|
||||
@ -268,7 +272,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) */
|
||||
const char *path; /* path covered: ignored by the fs-layer */
|
||||
void *data; /* Need to define a data type for this in netbsd? */
|
||||
@ -278,7 +282,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;
|
||||
@ -286,12 +290,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);
|
||||
}
|
||||
|
||||
@ -302,18 +306,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);
|
||||
}
|
||||
|
||||
@ -322,54 +326,54 @@ 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);
|
||||
}
|
||||
|
||||
/* No initialization (here) of mi_vcomm! */
|
||||
vfsp->mnt_data = (qaddr_t)mi;
|
||||
vfsp->mnt_stat.f_fsid.val[0] = 0;
|
||||
vfsp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CFS);
|
||||
vfsp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CODA);
|
||||
mi->mi_vfsp = vfsp;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
@ -380,18 +384,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;
|
||||
@ -401,18 +405,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);
|
||||
}
|
||||
|
||||
@ -421,13 +425,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
|
||||
@ -440,9 +444,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);
|
||||
}
|
||||
@ -453,18 +457,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 +480,7 @@ cfs_root(vfsp, vpp)
|
||||
/* On Mach, this is vref. On NetBSD, VOP_LOCK */
|
||||
vref(*vpp);
|
||||
vn_lock(*vpp, LK_EXCLUSIVE);
|
||||
MARK_INT_SAT(CFS_ROOT_STATS);
|
||||
MARK_INT_SAT(CODA_ROOT_STATS);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
@ -488,34 +492,34 @@ 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;
|
||||
vref(*vpp);
|
||||
vn_lock(*vpp, LK_EXCLUSIVE);
|
||||
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;
|
||||
vref(*vpp);
|
||||
vn_lock(*vpp, LK_EXCLUSIVE);
|
||||
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;
|
||||
}
|
||||
@ -524,7 +528,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;
|
||||
@ -539,15 +543,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);
|
||||
}
|
||||
|
||||
@ -567,10 +571,10 @@ cfs_nb_statfs(vfsp, sbp, p)
|
||||
sbp->f_files = NB_SFS_SIZ;
|
||||
sbp->f_ffree = NB_SFS_SIZ;
|
||||
bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t));
|
||||
strncpy(sbp->f_fstypename, MOUNT_CFS, MFSNAMELEN-1);
|
||||
strncpy(sbp->f_fstypename, MOUNT_CODA, MFSNAMELEN-1);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -578,20 +582,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;
|
||||
@ -606,7 +610,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;
|
||||
@ -623,33 +627,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;
|
||||
{
|
||||
@ -658,13 +662,13 @@ cfs_vptofh(vnp, fidp)
|
||||
}
|
||||
|
||||
void
|
||||
cfs_init(void)
|
||||
coda_init(void)
|
||||
{
|
||||
ENTRY;
|
||||
}
|
||||
|
||||
int
|
||||
cfs_sysctl(name, namelen, oldp, oldlp, newp, newl, p)
|
||||
coda_sysctl(name, namelen, oldp, oldlp, newp, newl, p)
|
||||
int *name;
|
||||
u_int namelen;
|
||||
void *oldp;
|
||||
@ -700,7 +704,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;
|
||||
|
||||
@ -714,7 +718,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);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfs_vfsops.h,v 1.2 1998/09/08 17:12:48 rvb Exp $ */
|
||||
/* $NetBSD: cfs_vfsops.h,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -45,20 +45,20 @@ struct cfid {
|
||||
|
||||
struct mount;
|
||||
|
||||
int cfs_vfsopstats_init(void);
|
||||
int cfs_mount(struct mount *, const char *, void *, struct nameidata *,
|
||||
int coda_vfsopstats_init(void);
|
||||
int coda_mount(struct mount *, const char *, void *, 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 *);
|
||||
void cfs_init(void);
|
||||
int cfs_sysctl(int *, u_int, void *, size_t *, void *, size_t,
|
||||
int coda_vptofh(struct vnode *, struct fid *);
|
||||
void coda_init(void);
|
||||
int coda_sysctl(int *, u_int, void *, size_t *, void *, size_t,
|
||||
struct proc *);
|
||||
int getNewVnode(struct vnode **vpp);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfs_vnodeops.h,v 1.2 1998/09/08 17:12:48 rvb Exp $ */
|
||||
/* $NetBSD: cfs_vnodeops.h,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -48,6 +48,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: cfs_vnodeops.h,v $
|
||||
* Revision 1.3 1998/09/12 15:05:49 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:48 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -67,7 +71,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
|
||||
@ -76,13 +80,13 @@
|
||||
* 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
|
||||
*
|
||||
* Revision 1.2.34.2 97/11/20 11:46:54 rvb
|
||||
* Capture current cfs_venus
|
||||
* Capture current coda_venus
|
||||
*
|
||||
* Revision 1.2.34.1 97/11/13 22:03:04 rvb
|
||||
* pass2 cfs_NetBSD.h mt
|
||||
@ -91,46 +95,46 @@
|
||||
* 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 *));
|
||||
/* 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 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 coda_select __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 (**cfs_vnodeop_p)(void *);
|
||||
int cfs_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw,
|
||||
int (**coda_vnodeop_p)(void *);
|
||||
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);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfsio.h,v 1.2 1998/09/08 17:12:48 rvb Exp $ */
|
||||
/* $NetBSD: cfsio.h,v 1.3 1998/09/12 15:05:50 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -47,6 +47,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: cfsio.h,v $
|
||||
* Revision 1.3 1998/09/12 15:05:50 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:48 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -60,7 +64,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
|
||||
@ -69,7 +73,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
|
||||
@ -109,16 +113,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
|
||||
|
148
sys/cfs/cfsnc.h
148
sys/cfs/cfsnc.h
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cfsnc.h,v 1.2 1998/09/08 17:12:48 rvb Exp $ */
|
||||
/* $NetBSD: cfsnc.h,v 1.3 1998/09/12 15:05:50 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -47,6 +47,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: cfsnc.h,v $
|
||||
* Revision 1.3 1998/09/12 15:05:50 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:48 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -66,7 +70,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
|
||||
@ -84,7 +88,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)
|
||||
*
|
||||
@ -92,7 +96,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
|
||||
@ -101,20 +105,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
|
||||
@ -132,15 +136,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.
|
||||
@ -152,14 +156,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))
|
||||
|
||||
@ -169,82 +173,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;
|
||||
@ -265,18 +269,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 /* _CFSNC_HEADER_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cnode.h,v 1.2 1998/09/08 17:12:49 rvb Exp $ */
|
||||
/* $NetBSD: cnode.h,v 1.3 1998/09/12 15:05:50 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -47,6 +47,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: cnode.h,v $
|
||||
* Revision 1.3 1998/09/12 15:05:50 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:49 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -72,7 +76,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
|
||||
@ -106,7 +110,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
|
||||
@ -160,41 +164,41 @@
|
||||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
@ -239,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
|
||||
@ -286,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_ */
|
||||
|
||||
|
452
sys/cfs/coda.h
452
sys/cfs/coda.h
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda.h,v 1.2 1998/09/08 17:12:49 rvb Exp $ */
|
||||
/* $NetBSD: coda.h,v 1.3 1998/09/12 15:05:50 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_
|
||||
|
||||
|
||||
|
||||
@ -67,11 +67,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
|
||||
@ -100,10 +100,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))
|
||||
|
||||
/*
|
||||
@ -205,38 +205,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) +\
|
||||
@ -247,7 +247,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 */
|
||||
@ -257,53 +257,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;
|
||||
@ -311,64 +311,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;
|
||||
@ -376,188 +376,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;
|
||||
@ -566,83 +566,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;
|
||||
};
|
||||
|
||||
|
||||
@ -663,8 +663,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
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_opstats.h,v 1.2 1998/09/08 17:12:49 rvb Exp $ */
|
||||
/* $NetBSD: coda_opstats.h,v 1.3 1998/09/12 15:05:50 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 */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pioctl.h,v 1.2 1998/09/08 17:12:49 rvb Exp $ */
|
||||
/* $NetBSD: pioctl.h,v 1.3 1998/09/12 15:05:50 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -43,6 +43,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: pioctl.h,v $
|
||||
* Revision 1.3 1998/09/12 15:05:50 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:49 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -62,7 +66,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
|
||||
@ -80,7 +84,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.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cnode.h,v 1.2 1998/09/08 17:12:49 rvb Exp $ */
|
||||
/* $NetBSD: cnode.h,v 1.3 1998/09/12 15:05:50 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -47,6 +47,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: cnode.h,v $
|
||||
* Revision 1.3 1998/09/12 15:05:50 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:49 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -72,7 +76,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
|
||||
@ -106,7 +110,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
|
||||
@ -160,41 +164,41 @@
|
||||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
@ -239,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
|
||||
@ -286,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_ */
|
||||
|
||||
|
452
sys/coda/coda.h
452
sys/coda/coda.h
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda.h,v 1.2 1998/09/08 17:12:49 rvb Exp $ */
|
||||
/* $NetBSD: coda.h,v 1.3 1998/09/12 15:05:50 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_
|
||||
|
||||
|
||||
|
||||
@ -67,11 +67,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
|
||||
@ -100,10 +100,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))
|
||||
|
||||
/*
|
||||
@ -205,38 +205,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) +\
|
||||
@ -247,7 +247,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 */
|
||||
@ -257,53 +257,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;
|
||||
@ -311,64 +311,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;
|
||||
@ -376,188 +376,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;
|
||||
@ -566,83 +566,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;
|
||||
};
|
||||
|
||||
|
||||
@ -663,8 +663,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
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_io.h,v 1.2 1998/09/08 17:12:48 rvb Exp $ */
|
||||
/* $NetBSD: coda_io.h,v 1.3 1998/09/12 15:05:50 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -47,6 +47,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: coda_io.h,v $
|
||||
* Revision 1.3 1998/09/12 15:05:50 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:48 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -60,7 +64,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
|
||||
@ -69,7 +73,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
|
||||
@ -109,16 +113,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
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_namecache.c,v 1.2 1998/09/08 17:12:46 rvb Exp $ */
|
||||
/* $NetBSD: coda_namecache.c,v 1.3 1998/09/12 15:05:48 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -47,6 +47,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: coda_namecache.c,v $
|
||||
* Revision 1.3 1998/09/12 15:05:48 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:46 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -69,7 +73,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 +113,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 +129,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 +141,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 +164,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 +184,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 +207,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.
|
||||
@ -228,76 +232,76 @@
|
||||
* Declaration of the name cache data structure.
|
||||
*/
|
||||
|
||||
int cfsnc_use = 1; /* Indicate use of CFS Name Cache */
|
||||
int coda_nc_use = 1; /* Indicate use of CODA Name Cache */
|
||||
|
||||
int cfsnc_size = CFSNC_CACHESIZE; /* size of the cache */
|
||||
int cfsnc_hashsize = CFSNC_HASHSIZE; /* size of the primary hash */
|
||||
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 cfscache 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);
|
||||
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;
|
||||
@ -308,28 +312,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,
|
||||
@ -340,7 +344,7 @@ cfsnc_find(dcp, name, namelen, cred, hash)
|
||||
#endif
|
||||
}
|
||||
|
||||
return((struct cfscache *)0);
|
||||
return((struct coda_cache *)0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -348,52 +352,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);
|
||||
@ -414,11 +418,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(); )
|
||||
}
|
||||
|
||||
/*
|
||||
@ -426,22 +430,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);
|
||||
}
|
||||
|
||||
@ -450,25 +454,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); )
|
||||
|
||||
@ -476,8 +480,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;
|
||||
{
|
||||
/*
|
||||
@ -485,14 +489,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;
|
||||
}
|
||||
@ -508,15 +512,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;
|
||||
{
|
||||
@ -525,34 +529,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -562,35 +566,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -600,7 +604,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;
|
||||
@ -609,10 +613,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)); )
|
||||
|
||||
@ -622,7 +626,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;
|
||||
@ -630,31 +634,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 */
|
||||
/* 1.3 */
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -663,7 +667,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;
|
||||
{
|
||||
@ -675,30 +679,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -707,7 +711,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
|
||||
@ -721,21 +725,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))
|
||||
{
|
||||
@ -744,9 +748,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)
|
||||
@ -761,8 +765,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;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -773,16 +777,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,
|
||||
@ -792,42 +796,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;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -837,7 +841,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;
|
||||
{
|
||||
@ -845,44 +849,44 @@ 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];
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_namecache.h,v 1.2 1998/09/08 17:12:48 rvb Exp $ */
|
||||
/* $NetBSD: coda_namecache.h,v 1.3 1998/09/12 15:05:50 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -47,6 +47,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: coda_namecache.h,v $
|
||||
* Revision 1.3 1998/09/12 15:05:50 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:48 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -66,7 +70,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
|
||||
@ -84,7 +88,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)
|
||||
*
|
||||
@ -92,7 +96,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
|
||||
@ -101,20 +105,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
|
||||
@ -132,15 +136,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.
|
||||
@ -152,14 +156,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))
|
||||
|
||||
@ -169,82 +173,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;
|
||||
@ -265,18 +269,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 /* _CFSNC_HEADER_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_opstats.h,v 1.2 1998/09/08 17:12:49 rvb Exp $ */
|
||||
/* $NetBSD: coda_opstats.h,v 1.3 1998/09/12 15:05:50 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 */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_pioctl.h,v 1.2 1998/09/08 17:12:49 rvb Exp $ */
|
||||
/* $NetBSD: coda_pioctl.h,v 1.3 1998/09/12 15:05:50 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -43,6 +43,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: coda_pioctl.h,v $
|
||||
* Revision 1.3 1998/09/12 15:05:50 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:49 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -62,7 +66,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
|
||||
@ -80,7 +84,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.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_psdev.c,v 1.2 1998/09/08 17:12:47 rvb Exp $ */
|
||||
/* $NetBSD: coda_psdev.c,v 1.3 1998/09/12 15:05:48 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -52,6 +52,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: coda_psdev.c,v $
|
||||
* Revision 1.3 1998/09/12 15:05:48 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:47 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -80,7 +84,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
|
||||
@ -89,7 +93,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
|
||||
@ -142,7 +146,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
|
||||
@ -151,9 +155,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>
|
||||
#include <sys/kernel.h>
|
||||
@ -172,10 +176,11 @@ extern int cfsnc_initialized; /* Set if cache has been initialized */
|
||||
|
||||
#define CTL_C
|
||||
|
||||
int cfs_psdev_print_entry = 0;
|
||||
#define ENTRY if(cfs_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
|
||||
int coda_psdev_print_entry = 0;
|
||||
|
||||
void vcfsattach(int n);
|
||||
#define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
|
||||
|
||||
void vcodaattach(int n);
|
||||
int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p);
|
||||
int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p);
|
||||
int vc_nb_read(dev_t dev, struct uio *uiop, int flag);
|
||||
@ -198,9 +203,9 @@ struct vmsg {
|
||||
#define VM_WRITE 2
|
||||
#define VM_INTR 4
|
||||
|
||||
/* vcfsattach: do nothing */
|
||||
/* vcodaattach: do nothing */
|
||||
void
|
||||
vcfsattach(n)
|
||||
vcodaattach(n)
|
||||
int n;
|
||||
{
|
||||
}
|
||||
@ -219,13 +224,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);
|
||||
|
||||
@ -234,8 +239,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);
|
||||
}
|
||||
@ -249,15 +254,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))
|
||||
@ -274,7 +279,7 @@ vc_nb_close (dev, flag, mode, p)
|
||||
VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING;
|
||||
if (vfs_busy(mi->mi_vfsp, 0, 0))
|
||||
return (EBUSY);
|
||||
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",
|
||||
@ -288,9 +293,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;
|
||||
}
|
||||
|
||||
@ -320,10 +325,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 */
|
||||
@ -347,12 +352,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);
|
||||
}
|
||||
|
||||
@ -370,7 +375,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];
|
||||
@ -378,10 +383,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;
|
||||
@ -394,7 +399,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)) {
|
||||
@ -402,7 +407,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));
|
||||
@ -421,7 +426,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);
|
||||
@ -431,7 +436,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. */
|
||||
@ -473,22 +478,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);
|
||||
@ -511,10 +516,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)
|
||||
@ -531,7 +536,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
|
||||
@ -543,15 +548,15 @@ struct cfs_clstat cfs_clstat;
|
||||
*/
|
||||
|
||||
/* If you want this to be interruptible, set this to > PZERO */
|
||||
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;
|
||||
@ -568,27 +573,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);
|
||||
@ -605,7 +610,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
|
||||
@ -614,29 +619,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... */
|
||||
@ -647,7 +652,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);
|
||||
@ -658,29 +663,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! */
|
||||
@ -690,16 +695,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);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_subr.c,v 1.2 1998/09/08 17:12:47 rvb Exp $ */
|
||||
/* $NetBSD: coda_subr.c,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -46,6 +46,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: coda_subr.c,v $
|
||||
* Revision 1.3 1998/09/12 15:05:49 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:47 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -68,7 +72,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 +112,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 +127,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 +165,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 +200,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,15 +224,15 @@
|
||||
#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)
|
||||
|
||||
@ -238,22 +242,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));
|
||||
|
||||
@ -264,40 +268,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);
|
||||
@ -316,19 +320,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);
|
||||
@ -337,16 +341,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;
|
||||
{
|
||||
@ -365,16 +369,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,
|
||||
@ -392,21 +396,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -416,13 +420,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",
|
||||
@ -439,17 +443,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);
|
||||
}
|
||||
@ -460,7 +464,7 @@ cfs_unmounting(whoIam)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
cfs_checkunmounting(mp)
|
||||
coda_checkunmounting(mp)
|
||||
struct mount *mp;
|
||||
{
|
||||
register struct vnode *vp, *nvp;
|
||||
@ -482,28 +486,28 @@ loop:
|
||||
}
|
||||
|
||||
int
|
||||
cfs_cacheprint(whoIam)
|
||||
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(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
|
||||
|
||||
@ -511,17 +515,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.
|
||||
@ -529,7 +533,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)
|
||||
@ -539,38 +543,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,
|
||||
@ -585,20 +589,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,
|
||||
@ -612,44 +616,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)););
|
||||
@ -661,24 +665,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));
|
||||
@ -691,10 +695,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;
|
||||
@ -705,22 +709,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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_subr.h,v 1.2 1998/09/08 17:12:47 rvb Exp $ */
|
||||
/* $NetBSD: coda_subr.h,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -31,17 +31,17 @@
|
||||
* @(#) cfs/cfs_subr.h,v 1.1.1.1 1998/08/29 21:26:45 rvb Exp $
|
||||
*/
|
||||
|
||||
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);
|
||||
int cfs_checkunmounting(struct mount *mp);
|
||||
int 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);
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_venus.c,v 1.2 1998/09/08 17:12:47 rvb Exp $ */
|
||||
/* $NetBSD: coda_venus.c,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -46,10 +46,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
|
||||
|
||||
@ -63,29 +63,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); \
|
||||
@ -164,17 +164,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;
|
||||
}
|
||||
|
||||
@ -184,22 +184,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;
|
||||
}
|
||||
|
||||
@ -208,17 +208,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;
|
||||
}
|
||||
|
||||
@ -245,14 +245,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
|
||||
@ -265,17 +265,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) {
|
||||
@ -287,7 +287,7 @@ venus_ioctl(void *mdp, ViceFid *fid,
|
||||
}
|
||||
}
|
||||
|
||||
CFS_FREE(inp, cfs_ioctl_size);
|
||||
CODA_FREE(inp, coda_ioctl_size);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -296,19 +296,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;
|
||||
}
|
||||
|
||||
@ -316,17 +316,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;
|
||||
}
|
||||
|
||||
@ -334,17 +334,17 @@ 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;
|
||||
inp->flags = mode;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -353,23 +353,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;
|
||||
}
|
||||
|
||||
@ -377,16 +377,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;
|
||||
}
|
||||
|
||||
@ -396,24 +396,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;
|
||||
}
|
||||
|
||||
@ -423,12 +423,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<<6;
|
||||
@ -437,13 +437,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;
|
||||
}
|
||||
|
||||
@ -452,20 +452,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;
|
||||
}
|
||||
|
||||
@ -474,21 +474,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;
|
||||
}
|
||||
|
||||
@ -497,12 +497,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;
|
||||
|
||||
@ -512,9 +512,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;
|
||||
}
|
||||
|
||||
@ -524,25 +524,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;
|
||||
}
|
||||
|
||||
@ -551,20 +551,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;
|
||||
}
|
||||
|
||||
@ -573,12 +573,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);
|
||||
|
||||
@ -588,9 +588,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;
|
||||
}
|
||||
|
||||
@ -600,24 +600,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;
|
||||
}
|
||||
|
||||
@ -626,19 +626,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;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_vfsops.c,v 1.2 1998/09/08 17:12:47 rvb Exp $ */
|
||||
/* $NetBSD: coda_vfsops.c,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -28,7 +28,7 @@
|
||||
* improvements or extensions that they make, and to grant Carnegie
|
||||
* Mellon the rights to redistribute these changes without encumbrance.
|
||||
*
|
||||
* @(#) cfs/cfs_vfsops.c,v 1.1.1.1 1998/08/29 21:26:45 rvb Exp $
|
||||
* @(#) cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:26:45 rvb Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -47,6 +47,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: coda_vfsops.c,v $
|
||||
* Revision 1.3 1998/09/12 15:05:49 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:47 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -69,13 +73,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 +100,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 +138,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 +166,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.
|
||||
@ -178,7 +182,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <vcfs.h>
|
||||
#include <vcoda.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -198,65 +202,65 @@
|
||||
/* for VN_RDEV */
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
int cfsdebug = 0;
|
||||
int codadebug = 0;
|
||||
|
||||
int cfs_vfsop_print_entry = 0;
|
||||
#define ENTRY if(cfs_vfsop_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
|
||||
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 *));
|
||||
extern struct cdevsw cdevsw[]; /* For sanity check in cfs_mount */
|
||||
extern struct vnodeopv_desc cfs_vnodeop_opv_desc;
|
||||
extern struct cdevsw cdevsw[]; /* For sanity check in coda_mount */
|
||||
extern struct vnodeopv_desc coda_vnodeop_opv_desc;
|
||||
|
||||
struct vnodeopv_desc *cfs_vnodeopv_descs[] = {
|
||||
&cfs_vnodeop_opv_desc,
|
||||
struct vnodeopv_desc *coda_vnodeopv_descs[] = {
|
||||
&coda_vnodeop_opv_desc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct vfsops cfs_vfsops = {
|
||||
MOUNT_CFS,
|
||||
cfs_mount,
|
||||
cfs_start,
|
||||
cfs_unmount,
|
||||
cfs_root,
|
||||
cfs_quotactl,
|
||||
cfs_nb_statfs,
|
||||
cfs_sync,
|
||||
cfs_vget,
|
||||
struct vfsops coda_vfsops = {
|
||||
MOUNT_CODA,
|
||||
coda_mount,
|
||||
coda_start,
|
||||
coda_unmount,
|
||||
coda_root,
|
||||
coda_quotactl,
|
||||
coda_nb_statfs,
|
||||
coda_sync,
|
||||
coda_vget,
|
||||
(int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **,
|
||||
int *, struct ucred **))
|
||||
eopnotsupp,
|
||||
(int (*) (struct vnode *, struct fid *)) eopnotsupp,
|
||||
cfs_init,
|
||||
cfs_sysctl,
|
||||
coda_init,
|
||||
coda_sysctl,
|
||||
(int (*)(void)) eopnotsupp,
|
||||
cfs_vnodeopv_descs,
|
||||
coda_vnodeopv_descs,
|
||||
0
|
||||
};
|
||||
|
||||
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;
|
||||
@ -268,7 +272,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) */
|
||||
const char *path; /* path covered: ignored by the fs-layer */
|
||||
void *data; /* Need to define a data type for this in netbsd? */
|
||||
@ -278,7 +282,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;
|
||||
@ -286,12 +290,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);
|
||||
}
|
||||
|
||||
@ -302,18 +306,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);
|
||||
}
|
||||
|
||||
@ -322,54 +326,54 @@ 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);
|
||||
}
|
||||
|
||||
/* No initialization (here) of mi_vcomm! */
|
||||
vfsp->mnt_data = (qaddr_t)mi;
|
||||
vfsp->mnt_stat.f_fsid.val[0] = 0;
|
||||
vfsp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CFS);
|
||||
vfsp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CODA);
|
||||
mi->mi_vfsp = vfsp;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
@ -380,18 +384,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;
|
||||
@ -401,18 +405,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);
|
||||
}
|
||||
|
||||
@ -421,13 +425,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
|
||||
@ -440,9 +444,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);
|
||||
}
|
||||
@ -453,18 +457,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 +480,7 @@ cfs_root(vfsp, vpp)
|
||||
/* On Mach, this is vref. On NetBSD, VOP_LOCK */
|
||||
vref(*vpp);
|
||||
vn_lock(*vpp, LK_EXCLUSIVE);
|
||||
MARK_INT_SAT(CFS_ROOT_STATS);
|
||||
MARK_INT_SAT(CODA_ROOT_STATS);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
@ -488,34 +492,34 @@ 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;
|
||||
vref(*vpp);
|
||||
vn_lock(*vpp, LK_EXCLUSIVE);
|
||||
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;
|
||||
vref(*vpp);
|
||||
vn_lock(*vpp, LK_EXCLUSIVE);
|
||||
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;
|
||||
}
|
||||
@ -524,7 +528,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;
|
||||
@ -539,15 +543,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);
|
||||
}
|
||||
|
||||
@ -567,10 +571,10 @@ cfs_nb_statfs(vfsp, sbp, p)
|
||||
sbp->f_files = NB_SFS_SIZ;
|
||||
sbp->f_ffree = NB_SFS_SIZ;
|
||||
bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t));
|
||||
strncpy(sbp->f_fstypename, MOUNT_CFS, MFSNAMELEN-1);
|
||||
strncpy(sbp->f_fstypename, MOUNT_CODA, MFSNAMELEN-1);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -578,20 +582,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;
|
||||
@ -606,7 +610,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;
|
||||
@ -623,33 +627,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;
|
||||
{
|
||||
@ -658,13 +662,13 @@ cfs_vptofh(vnp, fidp)
|
||||
}
|
||||
|
||||
void
|
||||
cfs_init(void)
|
||||
coda_init(void)
|
||||
{
|
||||
ENTRY;
|
||||
}
|
||||
|
||||
int
|
||||
cfs_sysctl(name, namelen, oldp, oldlp, newp, newl, p)
|
||||
coda_sysctl(name, namelen, oldp, oldlp, newp, newl, p)
|
||||
int *name;
|
||||
u_int namelen;
|
||||
void *oldp;
|
||||
@ -700,7 +704,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;
|
||||
|
||||
@ -714,7 +718,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);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_vfsops.h,v 1.2 1998/09/08 17:12:48 rvb Exp $ */
|
||||
/* $NetBSD: coda_vfsops.h,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -45,20 +45,20 @@ struct cfid {
|
||||
|
||||
struct mount;
|
||||
|
||||
int cfs_vfsopstats_init(void);
|
||||
int cfs_mount(struct mount *, const char *, void *, struct nameidata *,
|
||||
int coda_vfsopstats_init(void);
|
||||
int coda_mount(struct mount *, const char *, void *, 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 *);
|
||||
void cfs_init(void);
|
||||
int cfs_sysctl(int *, u_int, void *, size_t *, void *, size_t,
|
||||
int coda_vptofh(struct vnode *, struct fid *);
|
||||
void coda_init(void);
|
||||
int coda_sysctl(int *, u_int, void *, size_t *, void *, size_t,
|
||||
struct proc *);
|
||||
int getNewVnode(struct vnode **vpp);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_vnops.h,v 1.2 1998/09/08 17:12:48 rvb Exp $ */
|
||||
/* $NetBSD: coda_vnops.h,v 1.3 1998/09/12 15:05:49 rvb Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -48,6 +48,10 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: coda_vnops.h,v $
|
||||
* Revision 1.3 1998/09/12 15:05:49 rvb
|
||||
* Change cfs/CFS in symbols, strings and constants to coda/CODA
|
||||
* to avoid fs conflicts.
|
||||
*
|
||||
* Revision 1.2 1998/09/08 17:12:48 rvb
|
||||
* Pass2 complete
|
||||
*
|
||||
@ -67,7 +71,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
|
||||
@ -76,13 +80,13 @@
|
||||
* 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
|
||||
*
|
||||
* Revision 1.2.34.2 97/11/20 11:46:54 rvb
|
||||
* Capture current cfs_venus
|
||||
* Capture current coda_venus
|
||||
*
|
||||
* Revision 1.2.34.1 97/11/13 22:03:04 rvb
|
||||
* pass2 cfs_NetBSD.h mt
|
||||
@ -91,46 +95,46 @@
|
||||
* 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 *));
|
||||
/* 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 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 coda_select __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 (**cfs_vnodeop_p)(void *);
|
||||
int cfs_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw,
|
||||
int (**coda_vnodeop_p)(void *);
|
||||
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);
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files,v 1.243 1998/09/08 17:19:03 rvb Exp $
|
||||
# $NetBSD: files,v 1.244 1998/09/12 15:05:47 rvb Exp $
|
||||
|
||||
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
|
||||
|
||||
@ -79,13 +79,13 @@ deffs fs_nfs.h NFS
|
||||
deffs NULLFS FDESC PORTAL UMAPFS PROCFS
|
||||
deffs fs_kernfs.h KERNFS # XXX
|
||||
deffs fs_union.h UNION
|
||||
deffs fs_cfs.h CFS
|
||||
deffs fs_coda.h CODA
|
||||
|
||||
# file system options
|
||||
defopt QUOTA
|
||||
|
||||
# Not entirely MI, but present on multiple arch's
|
||||
defopt opt_mbr.h COMPAT_386BSD_MBRPART
|
||||
defopt opt_mbr.h COMPAT_386BSD_MBRPART BIOS_VERBOSE
|
||||
|
||||
# debugging options
|
||||
defopt DDB
|
||||
@ -344,7 +344,7 @@ file dev/usb/ohci.c ohci
|
||||
pseudo-device vnd: disk
|
||||
pseudo-device ccd: disk
|
||||
pseudo-device md: disk
|
||||
pseudo-device vcfs
|
||||
pseudo-device vcoda
|
||||
|
||||
pseudo-device pty: tty
|
||||
pseudo-device tb: tty
|
||||
@ -365,12 +365,12 @@ file adosfs/adlookup.c adosfs
|
||||
file adosfs/adutil.c adosfs
|
||||
file adosfs/advfsops.c adosfs
|
||||
file adosfs/advnops.c adosfs
|
||||
file cfs/cfs_namecache.c cfs
|
||||
file cfs/cfs_psdev.c vcfs needs-count
|
||||
file cfs/cfs_subr.c cfs
|
||||
file cfs/cfs_venus.c cfs
|
||||
file cfs/cfs_vfsops.c cfs
|
||||
file cfs/cfs_vnodeops.c cfs
|
||||
file cfs/cfs_namecache.c coda
|
||||
file cfs/cfs_psdev.c vcoda needs-count
|
||||
file cfs/cfs_subr.c coda
|
||||
file cfs/cfs_venus.c coda
|
||||
file cfs/cfs_vfsops.c coda
|
||||
file cfs/cfs_vnodeops.c coda
|
||||
file ddb/db_access.c ddb | kgdb
|
||||
file ddb/db_aout.c ddb
|
||||
file ddb/db_break.c ddb
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: malloc.h,v 1.42 1998/08/14 03:29:49 mark Exp $ */
|
||||
/* $NetBSD: malloc.h,v 1.43 1998/09/12 15:05:48 rvb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
@ -139,7 +139,7 @@
|
||||
#define M_USB 87 /* USB general */
|
||||
#define M_USBDEV 88 /* USB permanent */
|
||||
#define M_POOL 89 /* memory pool structs */
|
||||
#define M_CFS 90 /* Coda file system structures and tables. */
|
||||
#define M_CODA 90 /* Coda file system structures and tables. */
|
||||
#define M_FILECOREMNT 91 /* Filcore FS mount structures */
|
||||
#define M_FILECORENODE 92 /* Filcore FS vnode private part */
|
||||
#define M_LAST 93 /* Must be last type + 1 */
|
||||
@ -235,7 +235,7 @@
|
||||
"USB", /* 87 M_USB */ \
|
||||
"USB device", /* 88 M_USBDEV */ \
|
||||
"Pool", /* 89 M_POOL */ \
|
||||
"cfs", /* 90 M_CFS */ \
|
||||
"coda", /* 90 M_CODA */ \
|
||||
"filecore mount", /* 91 M_FILECOREMNT */ \
|
||||
"filecore node", /* 92 M_FILECORENODE */ \
|
||||
NULL, /* 93 */ \
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mount.h,v 1.68 1998/08/14 03:28:56 mark Exp $ */
|
||||
/* $NetBSD: mount.h,v 1.69 1998/09/12 15:05:48 rvb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993
|
||||
@ -103,7 +103,8 @@ struct statfs {
|
||||
#define MOUNT_UNION "union" /* Union (translucent) Filesystem */
|
||||
#define MOUNT_ADOSFS "adosfs" /* AmigaDOS Filesystem */
|
||||
#define MOUNT_EXT2FS "ext2fs" /* Second Extended Filesystem */
|
||||
#define MOUNT_CFS "cfs" /* Coda Filesystem */
|
||||
#define MOUNT_CFS "coda" /* Coda Filesystem */
|
||||
#define MOUNT_CODA "coda" /* Coda Filesystem */
|
||||
#define MOUNT_FILECORE "filecore" /* Acorn Filecore Filesystem */
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vnode.h,v 1.55 1998/08/14 03:31:16 mark Exp $ */
|
||||
/* $NetBSD: vnode.h,v 1.56 1998/09/12 15:05:47 rvb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -71,7 +71,7 @@ enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
|
||||
enum vtagtype {
|
||||
VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_MSDOSFS, VT_LFS, VT_LOFS, VT_FDESC,
|
||||
VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS,
|
||||
VT_UNION, VT_ADOSFS, VT_EXT2FS, VT_CFS, VT_FILECORE
|
||||
VT_UNION, VT_ADOSFS, VT_EXT2FS, VT_CODA, VT_FILECORE
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user