code = 0;
offset = (int) fp->f_pos;
while (1) {
- dirpos = BlobScan(&tdc->f.inode, offset);
+ dirpos = BlobScan(&tdc->f, offset);
if (!dirpos)
break;
- de = afs_dir_GetBlob(&tdc->f.inode, dirpos);
+ de = afs_dir_GetBlob(&tdc->f, dirpos);
if (!de)
break;
if (tdc) {
/* see if file already exists. If it does, we only set
* the size attributes (to handle O_TRUNC) */
- code = afs_dir_Lookup(&tdc->f.inode, aname, &newFid.Fid); /* use dnlc first xxx */
+ code = afs_dir_Lookup(&tdc->f, aname, &newFid.Fid); /* use dnlc first xxx */
if (code == 0) {
ReleaseSharedLock(&tdc->lock);
afs_PutDCache(tdc);
UpgradeSToWLock(&tdc->lock, 631);
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
- code = afs_dir_Create(&tdc->f.inode, aname, &newFid.Fid);
+ code = afs_dir_Create(&tdc->f, aname, &newFid.Fid);
if (code) {
ZapDCE(tdc);
- DZap(&tdc->f.inode);
+ DZap(&tdc->f);
}
}
if (tdc) {
} else {
if (adc) {
ZapDCE(adc);
- DZap(&adc->f.inode);
+ DZap(&adc->f);
}
if (avc->states & CStatd) {
osi_dnlc_purgedp(avc);
ObtainWriteLock(&tdc->lock, 632);
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
- code = afs_dir_Create(&tdc->f.inode, aname, &newFid.Fid);
+ code = afs_dir_Create(&tdc->f, aname, &newFid.Fid);
if (code) {
ZapDCE(tdc); /* surprise error -- use invalid value */
- DZap(&tdc->f.inode);
+ DZap(&tdc->f);
}
}
if (tdc) {
struct VenusFid unlinkFid;
unlinkFid.Fid.Vnode = 0;
- code = afs_dir_Lookup(&tdc->f.inode, aname, &unlinkFid.Fid);
+ code = afs_dir_Lookup(&tdc->f, aname, &unlinkFid.Fid);
if (code == 0) {
afs_int32 cached = 0;
UpgradeSToWLock(&tdc->lock, 634);
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
- code = afs_dir_Delete(&tdc->f.inode, aname);
+ code = afs_dir_Delete(&tdc->f, aname);
if (code) {
ZapDCE(tdc); /* surprise error -- invalid value */
- DZap(&tdc->f.inode);
+ DZap(&tdc->f);
}
}
if (tdc) {
ObtainWriteLock(&tdc->lock, 635);
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
- code = afs_dir_Create(&tdc->f.inode, aname, &avc->fid.Fid);
+ code = afs_dir_Create(&tdc->f, aname, &avc->fid.Fid);
if (code) {
ZapDCE(tdc); /* surprise error -- invalid value */
- DZap(&tdc->f.inode);
+ DZap(&tdc->f);
}
}
if (tdc) {
/* look for first safe entry to examine in the directory. BlobScan
* looks for a the 1st allocated dir after the dirCookie slot.
*/
- newIndex = BlobScan(&dcp->f.inode, (dirCookie >> 5));
+ newIndex = BlobScan(&dcp->f, (dirCookie >> 5));
if (newIndex == 0)
break;
/* get a ptr to the dir entry */
dirEntryp =
- (struct DirEntry *)afs_dir_GetBlob(&dcp->f.inode, newIndex);
+ (struct DirEntry *)afs_dir_GetBlob(&dcp->f, newIndex);
if (!dirEntryp)
break;
{ /* sub-block just to reduce stack usage */
register struct dcache *tdc;
afs_size_t dirOffset, dirLen;
- ino_t theDir;
+ struct fcache *theDir;
struct VenusFid tfid;
/* now we have to lookup the next fid */
/* lookup the name in the appropriate dir, and return a cache entry
* on the resulting fid */
- theDir = tdc->f.inode;
+ theDir = &tdc->f;
code =
- afs_dir_LookupOffset(&theDir, sysState.name, &tfid.Fid,
+ afs_dir_LookupOffset(theDir, sysState.name, &tfid.Fid,
&dirCookie);
/* If the first lookup doesn't succeed, maybe it's got @sys in the name */
while (code == ENOENT && Next_AtSys(adp, &treq, &sysState))
code =
- afs_dir_LookupOffset(&theDir, sysState.name, &tfid.Fid,
+ afs_dir_LookupOffset(theDir, sysState.name, &tfid.Fid,
&dirCookie);
tname = sysState.name;
BlobScan is used by the Linux port in a separate file, so it should not
become static.
*/
-#if defined(AFS_SGI62_ENV) || defined(AFS_SUN57_64BIT_ENV)
int
-BlobScan(ino64_t * afile, afs_int32 ablob)
-#else
-#if defined(AFS_HPUX1123_ENV)
-/*DEE should use afs_inode_t for all */
-int
-BlobScan(ino_t * afile, afs_int32 ablob)
-#else
-#ifdef AFS_LINUX_64BIT_KERNEL
-int
-BlobScan(long *afile, afs_int32 ablob)
-#else
-int
-BlobScan(afs_int32 * afile, afs_int32 ablob)
-#endif
-#endif
-#endif
+BlobScan(struct fcache * afile, afs_int32 ablob)
{
register afs_int32 relativeBlob;
afs_int32 pageBlob;
origOffset = auio->afsio_offset;
/* scan for the next interesting entry scan for in-use blob otherwise up point at
* this blob note that ode, if non-zero, also represents a held dir page */
- if (!(us = BlobScan(&tdc->f.inode, (origOffset >> 5)))
- || !(nde = (struct DirEntry *)afs_dir_GetBlob(&tdc->f.inode, us))) {
+ if (!(us = BlobScan(&tdc->f, (origOffset >> 5)))
+ || !(nde = (struct DirEntry *)afs_dir_GetBlob(&tdc->f, us))) {
/* failed to setup nde, return what we've got, and release ode */
if (len) {
/* something to hand over. */
/* scan for the next interesting entry scan for in-use blob otherwise up point at
* this blob note that ode, if non-zero, also represents a held dir page */
- if (!(us = BlobScan(&tdc->f.inode, (origOffset >> 5)))
- || !(nde = (struct DirEntry *)afs_dir_GetBlob(&tdc->f.inode, us))) {
+ if (!(us = BlobScan(&tdc->f, (origOffset >> 5)))
+ || !(nde = (struct DirEntry *)afs_dir_GetBlob(&tdc->f, us))) {
/* failed to setup nde, return what we've got, and release ode */
if (len) {
/* something to hand over. */
UpgradeSToWLock(&tdc->lock, 637);
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
- code = afs_dir_Delete(&tdc->f.inode, aname);
+ code = afs_dir_Delete(&tdc->f, aname);
if (code) {
ZapDCE(tdc); /* surprise error -- invalid value */
- DZap(&tdc->f.inode);
+ DZap(&tdc->f);
}
}
if (tdc) {
* done the work */
if (!tvc)
if (tdc) {
- code = afs_dir_Lookup(&tdc->f.inode, aname, &unlinkFid.Fid);
+ code = afs_dir_Lookup(&tdc->f, aname, &unlinkFid.Fid);
if (code == 0) {
afs_int32 cached = 0;
}
if (code == 0)
- code = afs_dir_Lookup(&tdc1->f.inode, aname1, &fileFid.Fid);
+ code = afs_dir_Lookup(&tdc1->f, aname1, &fileFid.Fid);
if (code) {
if (tdc1) {
ReleaseWriteLock(&tdc1->lock);
if (!doLocally) {
if (tdc1) {
ZapDCE(tdc1);
- DZap(&tdc1->f.inode);
+ DZap(&tdc1->f);
}
if (tdc2) {
ZapDCE(tdc2);
- DZap(&tdc2->f.inode);
+ DZap(&tdc2->f);
}
}
}
/* now really do the work */
if (doLocally) {
/* first lookup the fid of the dude we're moving */
- code = afs_dir_Lookup(&tdc1->f.inode, aname1, &fileFid.Fid);
+ code = afs_dir_Lookup(&tdc1->f, aname1, &fileFid.Fid);
if (code == 0) {
/* delete the source */
- code = afs_dir_Delete(&tdc1->f.inode, aname1);
+ code = afs_dir_Delete(&tdc1->f, aname1);
}
/* first see if target is there */
if (code == 0
- && afs_dir_Lookup(&tdc2->f.inode, aname2,
+ && afs_dir_Lookup(&tdc2->f, aname2,
&unlinkFid.Fid) == 0) {
/* target already exists, and will be unlinked by server */
- code = afs_dir_Delete(&tdc2->f.inode, aname2);
+ code = afs_dir_Delete(&tdc2->f, aname2);
}
if (code == 0) {
- code = afs_dir_Create(&tdc2->f.inode, aname2, &fileFid.Fid);
+ code = afs_dir_Create(&tdc2->f, aname2, &fileFid.Fid);
}
if (code != 0) {
ZapDCE(tdc1);
- DZap(&tdc1->f.inode);
+ DZap(&tdc1->f);
if (!oneDir) {
ZapDCE(tdc2);
- DZap(&tdc2->f.inode);
+ DZap(&tdc2->f);
}
}
}
if (tdc1) {
ObtainWriteLock(&tdc1->lock, 648);
ZapDCE(tdc1); /* mark as unknown */
- DZap(&tdc1->f.inode);
+ DZap(&tdc1->f);
ReleaseWriteLock(&tdc1->lock);
afs_PutDCache(tdc1); /* put it back */
}
/* otherwise, we should see if we can make the change to the dir locally */
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
- code = afs_dir_Create(&tdc->f.inode, aname, &newFid.Fid);
+ code = afs_dir_Create(&tdc->f, aname, &newFid.Fid);
if (code) {
ZapDCE(tdc); /* surprise error -- use invalid value */
- DZap(&tdc->f.inode);
+ DZap(&tdc->f);
}
}
if (tdc) {
extern int afs_fakestat_enable;
struct buffer {
- ino_t fid[1]; /* Unique cache key + i/o addressing */
+ struct fcache *fid;
afs_int32 page;
afs_int32 accesstime;
struct buffer *hashNext;
/* page hash table size - this is pretty intertwined with pHash */
#define PHSIZE (PHPAGEMASK + PHFIDMASK + 1)
/* the pHash macro */
-#define pHash(fid,page) ((((afs_int32)((fid)[0])) & PHFIDMASK) \
+#define pHash(fid,page) ((((afs_int32)((fid)->inode)) & PHFIDMASK) \
| (page & PHPAGEMASK))
#ifdef dirty
static afs_int32 timecounter;
/* Prototypes for static routines */
-static struct buffer *afs_newslot(afs_inode_t * afid, afs_int32 apage,
+static struct buffer *afs_newslot(struct fcache * afid, afs_int32 apage,
register struct buffer *lp);
static int dinit_flag = 0;
}
void *
-DRead(register afs_inode_t * fid, register int page)
+DRead(register struct fcache * fid, register int page)
{
/* Read a page from the disk. */
register struct buffer *tb, *tb2;
MObtainWriteLock(&tb->lock, 260);
MReleaseWriteLock(&afs_bufferLock);
tb->lockers++;
- tfile = afs_CFileOpen(fid[0]);
- if (page * AFS_BUFFER_PAGESIZE >= tfile->size) {
+ if (page * AFS_BUFFER_PAGESIZE >= fid->chunkBytes) {
dirp_Zap(tb->fid);
tb->lockers--;
MReleaseWriteLock(&tb->lock);
- afs_CFileClose(tfile);
return NULL;
}
+ tfile = afs_CFileOpen(fid->inode);
code =
afs_CFileRead(tfile, tb->page * AFS_BUFFER_PAGESIZE, tb->data,
AFS_BUFFER_PAGESIZE);
/* lp is pointer to a fairly-old buffer */
static struct buffer *
-afs_newslot(afs_inode_t * afid, afs_int32 apage, register struct buffer *lp)
+afs_newslot(struct fcache * afid, afs_int32 apage, register struct buffer *lp)
{
/* Find a usable buffer slot */
register afs_int32 i;
}
if (lp->dirty) {
- tfile = afs_CFileOpen(lp->fid[0]);
+ tfile = afs_CFileOpen(lp->fid->inode);
afs_CFileWrite(tfile, lp->page * AFS_BUFFER_PAGESIZE, lp->data,
AFS_BUFFER_PAGESIZE);
lp->dirty = 0;
* method of DRead...
*/
void
-DZap(afs_inode_t * fid)
+DZap(struct fcache * fid)
{
register int i;
/* Destroy all buffers pertaining to a particular fid. */
tb->lockers++;
MReleaseReadLock(&afs_bufferLock);
if (tb->dirty) {
- tfile = afs_CFileOpen(tb->fid[0]);
+ tfile = afs_CFileOpen(tb->fid->inode);
afs_CFileWrite(tfile, tb->page * AFS_BUFFER_PAGESIZE,
tb->data, AFS_BUFFER_PAGESIZE);
tb->dirty = 0; /* Clear the dirty flag */
}
void *
-DNew(register afs_inode_t * fid, register int page)
+DNew(register struct fcache * fid, register int page)
{
/* Same as read, only do *not* even try to read the page, since it probably doesn't exist. */
register struct buffer *tb;
AFS_STATCNT(afs_glink);
#endif
/* we know this guy's in the LRUQ. We'll move dude into DCQ below */
- DZap(&adc->f.inode);
+ DZap(&adc->f);
/* if this guy is in the hash table, pull him out */
if (adc->f.fid.Fid.Volume != 0) {
/* remove entry from first hash chains */
* Right now, we only have one tool, and it's a hammer. So, we
* fetch the whole file.
*/
- DZap(&tdc->f.inode); /* pages in cache may be old */
+ DZap(&tdc->f); /* pages in cache may be old */
#ifdef IHINT
if (file = tdc->ihint) {
if (tdc->f.inode == file->inum)
afs_CFileClose(file);
ZapDCE(tdc); /* sets DFEntryMod */
if (vType(avc) == VDIR) {
- DZap(&tdc->f.inode);
+ DZap(&tdc->f);
}
ReleaseWriteLock(&tdc->lock);
afs_PutDCache(tdc);
* The following three routines provide the fid routines used by the buffer
* and directory packages.
*/
-#define dirp_Zap(afid) (*(afid) = -1)
-#define dirp_Eq(afid, bfid) (*(afid) == *(bfid))
-#define dirp_Cpy(dfid,sfid) (*(dfid) = *(sfid))
+#define dirp_Zap(afid) ((afid) = 0)
+#define dirp_Eq(afid, bfid) ((afid) == (bfid))
+#define dirp_Cpy(dfid,sfid) ((dfid) = (sfid))
/*
Check_AtSys(avc, ain, &sysState, areq);
ObtainReadLock(&tdc->lock);
do {
- code = afs_dir_Lookup(&tdc->f.inode, sysState.name, &tfid.Fid);
+ code = afs_dir_Lookup(&tdc->f, sysState.name, &tfid.Fid);
} while (code == ENOENT && Next_AtSys(avc, areq, &sysState));
ReleaseReadLock(&tdc->lock);
afs_PutDCache(tdc); /* we're done with the data */
Check_AtSys(avc, ain, &sysState, areq);
ObtainReadLock(&tdc->lock);
do {
- code = afs_dir_Lookup(&tdc->f.inode, sysState.name, &tfid.Fid);
+ code = afs_dir_Lookup(&tdc->f, sysState.name, &tfid.Fid);
} while (code == ENOENT && Next_AtSys(avc, areq, &sysState));
ReleaseReadLock(&tdc->lock);
bufp = sysState.name;
ObtainWriteLock(&tdc->lock, 661);
if (afs_LocalHero(avc, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
- code = afs_dir_Delete(&tdc->f.inode, bufp);
+ code = afs_dir_Delete(&tdc->f, bufp);
if (code) {
ZapDCE(tdc); /* surprise error -- invalid value */
- DZap(&tdc->f.inode);
+ DZap(&tdc->f);
}
}
ReleaseWriteLock(&tdc->lock);
Check_AtSys(avc, ain, &sysState, areq);
ObtainReadLock(&tdc->lock);
do {
- code = afs_dir_Lookup(&tdc->f.inode, sysState.name, &tfid.Fid);
+ code = afs_dir_Lookup(&tdc->f, sysState.name, &tfid.Fid);
} while (code == ENOENT && Next_AtSys(avc, areq, &sysState));
ReleaseReadLock(&tdc->lock);
afs_PutDCache(tdc); /* we're done with the data */
/* afs_buffer.c */
extern void DInit(int abuffers);
-extern void *DRead(register afs_inode_t * fid, register int page);
+extern void *DRead(register struct fcache * fid, register int page);
extern void DRelease(register struct buffer *bp, int flag);
extern int DVOffset(register void *ap);
-extern void DZap(afs_inode_t * fid);
+extern void DZap(struct fcache * fid);
extern void DFlush(void);
-extern void *DNew(register afs_inode_t * fid, register int page);
+extern void *DNew(register struct fcache * fid, register int page);
extern void shutdown_bufferpackage(void);
/* afs_call.c */
ObtainWriteLock(&tdc->lock, 679);
ZapDCE(tdc);
if (vType(avc) == VDIR)
- DZap(&tdc->f.inode);
+ DZap(&tdc->f);
ReleaseWriteLock(&tdc->lock);
afs_PutDCache(tdc);
}