* flag will already be clear, so we don't have to worry about
* clearing it twice. */
if (avc->f.states & CCore) {
+ afs_ucred_t *cred;
+
avc->f.states &= ~CCore;
#if defined(AFS_SGI_ENV)
osi_Assert(avc->opens > 0 && avc->execsOrWriters > 0);
avc->opens--;
avc->execsOrWriters--;
AFS_RELE(AFSTOV(avc)); /* VN_HOLD at set CCore(afs_FakeClose) */
- crfree((afs_ucred_t *)avc->linkData); /* "crheld" in afs_FakeClose */
+ cred = (afs_ucred_t *)avc->linkData; /* "crheld" in afs_FakeClose */
+ crfree(cred);
avc->linkData = NULL;
}
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
struct vnode *vp = AFSTOV(avc);
#endif
-#ifdef AFS_DARWIN80_ENV
- uio_t tuiop = NULL;
-#else
- struct uio tuio;
- struct uio *tuiop = &tuio;
- struct iovec *tvec; /* again, should have define */
-#endif
+ struct uio *tuiop = NULL;
afs_int32 code;
struct vrequest treq;
#else
if (aio & IO_APPEND) {
/* append mode, start it at the right spot */
-#if defined(AFS_SUN56_ENV)
+#if defined(AFS_SUN5_ENV)
auio->uio_loffset = 0;
#endif
filePos = avc->f.m.Length;
afs_FakeOpen(avc);
#endif
avc->f.states |= CDirty;
-#ifndef AFS_DARWIN80_ENV
- tvec = osi_AllocSmallSpace(sizeof(struct iovec));
-#endif
+
while (totalLength > 0) {
tdc = afs_ObtainDCacheForWriting(avc, filePos, totalLength, &treq,
noLock);
len = max - offset;
}
-#ifdef AFS_DARWIN80_ENV
if (tuiop)
- uio_free(tuiop);
- trimlen = len;
- tuiop = afsio_darwin_partialcopy(auio, trimlen);
-#else
- /* mung uio structure to be right for this transfer */
- afsio_copy(auio, &tuio, tvec);
+ afsio_free(tuiop);
trimlen = len;
- afsio_trim(&tuio, trimlen);
-#endif
+ tuiop = afsio_partialcopy(auio, trimlen);
AFS_UIO_SETOFFSET(tuiop, offset);
code = (*(afs_cacheType->vwriteUIO))(avc, &tdc->f.inode, tuiop);
avc->vc_error = error;
if (!noLock)
ReleaseWriteLock(&avc->lock);
-#ifdef AFS_DARWIN80_ENV
- uio_free(tuiop);
-#else
- osi_FreeSmallSpace(tvec);
-#endif
+ if (tuiop)
+ afsio_free(tuiop);
+
#ifndef AFS_VM_RDWR_ENV
/*
* If write is implemented via VM, afs_fsync() is called from the high-level
#endif
{
afs_int32 code;
+ afs_int32 code_checkcode = 0;
struct brequest *tb;
struct vrequest treq;
#ifdef AFS_SGI65_ENV
tb->flags |= BUWAIT;
afs_osi_Sleep(tb);
}
- code = tb->code;
+ code = tb->code_raw;
+ code_checkcode = tb->code_checkcode;
afs_BRelease(tb);
}
#endif
/* printf("avc->vc_error=%d\n", avc->vc_error); */
code = avc->vc_error;
+ code_checkcode = 0;
avc->vc_error = 0;
}
ReleaseWriteLock(&avc->lock);
}
AFS_DISCON_UNLOCK();
afs_PutFakeStat(&fakestat);
- code = afs_CheckCode(code, &treq, 5);
+
+ if (code_checkcode) {
+ code = code_checkcode;
+ } else {
+ code = afs_CheckCode(code, &treq, 5);
+ }
return code;
}
int
-#if defined(AFS_SGI_ENV) || defined(AFS_SUN53_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)
afs_fsync(OSI_VC_DECL(avc), int flag, afs_ucred_t *acred
# ifdef AFS_SGI65_ENV
, off_t start, off_t stop
# endif /* AFS_SGI65_ENV */
)
-#else /* !SUN53 && !SGI */
+#else /* !SUN5 && !SGI */
afs_fsync(OSI_VC_DECL(avc), afs_ucred_t *acred)
#endif
{