afs_int32 trimlen;
struct dcache *tdc = 0;
afs_int32 error, trybusy = 1;
+#ifdef AFS_DARWIN80_ENV
+ uio_t tuiop;
+#else
struct uio tuio;
+ struct uio *tuiop = &tuio;
struct iovec *tvec;
+#endif
afs_int32 code;
struct vrequest treq;
}
#endif
+#ifndef AFS_DARWIN80_ENV
tvec = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec));
- totalLength = auio->afsio_resid;
- filePos = auio->afsio_offset;
+#endif
+ totalLength = AFS_UIO_RESID(auio);
+ filePos = AFS_UIO_OFFSET(auio);
afs_Trace4(afs_iclSetp, CM_TRACE_READ, ICL_TYPE_POINTER, avc,
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), ICL_TYPE_INT32,
totalLength, ICL_TYPE_OFFSET,
len = tlen;
if (len > AFS_ZEROS)
len = sizeof(afs_zeros); /* and in 0 buffer */
+#ifdef AFS_DARWIN80_ENV
+ trimlen = len;
+ tuiop = afsio_darwin_partialcopy(auio, trimlen);
+#else
afsio_copy(auio, &tuio, tvec);
trimlen = len;
afsio_trim(&tuio, trimlen);
- AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, &tuio, code);
+#endif
+ AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, tuiop, code);
if (code) {
error = code;
break;
/* get the data from the mem cache */
/* mung uio structure to be right for this transfer */
+#ifdef AFS_DARWIN80_ENV
+ trimlen = len;
+ tuiop = afsio_darwin_partialcopy(auio, trimlen);
+ uio_setoffset(tuiop, offset);
+#else
afsio_copy(auio, &tuio, tvec);
trimlen = len;
afsio_trim(&tuio, trimlen);
tuio.afsio_offset = offset;
+#endif
- code = afs_MemReadUIO(tdc->f.inode, &tuio);
+ code = afs_MemReadUIO(tdc->f.inode, tuiop);
if (code) {
error = code;
}
}
/* otherwise we've read some, fixup length, etc and continue with next seg */
- len = len - tuio.afsio_resid; /* compute amount really transferred */
+ len = len - AFS_UIO_RESID(tuiop); /* compute amount really transferred */
trimlen = len;
afsio_skip(auio, trimlen); /* update input uio structure */
totalLength -= len;
}
if (!noLock)
ReleaseReadLock(&avc->lock);
+#ifdef AFS_DARWIN80_ENV
+ uio_free(tuiop);
+#else
osi_FreeSmallSpace(tvec);
+#endif
error = afs_CheckCode(error, &treq, 10);
return error;
}
afs_int32 trimlen;
struct dcache *tdc = 0;
afs_int32 error;
+#ifdef AFS_DARWIN80_ENV
+ uio_t tuiop;
+#else
struct uio tuio;
+ struct uio *tuio = &tuio;
struct iovec *tvec;
+#endif
struct osi_file *tfile;
afs_int32 code;
int trybusy = 1;
}
#endif
+#ifndef AFS_DARWIN80_ENV
tvec = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec));
- totalLength = auio->afsio_resid;
- filePos = auio->afsio_offset;
+#endif
+ totalLength = AFS_UIO_RESID(auio);
+ filePos = AFS_UIO_OFFSET(auio);
afs_Trace4(afs_iclSetp, CM_TRACE_READ, ICL_TYPE_POINTER, avc,
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), ICL_TYPE_INT32,
totalLength, ICL_TYPE_OFFSET,
len = tlen;
if (len > AFS_ZEROS)
len = sizeof(afs_zeros); /* and in 0 buffer */
+#ifdef AFS_DARWIN80_ENV
+ trimlen = len;
+ tuiop = afsio_darwin_partialcopy(auio, trimlen);
+#else
afsio_copy(auio, &tuio, tvec);
trimlen = len;
afsio_trim(&tuio, trimlen);
- AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, &tuio, code);
+#endif
+ AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, tuiop, code);
if (code) {
error = code;
break;
#endif /* IHINT */
tfile = (struct osi_file *)osi_UFSOpen(tdc->f.inode);
+#ifdef AFS_DARWIN80_ENV
+ trimlen = len;
+ tuiop = afsio_darwin_partialcopy(auio, trimlen);
+ uio_setoffset(tuiop, offset);
+#else
/* mung uio structure to be right for this transfer */
afsio_copy(auio, &tuio, tvec);
trimlen = len;
afsio_trim(&tuio, trimlen);
tuio.afsio_offset = offset;
+#endif
+
#if defined(AFS_AIX41_ENV)
AFS_GUNLOCK();
code =
code = VOP_READ(tfile->vnode, &tuio, 0, afs_osi_credp);
VOP_UNLOCK(tfile->vnode, 0, current_proc());
AFS_GLOCK();
+#elif defined(AFS_DARWIN80_ENV)
+ AFS_GUNLOCK();
+ code = VOP_READ(tfile->vnode, tuiop, 0, afs_osi_ctxp);
+ AFS_GLOCK();
+#elif defined(AFS_DARWIN_ENV)
+ AFS_GUNLOCK();
+ VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc());
+ code = VOP_READ(tfile->vnode, &tuio, 0, afs_osi_credp);
+ VOP_UNLOCK(tfile->vnode, 0, current_proc());
+ AFS_GLOCK();
#elif defined(AFS_FBSD50_ENV)
AFS_GUNLOCK();
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, curthread);
}
}
/* otherwise we've read some, fixup length, etc and continue with next seg */
- len = len - tuio.afsio_resid; /* compute amount really transferred */
+ len = len - AFS_UIO_RESID(tuiop); /* compute amount really transferred */
trimlen = len;
afsio_skip(auio, trimlen); /* update input uio structure */
totalLength -= len;
if (!noLock)
ReleaseReadLock(&avc->lock);
+#ifdef AFS_DARWIN80_ENV
+ uio_free(tuiop);
+#else
osi_FreeSmallSpace(tvec);
+#endif
error = afs_CheckCode(error, &treq, 13);
return error;
}