code = 0;
offset = (int) fp->f_pos;
while (1) {
- dirpos = BlobScan(&tdc->f, offset);
+ dirpos = BlobScan(tdc, offset);
if (!dirpos)
break;
- de = afs_dir_GetBlob(&tdc->f, dirpos);
+ de = afs_dir_GetBlob(tdc, 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, aname, &newFid.Fid); /* use dnlc first xxx */
+ code = afs_dir_Lookup(tdc, 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, aname, &newFid.Fid);
+ code = afs_dir_Create(tdc, aname, &newFid.Fid);
if (code) {
ZapDCE(tdc);
- DZap(&tdc->f);
+ DZap(tdc);
}
}
if (tdc) {
} else {
if (adc) {
ZapDCE(adc);
- DZap(&adc->f);
+ DZap(adc);
}
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, aname, &newFid.Fid);
+ code = afs_dir_Create(tdc, aname, &newFid.Fid);
if (code) {
ZapDCE(tdc); /* surprise error -- use invalid value */
- DZap(&tdc->f);
+ DZap(tdc);
}
}
if (tdc) {
struct VenusFid unlinkFid;
unlinkFid.Fid.Vnode = 0;
- code = afs_dir_Lookup(&tdc->f, aname, &unlinkFid.Fid);
+ code = afs_dir_Lookup(tdc, 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, aname);
+ code = afs_dir_Delete(tdc, aname);
if (code) {
ZapDCE(tdc); /* surprise error -- invalid value */
- DZap(&tdc->f);
+ DZap(tdc);
}
}
if (tdc) {
ObtainWriteLock(&tdc->lock, 635);
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
- code = afs_dir_Create(&tdc->f, aname, &avc->fid.Fid);
+ code = afs_dir_Create(tdc, aname, &avc->fid.Fid);
if (code) {
ZapDCE(tdc); /* surprise error -- invalid value */
- DZap(&tdc->f);
+ DZap(tdc);
}
}
if (tdc) {
return 1;
}
-#if (defined(AFS_SGI62_ENV) || defined(AFS_SUN57_64BIT_ENV))
-extern int BlobScan(ino64_t * afile, afs_int32 ablob);
-#else
-#if defined(AFS_HPUX1123_ENV)
-/* DEE should use the new afs_inode_t for all */
-extern int BlobScan(ino_t * afile, afs_int32 ablob);
-#else
-#if defined AFS_LINUX_64BIT_KERNEL
-extern int BlobScan(long *afile, afs_int32 ablob);
-#else
-extern int BlobScan(afs_int32 * afile, afs_int32 ablob);
-#endif
-#endif
-#endif
-
+extern int BlobScan(struct dcache * afile, afs_int32 ablob);
/* called with an unlocked directory and directory cookie. Areqp
* describes who is making the call.
/* 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, (dirCookie >> 5));
+ newIndex = BlobScan(dcp, (dirCookie >> 5));
if (newIndex == 0)
break;
/* get a ptr to the dir entry */
dirEntryp =
- (struct DirEntry *)afs_dir_GetBlob(&dcp->f, newIndex);
+ (struct DirEntry *)afs_dir_GetBlob(dcp, newIndex);
if (!dirEntryp)
break;
{ /* sub-block just to reduce stack usage */
register struct dcache *tdc;
afs_size_t dirOffset, dirLen;
- 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;
code =
- afs_dir_LookupOffset(theDir, sysState.name, &tfid.Fid,
+ afs_dir_LookupOffset(tdc, 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(tdc, sysState.name, &tfid.Fid,
&dirCookie);
tname = sysState.name;
become static.
*/
int
-BlobScan(struct fcache * afile, afs_int32 ablob)
+BlobScan(struct dcache * 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, (origOffset >> 5)))
- || !(nde = (struct DirEntry *)afs_dir_GetBlob(&tdc->f, us))) {
+ if (!(us = BlobScan(tdc, (origOffset >> 5)))
+ || !(nde = (struct DirEntry *)afs_dir_GetBlob(tdc, 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, (origOffset >> 5)))
- || !(nde = (struct DirEntry *)afs_dir_GetBlob(&tdc->f, us))) {
+ if (!(us = BlobScan(tdc, (origOffset >> 5)))
+ || !(nde = (struct DirEntry *)afs_dir_GetBlob(tdc, 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, aname);
+ code = afs_dir_Delete(tdc, aname);
if (code) {
ZapDCE(tdc); /* surprise error -- invalid value */
- DZap(&tdc->f);
+ DZap(tdc);
}
}
if (tdc) {
* done the work */
if (!tvc)
if (tdc) {
- code = afs_dir_Lookup(&tdc->f, aname, &unlinkFid.Fid);
+ code = afs_dir_Lookup(tdc, aname, &unlinkFid.Fid);
if (code == 0) {
afs_int32 cached = 0;
}
if (code == 0)
- code = afs_dir_Lookup(&tdc1->f, aname1, &fileFid.Fid);
+ code = afs_dir_Lookup(tdc1, aname1, &fileFid.Fid);
if (code) {
if (tdc1) {
ReleaseWriteLock(&tdc1->lock);
if (!doLocally) {
if (tdc1) {
ZapDCE(tdc1);
- DZap(&tdc1->f);
+ DZap(tdc1);
}
if (tdc2) {
ZapDCE(tdc2);
- DZap(&tdc2->f);
+ DZap(tdc2);
}
}
}
/* now really do the work */
if (doLocally) {
/* first lookup the fid of the dude we're moving */
- code = afs_dir_Lookup(&tdc1->f, aname1, &fileFid.Fid);
+ code = afs_dir_Lookup(tdc1, aname1, &fileFid.Fid);
if (code == 0) {
/* delete the source */
- code = afs_dir_Delete(&tdc1->f, aname1);
+ code = afs_dir_Delete(tdc1, aname1);
}
/* first see if target is there */
if (code == 0
- && afs_dir_Lookup(&tdc2->f, aname2,
+ && afs_dir_Lookup(tdc2, aname2,
&unlinkFid.Fid) == 0) {
/* target already exists, and will be unlinked by server */
- code = afs_dir_Delete(&tdc2->f, aname2);
+ code = afs_dir_Delete(tdc2, aname2);
}
if (code == 0) {
- code = afs_dir_Create(&tdc2->f, aname2, &fileFid.Fid);
+ code = afs_dir_Create(tdc2, aname2, &fileFid.Fid);
}
if (code != 0) {
ZapDCE(tdc1);
- DZap(&tdc1->f);
+ DZap(tdc1);
if (!oneDir) {
ZapDCE(tdc2);
- DZap(&tdc2->f);
+ DZap(tdc2);
}
}
}
if (tdc1) {
ObtainWriteLock(&tdc1->lock, 648);
ZapDCE(tdc1); /* mark as unknown */
- DZap(&tdc1->f);
+ DZap(tdc1);
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, aname, &newFid.Fid);
+ code = afs_dir_Create(tdc, aname, &newFid.Fid);
if (code) {
ZapDCE(tdc); /* surprise error -- use invalid value */
- DZap(&tdc->f);
+ DZap(tdc);
}
}
if (tdc) {
extern int afs_fakestat_enable;
struct buffer {
- struct fcache *fid;
+ struct dcache *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)->inode)) & PHFIDMASK) \
+#define pHash(fid,page) ((((afs_int32)((fid)->f.inode)) & PHFIDMASK) \
| (page & PHPAGEMASK))
#ifdef dirty
static afs_int32 timecounter;
/* Prototypes for static routines */
-static struct buffer *afs_newslot(struct fcache * afid, afs_int32 apage,
+static struct buffer *afs_newslot(struct dcache * afid, afs_int32 apage,
register struct buffer *lp);
static int dinit_flag = 0;
}
void *
-DRead(register struct fcache * fid, register int page)
+DRead(register struct dcache * fid, register int page)
{
/* Read a page from the disk. */
register struct buffer *tb, *tb2;
MObtainWriteLock(&tb->lock, 260);
MReleaseWriteLock(&afs_bufferLock);
tb->lockers++;
- if (page * AFS_BUFFER_PAGESIZE >= fid->chunkBytes) {
+ if (page * AFS_BUFFER_PAGESIZE >= fid->f.chunkBytes) {
dirp_Zap(tb->fid);
tb->lockers--;
MReleaseWriteLock(&tb->lock);
return NULL;
}
- tfile = afs_CFileOpen(fid->inode);
+ tfile = afs_CFileOpen(fid->f.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(struct fcache * afid, afs_int32 apage, register struct buffer *lp)
+afs_newslot(struct dcache * 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->inode);
+ tfile = afs_CFileOpen(lp->fid->f.inode);
afs_CFileWrite(tfile, lp->page * AFS_BUFFER_PAGESIZE, lp->data,
AFS_BUFFER_PAGESIZE);
lp->dirty = 0;
* method of DRead...
*/
void
-DZap(struct fcache * fid)
+DZap(struct dcache * 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->inode);
+ tfile = afs_CFileOpen(tb->fid->f.inode);
afs_CFileWrite(tfile, tb->page * AFS_BUFFER_PAGESIZE,
tb->data, AFS_BUFFER_PAGESIZE);
tb->dirty = 0; /* Clear the dirty flag */
}
void *
-DNew(register struct fcache * fid, register int page)
+DNew(register struct dcache * 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;
MReleaseWriteLock(&afs_bufferLock);
return 0;
}
+ /* extend the chunk, if needed */
+ if ((page + 1) * AFS_BUFFER_PAGESIZE > fid->f.chunkBytes) {
+ afs_AdjustSize(fid, (page + 1) * AFS_BUFFER_PAGESIZE);
+ afs_WriteDCache(fid, 1);
+ }
MObtainWriteLock(&tb->lock, 265);
MReleaseWriteLock(&afs_bufferLock);
tb->lockers++;
AFS_STATCNT(afs_glink);
#endif
/* we know this guy's in the LRUQ. We'll move dude into DCQ below */
- DZap(&adc->f);
+ DZap(adc);
/* 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); /* pages in cache may be old */
+ DZap(tdc); /* 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);
+ DZap(tdc);
}
ReleaseWriteLock(&tdc->lock);
afs_PutDCache(tdc);
Check_AtSys(avc, ain, &sysState, areq);
ObtainReadLock(&tdc->lock);
do {
- code = afs_dir_Lookup(&tdc->f, sysState.name, &tfid.Fid);
+ code = afs_dir_Lookup(tdc, 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, sysState.name, &tfid.Fid);
+ code = afs_dir_Lookup(tdc, 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, bufp);
+ code = afs_dir_Delete(tdc, bufp);
if (code) {
ZapDCE(tdc); /* surprise error -- invalid value */
- DZap(&tdc->f);
+ DZap(tdc);
}
}
ReleaseWriteLock(&tdc->lock);
Check_AtSys(avc, ain, &sysState, areq);
ObtainReadLock(&tdc->lock);
do {
- code = afs_dir_Lookup(&tdc->f, sysState.name, &tfid.Fid);
+ code = afs_dir_Lookup(tdc, 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 struct fcache * fid, register int page);
+extern void *DRead(register struct dcache * fid, register int page);
extern void DRelease(register struct buffer *bp, int flag);
extern int DVOffset(register void *ap);
-extern void DZap(struct fcache * fid);
+extern void DZap(struct dcache * fid);
extern void DFlush(void);
-extern void *DNew(register struct fcache * fid, register int page);
+extern void *DNew(register struct dcache * 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);
+ DZap(tdc);
ReleaseWriteLock(&tdc->lock);
afs_PutDCache(tdc);
}