/* Exported variables */
struct osi_dev cacheDev; /*Cache device */
afs_int32 cacheInfoModTime; /*Last time cache info modified */
-#if defined(AFS_OSF_ENV) || defined(AFS_DEC_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
struct mount *afs_cacheVfsp = 0;
#elif defined(AFS_LINUX20_ENV)
struct super_block *afs_cacheSBp = 0;
* local value of @sys */
char *afs_sysnamelist[MAXNUMSYSNAMES]; /* For support of a list of sysname */
int afs_sysnamecount = 0;
+int afs_sysnamegen = 0;
struct volume *Initialafs_freeVolList;
int afs_memvolumes = 0;
-#ifdef AFS_OBSD_ENV
+#if defined(AFS_XBSD_ENV)
static struct vnode *volumeVnode;
#endif
+#if defined(AFS_DISCON_ENV)
+afs_rwlock_t afs_discon_lock;
+extern afs_rwlock_t afs_disconDirtyLock;
+#endif
/*
* Initialization order is important. Must first call afs_CacheInit,
LOCK_INIT(&afs_ftf, "afs_ftf");
RWLOCK_INIT(&afs_xaxs, "afs_xaxs");
+#ifdef AFS_DISCON_ENV
+ RWLOCK_INIT(&afs_discon_lock, "afs_discon_lock");
+ RWLOCK_INIT(&afs_disconDirtyLock, "afs_disconDirtyLock");
+ QInit(&afs_disconDirty);
+ QInit(&afs_disconShadow);
+#endif
osi_dnlc_init();
-
-#if defined(AFS_AIX32_ENV) || defined(AFS_HPUX_ENV)
- {
- afs_int32 preallocs;
-
- /*
- * We want to also reserve space for the gnode struct which is associated
- * with each vnode (vcache) one; we want to use the pinned pool for them
- * since they're referenced at interrupt level.
- */
- if (afs_stats_cmperf.SmallBlocksAlloced + astatSize < 3600)
- preallocs = astatSize;
- else {
- preallocs = 3600 - afs_stats_cmperf.SmallBlocksAlloced;
- if (preallocs <= 0)
- preallocs = 10;
- }
- osi_AllocMoreSSpace(preallocs);
- }
-#endif
/*
* create volume list structure
*/
if (aVolumes < 50)
aVolumes = 50;
- else if (aVolumes > 3000)
- aVolumes = 3000;
+ else if (aVolumes > 32767)
+ aVolumes = 32767;
tv = (struct volume *)afs_osi_Alloc(aVolumes * sizeof(struct volume));
for (i = 0; i < aVolumes - 1; i++)
#ifdef AFS_LINUX22_ENV
struct dentry *dp;
- code = gop_lookupname(filename, AFS_UIOSYS, 0, NULL, &dp);
+ code = gop_lookupname(filename, AFS_UIOSYS, 0, &dp);
if (code)
return code;
*inode = dp->d_inode->i_ino;
dput(dp);
#else
struct vnode *filevp;
- code = gop_lookupname(filename, AFS_UIOSYS, 0, NULL, &filevp);
+ code = gop_lookupname(filename, AFS_UIOSYS, 0, &filevp);
if (code)
return code;
*inode = afs_vnodeToInumber(filevp);
if (fvpp)
*fvpp = filevp;
else {
-#if defined(AFS_DEC_ENV)
- grele(filevp);
-#else
AFS_RELE(filevp);
-#endif
}
#endif /* AFS_LINUX22_ENV */
int
afs_InitCellInfo(char *afile)
{
- ino_t inode;
+ ino_t inode = 0;
int code;
+#if defined(LINUX_USE_FH)
+ struct fid fh;
+ int fh_type;
+ int max_len = sizeof(struct fid);
+ struct dentry *dp;
+#endif
+#ifdef AFS_CACHE_VNODE_PATH
+ return afs_cellname_init(AFS_CACHE_CELLS_INODE, code);
+#elif defined(LINUX_USE_FH)
+ code = gop_lookupname(afile, AFS_UIOSYS, 0, &dp);
+ fh_type = osi_get_fh(dp, &fh, &max_len);
+ return afs_cellname_init(&fh, fh_type, code);
+#else
code = LookupInodeByPath(afile, &inode, NULL);
return afs_cellname_init(inode, code);
+#endif
}
/*
{
int code;
struct osi_file *tfile;
+#if defined(LINUX_USE_FH)
+ int max_len = sizeof(struct fid);
+ struct dentry *dp;
+#endif
AFS_STATCNT(afs_InitVolumeInfo);
-#if defined(AFS_OBSD_ENV)
+#if defined(AFS_XBSD_ENV)
/*
- * On Open/NetBSD, we can get into big trouble if we don't hold the volume file
+ * On Open/Free/NetBSD, we can get into big trouble if we don't hold the volume file
* vnode. SetupVolume holds afs_xvolume lock exclusive.
* SetupVolume->GetVolSlot->UFSGetVolSlot->{GetVolCache or WriteVolCache}
* ->osi_UFSOpen->VFS_VGET()->ffs_vget->getnewvnode->vgone on some vnode.
* it in the cache...
*/
code = LookupInodeByPath(afile, &volumeInode, &volumeVnode);
+#elif defined(AFS_CACHE_VNODE_PATH)
+ volumeInode = AFS_CACHE_VOLUME_INODE;
+#elif defined(LINUX_USE_FH)
+ code = gop_lookupname(afile, AFS_UIOSYS, 0, &dp);
+ volumeinfo_fh_type = osi_get_fh(dp, &volumeinfo_fh, &max_len);
#else
code = LookupInodeByPath(afile, &volumeInode, NULL);
#endif
if (code)
return code;
+#if defined(LINUX_USE_FH)
+ tfile = osi_UFSOpen_fh(&volumeinfo_fh, volumeinfo_fh_type);
+#else
tfile = afs_CFileOpen(volumeInode);
+#endif
afs_CFileTruncate(tfile, 0);
afs_CFileClose(tfile);
return 0;
struct osi_stat tstat;
register struct osi_file *tfile;
struct afs_fheader theader;
+#ifndef AFS_LINUX22_ENV
struct vnode *filevp;
+#endif
int goodFile;
AFS_STATCNT(afs_InitCacheInfo);
if (code)
return code;
#else
- code = gop_lookupname(afile, AFS_UIOSYS, 0, NULL, &filevp);
+ code = gop_lookupname(afile, AFS_UIOSYS, 0, &filevp);
if (code || !filevp)
return ENOENT;
{
#if defined(AFS_SUN56_ENV)
struct statvfs64 st;
-#else
-#if defined(AFS_HPUX102_ENV)
+#elif defined(AFS_HPUX102_ENV)
struct k_statvfs st;
-#else
-#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) ||defined(AFS_HPUX100_ENV)
+#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) ||defined(AFS_HPUX100_ENV)
struct statvfs st;
-#else
-#if defined(AFS_DUX40_ENV)
+#elif defined(AFS_DUX40_ENV)
struct nstatfs st;
+#elif defined(AFS_DARWIN80_ENV)
+ struct vfsstatfs st;
#else
struct statfs st;
-#endif /* DUX40 */
-#endif /* SUN5 SGI */
-#endif /* HP 10.20 */
#endif /* SUN56 */
#if defined(AFS_SGI_ENV)
VFS_STATFS(filevp->v_vfsp, &st);
TO_KERNEL_SPACE();
}
+#elif defined(AFS_DARWIN80_ENV)
+ afs_cacheVfsp = vnode_mount(filevp);
+ if (afs_cacheVfsp && ((st = *(vfs_statfs(afs_cacheVfsp))),1))
#elif defined(AFS_DARWIN_ENV)
if (!VFS_STATFS(filevp->v_mount, &st, current_proc()))
#elif defined(AFS_FBSD50_ENV)
afs_fsfragsize = st.f_bsize - 1;
#endif
}
-#ifdef AFS_LINUX20_ENV
+#if defined(AFS_LINUX20_ENV)
cacheInode = filevp->i_ino;
afs_cacheSBp = filevp->i_sb;
-#else
-#ifdef AFS_OBSD_ENV
+#elif defined(AFS_XBSD_ENV)
cacheInode = VTOI(filevp)->i_number;
cacheDev.mp = filevp->v_mount;
cacheDev.held_vnode = filevp;
- AFS_HOLD(filevp); /* Make sure mount point stays busy. XXX */
+ vref(filevp); /* Make sure mount point stays busy. XXX */
+#if !defined(AFS_OBSD_ENV)
+ afs_cacheVfsp = filevp->v_vfsp;
+#endif
#else
#if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
afs_InitDualFSCacheOps(filevp);
#endif
+#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);
- afs_cacheVfsp = filevp->v_vfsp;
-#endif /* AFS_OBSD_ENV */
#endif /* AFS_LINUX20_ENV */
AFS_RELE(filevp);
#endif /* AFS_LINUX22_ENV */
+#if defined(LINUX_USE_FH)
+ tfile = osi_UFSOpen_fh(&cacheitems_fh, cacheitems_fh_type);
+#else
tfile = osi_UFSOpen(cacheInode);
+#endif
afs_osi_Stat(tfile, &tstat);
cacheInfoModTime = tstat.mtime;
code = afs_osi_Read(tfile, -1, &theader, sizeof(theader));
RWLOCK_INIT(&afs_icl_lock, "afs_icl_lock");
RWLOCK_INIT(&afs_xinterface, "afs_xinterface");
LOCK_INIT(&afs_puttofileLock, "afs_puttofileLock");
-#ifndef AFS_AIX32_ENV
+#ifndef AFS_FBSD_ENV
LOCK_INIT(&osi_fsplock, "osi_fsplock");
-#endif
LOCK_INIT(&osi_flplock, "osi_flplock");
+#endif
RWLOCK_INIT(&afs_xconn, "afs_xconn");
afs_CellInit();
afs_sysname = afs_sysnamelist[0];
strcpy(afs_sysname, SYS_NAME);
afs_sysnamecount = 1;
-#if defined(AFS_AIX32_ENV) || defined(AFS_HPUX_ENV)
- {
-
- if ((preallocs > 256) && (preallocs < 3600))
- afs_preallocs = preallocs;
- osi_AllocMoreSSpace(afs_preallocs);
- osi_AllocMoreMSpace(100);
- }
-#endif
+ afs_sysnamegen++;
}
secobj = rxnull_NewServerSecurityObject();
afs_cacheFiles = afs_cacheBlocks = 0;
pag_epoch = maxIHint = nihints = usedihint = 0;
pagCounter = 0;
-#ifdef AFS_OBSD_ENV
- AFS_RELE(volumeVnode); /* let it go, finally. */
+#if defined(AFS_XBSD_ENV)
+ vrele(volumeVnode); /* let it go, finally. */
volumeVnode = NULL;
if (cacheDev.held_vnode) {
- AFS_RELE(cacheDev.held_vnode);
+ vrele(cacheDev.held_vnode);
cacheDev.held_vnode = NULL;
}
#endif
+#if !defined(LINUX_USE_FH)
cacheInode = volumeInode = (ino_t) 0;
-
+#endif
cacheInfoModTime = 0;
afs_fsfragsize = 1023;
void
shutdown_vnodeops(void)
{
-#if !defined(AFS_SGI_ENV) && !defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
+#if !defined(AFS_SGI_ENV) && !defined(AFS_SUN5_ENV)
struct buf *afs_bread_freebp = 0;
#endif
#ifndef AFS_LINUX20_ENV
afs_rd_stash_i = 0;
#endif
-#if !defined(AFS_SGI_ENV) && !defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
+#if !defined(AFS_SGI_ENV) && !defined(AFS_SUN5_ENV)
afs_bread_freebp = 0;
#endif
shutdown_mariner();
*/
{
struct server *ts, *nts;
- struct conn *tc, *ntc;
+ struct afs_conn *tc, *ntc;
register struct afs_cbr *tcbrp, *tbrp;
for (i = 0; i < NSERVERS; i++) {
AFS_GUNLOCK();
rx_DestroyConnection(tc->id);
AFS_GLOCK();
- afs_osi_Free(tc, sizeof(struct conn));
+ afs_osi_Free(tc, sizeof(struct afs_conn));
tc = ntc;
}
}
LOCK_INIT(&afs_puttofileLock, "afs_puttofileLock");
shutdown_cell();
+ shutdown_server();
}
}