extern int cacheDiskType;
afs_int32 code = 0;
int dummy;
+ char fname[1024];
+ struct osi_stat tstat;
+
AFS_STATCNT(osi_UFSOpen);
if (cacheDiskType != AFS_FCACHE_TYPE_UFS) {
osi_Panic("UFSOpen called for non-UFS cache\n");
}
afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
AFS_GUNLOCK();
+#ifdef AFS_CACHE_VNODE_PATH
+ if (ainode < 0) {
+ switch (ainode) {
+ case AFS_CACHE_CELLS_INODE:
+ snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CellItems");
+ break;
+ case AFS_CACHE_ITEMS_INODE:
+ snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CacheItems");
+ break;
+ case AFS_CACHE_VOLUME_INODE:
+ snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "VolumeItems");
+ break;
+ default:
+ osi_Panic("Invalid negative inode");
+ }
+ } else {
+ dummy = ainode / afs_numfilesperdir;
+ snprintf(fname, 1024, "%s/D%d/V%d", afs_cachebasedir, dummy, ainode);
+ }
+
+ code = vnode_open(fname, O_RDWR, 0, 0, &vp, afs_osi_ctxtp);
+#else
#ifndef AFS_DARWIN80_ENV
if (afs_CacheFSType == AFS_APPL_HFS_CACHE)
code = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, &ainode, &vp, &va, &dummy); /* XXX hfs is broken */
else
panic("osi_UFSOpen called before cacheops initialized\n");
#endif
+#endif
AFS_GLOCK();
if (code) {
osi_FreeSmallSpace(afile);
osi_Panic("UFSOpen: igetinode failed");
}
afile->vnode = vp;
- afile->size = va.va_size;
afile->offset = 0;
afile->proc = (int (*)())0;
afile->inum = ainode; /* for hint validity checking */
+#ifndef AFS_CACHE_VNODE_PATH
+ afile->size = va.va_size;
+#else
+ code = afs_osi_Stat(afile, &tstat);
+ afile->size = tstat.size;
+#endif
return (void *)afile;
}
extern afs_int32 afs_gcpags;
extern afs_int32 afs_gcpags_procsize;
extern afs_int32 afs_bkvolpref;
+extern char afs_cachebasedir[1024];
+extern afs_int32 afs_numcachefiles;
+extern afs_int32 afs_numfilesperdir;
struct unixuser {
struct unixuser *next; /* next hash pointer */
extern struct interfaceAddr afs_cb_interface;
static int afs_RX_Running = 0;
static int afs_InitSetup_done = 0;
+afs_int32 afs_numcachefiles = -1;
+afs_int32 afs_numfilesperdir = -1;
+char afs_cachebasedir[1024];
afs_int32 afs_rx_deadtime = AFS_RXDEADTIME;
afs_int32 afs_rx_harddead = AFS_HARDDEADTIME;
}
#endif
+static void
+wait_for_cachedefs(void) {
+#ifdef AFS_CACHE_VNODE_PATH
+ while ((afs_numcachefiles < 1) || (afs_numfilesperdir < 1) ||
+ (afs_cachebasedir[0] != '/')) {
+ printf("afs: waiting for cache parameter definitions\n");
+ afs_osi_Sleep(&afs_initState);
+ }
+#endif
+}
+
/* leaving as is, probably will barf if we add prototypes here since it's likely being called
with partial list */
int
#ifdef AFS_DARWIN80_ENV
put_vfs_context();
#endif
+ } else if (parm == AFSOP_CACHEDIRS) {
+ afs_numfilesperdir = parm2;
+ afs_osi_Wakeup(&afs_initState);
+ } else if (parm == AFSOP_CACHEFILES) {
+ afs_numcachefiles = parm2;
+ afs_osi_Wakeup(&afs_initState);
} else if (parm == AFSOP_ROOTVOLUME) {
/* wait for basic init */
while (afs_initState < AFSOP_START_BKG)
code = 0;
} else if (parm == AFSOP_CACHEFILE || parm == AFSOP_CACHEINFO
|| parm == AFSOP_VOLUMEINFO || parm == AFSOP_AFSLOG
- || parm == AFSOP_CELLINFO) {
+ || parm == AFSOP_CELLINFO || parm == AFSOP_CACHEBASEDIR) {
char *tbuffer = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
code = 0;
#ifdef AFS_DARWIN80_ENV
get_vfs_context();
#endif
- if (parm == AFSOP_CACHEFILE)
+ if (parm == AFSOP_CACHEBASEDIR) {
+ strncpy(afs_cachebasedir, tbuffer, 1024);
+ afs_cachebasedir[1023] = '\0';
+ afs_osi_Wakeup(&afs_initState);
+ } else if (parm == AFSOP_CACHEFILE) {
+ wait_for_cachedefs();
code = afs_InitCacheFile(tbuffer, 0);
- else if (parm == AFSOP_CACHEINFO)
+ } else if (parm == AFSOP_CACHEINFO) {
+ wait_for_cachedefs();
code = afs_InitCacheInfo(tbuffer);
- else if (parm == AFSOP_VOLUMEINFO)
+ } else if (parm == AFSOP_VOLUMEINFO) {
+ wait_for_cachedefs();
code = afs_InitVolumeInfo(tbuffer);
- else if (parm == AFSOP_CELLINFO)
+ } else if (parm == AFSOP_CELLINFO) {
+ wait_for_cachedefs();
code = afs_InitCellInfo(tbuffer);
+ }
#ifdef AFS_DARWIN80_ENV
put_vfs_context();
#endif
}
osi_FreeSmallSpace(tbuffer);
} else if (parm == AFSOP_GO) {
+#ifdef AFS_CACHE_VNODE_PATH
+ afs_int32 dummy;
+
+ wait_for_cachedefs();
+
+#ifdef AFS_DARWIN80_ENV
+ get_vfs_context();
+#endif
+ if ((afs_numcachefiles > 0) && (afs_numfilesperdir > 0) &&
+ (afs_cachebasedir[0] == '/')) {
+ for (dummy = 0; dummy < afs_numcachefiles; dummy++) {
+ code = afs_InitCacheFile(NULL, dummy);
+ }
+ }
+#ifdef AFS_DARWIN80_ENV
+ put_vfs_context();
+#endif
+#endif
/* the generic initialization calls come here. One parameter: should we do the
* set-time operation on this workstation */
if (afs_Go_Done)
ino_t inode;
int code;
+#ifdef AFS_CACHE_VNODE_PATH
+ return afs_cellname_init(AFS_CACHE_CELLS_INODE, code);
+#else
code = LookupInodeByPath(afile, &inode, NULL);
return afs_cellname_init(inode, code);
+#endif
}
/*
* it in the cache...
*/
code = LookupInodeByPath(afile, &volumeInode, &volumeVnode);
+#elif defined(AFS_CACHE_VNODE_PATH)
+ volumeInode = AFS_CACHE_VOLUME_INODE;
#else
code = LookupInodeByPath(afile, &volumeInode, NULL);
#endif
#if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
afs_InitDualFSCacheOps(filevp);
#endif
- cacheInode = afs_vnodeToInumber(filevp);
- cacheDev.dev = afs_vnodeToDev(filevp);
+#ifndef AFS_CACHE_VNODE_PATH
#ifndef AFS_DARWIN80_ENV
afs_cacheVfsp = filevp->v_vfsp;
#endif
+ cacheInode = afs_vnodeToInumber(filevp);
+#else
+ cacheInode = AFS_CACHE_ITEMS_INODE;
+#endif
+ cacheDev.dev = afs_vnodeToDev(filevp);
#endif /* AFS_LINUX20_ENV */
AFS_RELE(filevp);
#endif /* AFS_LINUX22_ENV */
* -2: file exists in top-level
* >=0: file exists in Dxxx
*/
+#ifndef AFS_CACHE_VNODE_PATH
AFSD_INO_T *inode_for_V; /* Array of inodes for desired
* cache files */
+#endif
int missing_DCacheFile = 1; /*Is the DCACHEFILE missing? */
int missing_VolInfoFile = 1; /*Is the VOLINFOFILE missing? */
int missing_CellInfoFile = 1; /*Is the CELLINFOFILE missing? */
* file's inode, directory, and bump the number of files found
* total and in this directory.
*/
+#ifndef AFS_CACHE_VNODE_PATH
inode_for_V[vFileNum] = currp->d_ino;
+#endif
dir_for_V[vFileNum] = dirNum; /* remember this directory */
if (!maxDir) {
vFileNum);
else {
struct stat statb;
+#ifndef AFS_CACHE_VNODE_PATH
assert(inode_for_V[vFileNum] == (AFSD_INO_T) 0);
+#endif
sprintf(vFilePtr, "D%d/V%d", thisDir, vFileNum);
if (afsd_verbose)
printf("%s: Creating '%s'\n", rn, fullpn_VFile);
if (CreateCacheFile(fullpn_VFile, &statb))
printf("%s: Can't create '%s'\n", rn, fullpn_VFile);
else {
+#ifndef AFS_CACHE_VNODE_PATH
inode_for_V[vFileNum] = statb.st_ino;
+#endif
dir_for_V[vFileNum] = thisDir;
cache_dir_list[thisDir]++;
(*vFilesFound)++;
cacheStatEntries);
}
+#ifndef AFS_CACHE_VNODE_PATH
/*
* Create and zero the inode table for the desired cache files.
*/
if (afsd_debug)
printf("%s: %d inode_for_V entries at 0x%x, %d bytes\n", rn,
cacheFiles, inode_for_V, (cacheFiles * sizeof(AFSD_INO_T)));
+#endif
/*
* Set up all the pathnames we'll need for later.
rn, vFilesFound, cacheFiles, cacheIteration);
} while ((vFilesFound < cacheFiles)
&& (cacheIteration < MAX_CACHE_LOOPS));
+#ifdef AFS_CACHE_VNODE_PATH
+ if (afsd_debug)
+ printf
+ ("%s: Calling AFSOP_CACHEBASEDIR with '%s'\n",
+ rn, cacheBaseDir);
+ call_syscall(AFSOP_CACHEBASEDIR, cacheBaseDir);
+ if (afsd_debug)
+ printf
+ ("%s: Calling AFSOP_CACHEDIRS with %d dirs\n",
+ rn, nFilesPerDir);
+ call_syscall(AFSOP_CACHEDIRS, nFilesPerDir);
+ if (afsd_debug)
+ printf
+ ("%s: Calling AFSOP_CACHEFILES with %d files\n",
+ rn, cacheFiles);
+ call_syscall(AFSOP_CACHEFILES, cacheFiles);
+#endif
} else if (afsd_verbose)
printf("%s: Using memory cache, not swept\n", rn);
if (!(cacheFlags & AFSCALL_INIT_MEMCACHE))
call_syscall(AFSOP_VOLUMEINFO, fullpn_VolInfoFile);
+#ifndef AFS_CACHE_VNODE_PATH
/*
* Give the kernel the names of the AFS files cached on the workstation's
* disk.
call_syscall(AFSOP_CACHEINODE, inode_for_V[currVFile]);
#endif
}
-
+#endif
/*end for */
/*
/* For SGI, this can't interfere with any of the 64 bit inode calls. */
#define AFSOP_RXLISTENER_DAEMON 48 /* starts kernel RX listener */
+/* skip 64 bit calls */
+#define AFSOP_CACHEBASEDIR 50 /* cache base dir */
+#define AFSOP_CACHEDIRS 51 /* number of files per dir */
+#define AFSOP_CACHEFILES 52 /* number of files */
+
+#define AFSOP_SETINT 60 /* we should just set key/value pairs
+ for things which are just ints */
+
/* these are for initialization flags */
#define AFSCALL_INIT_MEMCACHE 0x1
#define SYSCALL_DEV_FNAME "/dev/openafs_ioctl"
#endif
+#ifdef AFS_CACHE_VNODE_PATH
+#define AFS_CACHE_CELLS_INODE -2
+#define AFS_CACHE_ITEMS_INODE -3
+#define AFS_CACHE_VOLUME_INODE -4
+#endif
+
#endif /* _AFS_ARGS_H_ */
#define AFS_SYSCALL 230
#define AFS_NAMEI_ENV 1
#define DARWIN_REFBASE 3
+#define AFS_CACHE_VNODE_PATH
/* File system entry (used if mount.h doesn't define MOUNT_AFS */
#define AFS_MOUNT_AFS "afs"
#define AFS_SYSCALL 230
#define AFS_NAMEI_ENV 1
#define DARWIN_REFBASE 3
+#define AFS_CACHE_VNODE_PATH
/* File system entry (used if mount.h doesn't define MOUNT_AFS */
#define AFS_MOUNT_AFS "afs"
else
echo /Network/afs:/var/db/openafs/cache:30000 > $PKGROOT/private/var/db/openafs/etc/cacheinfo.sample
fi
- if [ $majorvers -ge 9 ]; then
- echo '-memcache -afsdb -stat 2000 -dcache 800 -daemons 3 -volumes 70 -dynroot -fakestat-all' > $PKGROOT/private/var/db/openafs/etc/config/afsd.options.sample
- else
echo '-afsdb -stat 2000 -dcache 800 -daemons 3 -volumes 70 -dynroot -fakestat-all' > $PKGROOT/private/var/db/openafs/etc/config/afsd.options.sample
- fi
strip -X -S $PKGROOT/Library/OpenAFS/Tools/root.client/usr/vice/etc/afs.kext/Contents/MacOS/afs