#include <afsconfig.h>
#include "afs/param.h"
-RCSID
- ("$Header$");
#ifdef AFS_SGI62_ENV
#include "afs/sysincludes.h" /* Standard vendor system headers */
return EISDIR;
if (ioflag & IO_APPEND)
- uiop->uio_offset = avc->m.Length;
+ uiop->uio_offset = avc->f.m.Length;
#ifdef AFS_SGI64_ENV
#ifdef AFS_SGI65_ENV
if (!(ioflag & IO_ISLOCKED))
register struct vnode *vp = AFSTOV(avc);
struct buf *bp;
daddr_t bn;
- size_t acnt, cnt;
- int off, newoff;
- ssize_t bsize, rem, len;
+ off_t acnt, cnt;
+ off_t off, newoff;
+ off_t bsize, rem, len;
int error;
struct bmapval bmv[2];
int nmaps, didFakeOpen = 0;
if (uio->uio_resid <= 0) {
return (0);
}
- if (uio->uio_offset < 0 || (signed long)newoff < 0) {
+ if (uio->uio_offset < 0 || newoff < 0) {
return (EINVAL);
}
if (ioflag & IO_DIRECT)
if (rw == UIO_WRITE) {
ObtainWriteLock(&avc->lock, 330);
- avc->states |= CDirty;
+ avc->f.states |= CDirty;
ReleaseWriteLock(&avc->lock);
}
/*
* read/paging in a normal file
*/
- rem = avc->m.Length - (afs_int32) uio->uio_offset;
+ rem = avc->f.m.Length - uio->uio_offset;
if (rem <= 0)
/* EOF */
break;
ObtainWriteLock(&avc->lock, 90);
error = afs_DoPartialWrite(avc, &treq);
if (error == 0)
- avc->states |= CDirty;
+ avc->f.states |= CDirty;
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
if (error)
else
bp = chunkread(vp, bmv, 1, cr);
- avc->m.Date = osi_Time(); /* Set file date (for ranlib) */
+ avc->f.m.Date = osi_Time(); /* Set file date (for ranlib) */
}
if (bp->b_flags & B_ERROR) {
/*
* Since we compile -signed, b_error is a signed
- * char when it should ba an unsigned char.
+ * char when it should be an unsigned char.
* This can cause some errors codes to be interpreted
* as negative #s
*/
* Make sure it is at least as high as the last byte we just wrote
* into the buffer.
*/
- if (avc->m.Length < (afs_int32) uio->uio_offset) {
+ if (avc->f.m.Length < uio->uio_offset) {
AFS_GLOCK();
ObtainWriteLock(&avc->lock, 235);
- avc->m.Length = uio->uio_offset;
+ avc->f.m.Length = uio->uio_offset;
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
}
* explanation
*/
if (error) {
- if (avc->m.LinkCount == 0)
+ if (avc->f.m.LinkCount == 0)
cmn_err(CE_WARN,
"AFS: Process pid %d write error %d writing to unlinked file.",
OSI_GET_CURRENT_PID(), error);
}
}
} while (!error && uio->uio_resid > 0);
- afs_chkpgoob(&avc->v, btoc(avc->m.Length));
+ afs_chkpgoob(&avc->v, btoc(avc->f.m.Length));
AFS_GLOCK();
- if (rw == UIO_WRITE && error == 0 && (avc->states & CDirty)) {
+ if (rw == UIO_WRITE && error == 0 && (avc->f.states & CDirty)) {
ObtainWriteLock(&avc->lock, 405);
error = afs_DoPartialWrite(avc, &treq);
ReleaseWriteLock(&avc->lock);
#ifdef AFS_SGI61_ENV
if (((ioflag & IO_SYNC) || (ioflag & IO_DSYNC)) && (rw == UIO_WRITE)
&& !AFS_NFSXLATORREQ(cr)) {
- error = afs_fsync(avc, 0, cr);
+ error = afs_fsync(avc, 0, cr
+#ifdef AFS_SGI65_ENV
+ , 0, 0
+#endif
+ );
}
#else /* AFS_SGI61_ENV */
if ((ioflag & IO_SYNC) && (rw == UIO_WRITE) && !AFS_NFSXLATORREQ(cr)) {
bmv->bn = BTOBBT(offset - off);
bmv->offset = bmv->bn;
bmv->pboff = off;
- rem = avc->m.Length - offset;
+ rem = avc->f.m.Length - offset;
if (rem <= 0)
cnt = 0; /* EOF */
else
*/
ObtainReadLock(&avc->lock);
if (bp->b_flags & B_READ) {
- if (BBTOB(bp->b_blkno) >= avc->m.Length) {
+ if (BBTOB(bp->b_blkno) >= avc->f.m.Length) {
/* we are responsible for zero'ing the page */
caddr_t c;
c = bp_mapin(bp);
ReleaseReadLock(&avc->lock);
return;
}
- } else if ((avc->states & CWritingUFS) && (bp->b_flags & B_DELWRI)) {
+ } else if ((avc->f.states & CWritingUFS) && (bp->b_flags & B_DELWRI)) {
bp->b_ref = 3;
ReleaseReadLock(&avc->lock);
iodone(bp);
/* on last mapping push back and remove our reference */
osi_Assert(avc->execsOrWriters > 0);
osi_Assert(avc->opens > 0);
- if (avc->m.LinkCount == 0) {
+ if (avc->f.m.LinkCount == 0) {
ObtainWriteLock(&avc->lock, 238);
AFS_GUNLOCK();
PTOSSVP(vp, (off_t) 0, (off_t) MAXLONG);
if (code == VNOVNODE)
code = 0;
if (code) {
- afs_StoreWarn(code, avc->fid.Fid.Volume, /* /dev/console */
+ afs_StoreWarn(code, avc->f.fid.Fid.Volume, /* /dev/console */
1);
}
code = afs_CheckCode(code, &treq, 52);
/* at least one daemon is idle, so ask it to do the store.
* Also, note that we don't lock it any more... */
tb = afs_BQueue(BOP_STORE, avc, 0, 1, acred,
- (afs_size_t) acred->cr_uid, 0L, (void *)0);
+ (afs_size_t) afs_cr_uid(acred), 0L, (void *)0);
/* sleep waiting for the store to start, then retrieve error code */
while ((tb->flags & BUVALID) == 0) {
tb->flags |= BUWAIT;
AFS_RWLOCK(vp, VRWLOCK_WRITE);
AFS_GUNLOCK();
error =
- fs_map_subr(vp, (off_t) avc->m.Length, (u_int) avc->m.Mode, off, prp,
+ fs_map_subr(vp, (off_t) avc->f.m.Length, (u_int) avc->f.m.Mode, off, prp,
*addrp, len, prot, maxprot, flags, cr);
AFS_GLOCK();
AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
return VN_INACTIVE_CACHE;
}
- if (avc->states & CUnlinked) {
+ if (avc->f.states & CUnlinked) {
if (CheckLock(&afs_xvcache) || CheckLock(&afs_xdcache)) {
- avc->states |= CUnlinkedDel;
+ avc->f.states |= CUnlinkedDel;
ReleaseWriteLock(&avc->lock);
AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
} else {
}
return VN_INACTIVE_CACHE;
}
- if ((avc->states & CDirty) || (avc->execsOrWriters > 0)) {
+ if ((avc->f.states & CDirty) || (avc->execsOrWriters > 0)) {
/* File either already has dirty chunks (CDirty) or was mapped at
* time in its life with the potential for being written into.
* Note that afs_close defers storebacks if the vnode's ref count
if (mapcnt) {
cmn_err(CE_WARN,
"AFS: Failed to store FID (%x:%lu.%lu.%lu) in VOP_INACTIVE, error = %d\n",
- (int)(avc->fid.Cell) & 0xffffffff,
- avc->fid.Fid.Volume, avc->fid.Fid.Vnode,
- avc->fid.Fid.Unique, code);
+ (int)(avc->f.fid.Cell) & 0xffffffff,
+ avc->f.fid.Fid.Volume, avc->f.fid.Fid.Vnode,
+ avc->f.fid.Fid.Unique, code);
}
afs_InvalidateAllSegments(avc);
}
}
#endif
- osi_Assert((avc->states & (CCore | CMAPPED)) == 0);
+ osi_Assert((avc->f.states & (CCore | CMAPPED)) == 0);
if (avc->cred) {
crfree(avc->cred);
* If someone unlinked a file and this is the last hurrah -
* nuke all the pages.
*/
- if (avc->m.LinkCount == 0) {
+ if (avc->f.m.LinkCount == 0) {
AFS_GUNLOCK();
PTOSSVP(vp, (off_t) 0, (off_t) MAXLONG);
AFS_GLOCK();
}
#ifndef AFS_SGI65_ENV
osi_Assert(avc->mapcnt == 0);
- afs_chkpgoob(&avc->v, btoc(avc->m.Length));
+ afs_chkpgoob(&avc->v, btoc(avc->f.m.Length));
- avc->states &= ~CDirty; /* Give up on store-backs */
- if (avc->states & CUnlinked) {
+ avc->f.states &= ~CDirty; /* Give up on store-backs */
+ if (avc->f.states & CUnlinked) {
if (CheckLock(&afs_xvcache) || CheckLock(&afs_xdcache)) {
- avc->states |= CUnlinkedDel;
+ avc->f.states |= CUnlinkedDel;
} else {
afs_remunlink(avc, 1); /* ignore any return code */
}
osi_Assert(sizeof(fid_t) >= sizeof(afs_fid2_t));
afid->af_len = sizeof(afs_fid2_t) - sizeof(afid->af_len);
- tcell = afs_GetCell(avc->fid.Cell, READ_LOCK);
+ tcell = afs_GetCell(avc->f.fid.Cell, READ_LOCK);
afid->af_cell = tcell->cellIndex & 0xffff;
afs_PutCell(tcell, READ_LOCK);
- afid->af_volid = avc->fid.Fid.Volume;
- afid->af_vno = avc->fid.Fid.Vnode;
- afid->af_uniq = avc->fid.Fid.Unique;
+ afid->af_volid = avc->f.fid.Fid.Volume;
+ afid->af_vno = avc->f.fid.Fid.Vnode;
+ afid->af_uniq = avc->f.fid.Fid.Unique;
return 0;
}
#endif /* MP */
-#if defined(AFS_SGI62_ENV) && defined(AFS_SGI_DUAL_FS_CACHE)
-/* Support for EFS and XFS caches. The assumption here is that the size of
+/* Support for XFS caches. The assumption here is that the size of
* a cache file also does not exceed 32 bits.
*/
/* Initialized in osi_InitCacheFSType(). Used to determine inode type. */
-int afs_CacheFSType = -1;
-vnodeops_t *afs_efs_vnodeopsp;
vnodeops_t *afs_xfs_vnodeopsp;
-vnode_t *(*afs_IGetVnode) (ino_t);
-
-extern vnode_t *afs_EFSIGetVnode(ino_t); /* defined in osi_file.c */
-extern vnode_t *afs_XFSIGetVnode(ino_t); /* defined in osi_file.c */
extern afs_lock_t afs_xosi; /* lock is for tvattr */
-/* Initialize the cache operations. Called while initializing cache files. */
-void
-afs_InitDualFSCacheOps(struct vnode *vp)
-{
- static int inited = 0;
- struct vfssw *swp;
- int found = 0;
-
- if (inited)
- return;
- inited = 1;
-
-
-#ifdef AFS_SGI_EFS_IOPS_ENV
- swp = vfs_getvfssw("efs");
- if (swp) {
- afs_efs_vnodeopsp = swp->vsw_vnodeops;
- if (vp && vp->v_op == afs_efs_vnodeopsp) {
- afs_CacheFSType = AFS_SGI_EFS_CACHE;
- afs_IGetVnode = afs_EFSIGetVnode;
- found = 1;
- }
- }
-#endif /* AFS_SGI_EFS_IOPS_ENV */
-
- swp = vfs_getvfssw("xfs");
- if (swp) {
- afs_xfs_vnodeopsp = swp->vsw_vnodeops;
- if (!found) {
- if (vp && vp->v_op == afs_xfs_vnodeopsp) {
- afs_CacheFSType = AFS_SGI_XFS_CACHE;
- afs_IGetVnode = afs_XFSIGetVnode;
- found = 1;
- }
- }
- }
-
- if (vp && !found)
- osi_Panic("osi_InitCacheFSType: Can't find fstype for vnode 0x%llx\n",
- vp);
-}
-
ino_t
VnodeToIno(vnode_t * vp)
{
int code;
struct vattr vattr;
- MObtainWriteLock(&afs_xosi, 579);
+ ObtainWriteLock(&afs_xosi, 579);
vattr.va_mask = AT_FSID | AT_NODEID; /* quick return using this mask. */
AFS_GUNLOCK();
AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
if (code) {
osi_Panic("VnodeToIno");
}
- MReleaseWriteLock(&afs_xosi);
+ ReleaseWriteLock(&afs_xosi);
return vattr.va_nodeid;
}
int code;
struct vattr vattr;
- MObtainWriteLock(&afs_xosi, 580);
+ ObtainWriteLock(&afs_xosi, 580);
vattr.va_mask = AT_FSID | AT_NODEID; /* quick return using this mask. */
AFS_GUNLOCK();
AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
if (code) {
osi_Panic("VnodeToDev");
}
- MReleaseWriteLock(&afs_xosi);
+ ReleaseWriteLock(&afs_xosi);
return (dev_t) vattr.va_fsid;
}
int code;
struct vattr vattr;
- MObtainWriteLock(&afs_xosi, 581);
+ ObtainWriteLock(&afs_xosi, 581);
vattr.va_mask = AT_SIZE;
AFS_GUNLOCK();
AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
if (code) {
osi_Panic("VnodeToSize");
}
- MReleaseWriteLock(&afs_xosi);
+ ReleaseWriteLock(&afs_xosi);
return vattr.va_size;
}
-#endif /* 6.2 and dual fs cache */
#endif /* AFS_SGI62_ENV */