#include <kern/locks.h>
#else
#include <sys/lock.h>
+#include <sys/user.h>
#endif
#include <kern/thread.h>
-#include <sys/user.h>
#ifdef AFS_DARWIN80_ENV
#define getpid() proc_selfpid()
/* vcexcl - used only by afs_create */
enum vcexcl { EXCL, NONEXCL };
+#ifndef AFS_DARWIN80_ENV
+#define ifaddr_address_family(x) (x)->ifa_addr->sa_family
+#define ifaddr_address(x, y, z) memcpy(y, (x)->ifa_addr, z)
+#define ifaddr_netmask(x, y, z) memcpy(y, (x)->ifa_netmask, z)
+#define ifaddr_dstaddress(x, y, z) memcpy(y, (x)->ifa_dstaddr, z)
+#define ifaddr_ifnet(x) (x?(x)->ifa_ifp:0)
+#define ifnet_flags(x) (x?(x)->if_flags:0)
+#define ifnet_metric(x) (x?(x)->if_data.ifi_metric:0)
+#endif
+
#ifdef AFS_DARWIN80_ENV
#define vrele vnode_rele
#define vput vnode_put
#define vref vnode_ref
+#define vattr vnode_attr
+
+#define SetAfsVnode(vn) /* nothing; done in getnewvnode() */
+/* vnode_vfsfsprivate is not declared, so no macro for us */
+extern void * afs_fsprivate_data;
+static inline int IsAfsVnode(vnode_t vn) {
+ mount_t mp;
+ int res = 0;
+ mp = vnode_mount(vn);
+ if (mp) {
+ res = (vfs_fsprivate(mp) == &afs_fsprivate_data);
+ vfs_mountrelease(mp);
+ }
+ return res;
+}
#endif
/*
#ifndef AFS_DARWIN60_ENV
extern struct timeval time;
#endif
+#ifdef AFS_DARWIN80_ENV
+static inline time_t osi_Time(void) {
+ struct timeval _now;
+ microtime(&_now);
+ return _now.tv_sec;
+}
+#else
#define osi_Time() (time.tv_sec)
+#endif
#define afs_hz hz
#define PAGESIZE 8192
#define AFS_APPL_UFS_CACHE 1
#define AFS_APPL_HFS_CACHE 2
-extern ino_t VnodeToIno(vnode_t * vp);
-extern dev_t VnodeToDev(vnode_t * vp);
+extern ino_t VnodeToIno(struct vnode * vp);
+extern dev_t VnodeToDev(struct vnode * vp);
#define osi_curproc() current_proc()
/* FIXME */
#define osi_curcred() &afs_osi_cred
+#ifdef AFS_DARWIN80_ENV
+uio_t afsio_darwin_partialcopy(uio_t auio, int size);
+#endif
+
#endif /* KERNEL */
#endif /* _OSI_MACHDEP_H_ */
#include "afsincludes.h"
#include <sys/namei.h>
+#ifdef AFS_DARWIN80_ENV
+int
+osi_lookupname(char *aname, enum uio_seg seg, int followlink,
+ struct vnode **vpp) {
+ vfs_context_t ctx;
+ char tname[PATHBUFLEN];
+ int len, code, flags;
+
+ if (seg == AFS_UIOUSER) { /* XXX 64bit */
+ AFS_COPYINSTR(aname, tname, PATHBUFLEN, code);
+ if (code)
+ return code;
+ aname=tname;
+ }
+ flags = 0
+ if (!followlink)
+ flag |= VNODE_LOOKUP_NOFOLLOW;
+ ctx=vfs_context_create(NULL);
+ code = vnode_lookup(aname, flags, vpp, ctx);
+ vfs_context_rele(ctx);
+ return code;
+}
+#else
int
osi_lookupname(char *aname, enum uio_seg seg, int followlink,
struct vnode **vpp)
VOP_UNLOCK(n.ni_vp, 0, current_proc());
return 0;
}
+#endif
/*
* afs_suser() returns true if the caller is superuser, false otherwise.
*
* Note that it must NOT set errno.
*/
-
+int
afs_suser(void *credp)
{
int error;
struct proc *p = current_proc();
+#if AFS_DARWIN80_ENV
+ return proc_suser(p);
+#else
if ((error = suser(p->p_ucred, &p->p_acflag)) == 0) {
return (1);
}
return (0);
+#endif
+}
+
+#ifdef AFS_DARWIN80_ENV
+uio_t afsio_darwin_partialcopy(uio_t auio, int size) {
+ uio_t res;
+ int index;
+ user_addr_t iovaddr;
+ user_size_r iovsize;
+
+ /* XXX 64 bit userspaace? */
+ res = uio_create(uio_iovcnt(auio), uio_offset(auio),
+ uio_isuserspace(auio) ? UIO_USERSPACE32 : UIO_SYSSPACE32,
+ uio_rw(auio));
+
+ for (i = 0;i < uio_iovcnt(auio) && size > 0;i++) {
+ if (uio_getiov(auio, index, &iovaddr, &iovsize))
+ break;
+ if (iovsize > size)
+ iovsize = size;
+ if (uio_addiov(res, iovaddr, iovsize))
+ break;
+ size -= iovsize;
+ }
+ return res;
}
+#endif
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;
}
volatile
#endif
afs_int32 error;
+#ifdef AFS_DARWIN80_ENV
+ uio_t tuiop;
+#else
struct uio tuio;
+ struct uio *tuiop = &tuio;
struct iovec *tvec; /* again, should have define */
+#endif
register afs_int32 code;
struct vrequest treq;
* as will fit */
len = max - offset;
}
+
+#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
- code = afs_MemWriteUIO(tdc->f.inode, &tuio);
+ code = afs_MemWriteUIO(tdc->f.inode, tuiop);
if (code) {
void *mep; /* XXX in prototype world is struct memCacheEntry * */
error = code;
break;
}
/* otherwise we've written 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 */
tlen = len;
afsio_skip(auio, tlen); /* advance auio over data written */
/* compute new file size */
avc->vc_error = error;
if (!noLock)
ReleaseWriteLock(&avc->lock);
+#ifdef AFS_DARWIN80_ENV
+ uio_free(tuiop);
+#else
osi_FreeSmallSpace(tvec);
+#endif
error = afs_CheckCode(error, &treq, 6);
return error;
}
volatile
#endif
afs_int32 error;
+#ifdef AFS_DARWIN80_ENV
+ uio_t tuiop;
+#else
struct uio tuio;
+ struct uio *tuiop = &tuio;
struct iovec *tvec; /* again, should have define */
+#endif
struct osi_file *tfile;
register afs_int32 code;
struct vrequest treq;
#if defined(AFS_SUN56_ENV)
auio->uio_loffset = 0;
#endif
- filePos = auio->afsio_offset = avc->m.Length;
+ filePos = avc->m.Length;
+#ifdef AFS_DARWIN80_ENV
+ uio_setoffset(auio, avc->m.Length);
+#else
+ auio->afsio_offset = avc->m.Length;
+#endif
}
#endif
/*
afs_FakeOpen(avc);
#endif
avc->states |= CDirty;
+#ifndef AFS_DARWIN80_ENV
tvec = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec));
+#endif
while (totalLength > 0) {
/*
* The following line is necessary because afs_GetDCache with
* as will fit */
len = max - offset;
}
+
+#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 =
AFS_GUNLOCK();
code = osi_rdwr(tfile, &tuio, UIO_WRITE);
AFS_GLOCK();
+#elif defined(AFS_DARWIN80_ENV)
+ AFS_GUNLOCK();
+ code = VOP_WRITE(tfile->vnode, tuiop, 0, afs_osi_ctxtp);
+ AFS_GLOCK();
#elif defined(AFS_DARWIN_ENV)
AFS_GUNLOCK();
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc());
break;
}
/* otherwise we've written 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 */
tlen = len;
afsio_skip(auio, tlen); /* advance auio over data written */
/* compute new file size */
avc->vc_error = error;
if (!noLock)
ReleaseWriteLock(&avc->lock);
+#ifdef AFS_DARWIN80_ENV
+ uio_free(tuiop);
+#else
osi_FreeSmallSpace(tvec);
+#endif
#ifndef AFS_VM_RDWR_ENV
/*
* If write is implemented via VM, afs_fsync() is called from the high-level
a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */
a_result->cbExpires = tvc->cbExpires;
#ifdef AFS_DARWIN80_ENV
- a_result->refCount = vnode_isinuse(AFSTOV(tvc))?1:0; /* XXX fix */
+ a_result->refCount = vnode_isinuse(AFSTOV(tvc),0)?1:0; /* XXX fix */
#else
a_result->refCount = VREFCOUNT(tvc);
#endif
a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */
a_result->cbExpires = tvc->cbExpires;
#ifdef AFS_DARWIN80_ENV
- a_result->refCount = vnode_isinuse(AFSTOV(tvc))?1:0; /* XXX fix */
+ a_result->refCount = vnode_isinuse(AFSTOV(tvc),0)?1:0; /* XXX fix */
#else
a_result->refCount = VREFCOUNT(tvc);
#endif
VFS_STATFS(filevp->v_vfsp, &st);
TO_KERNEL_SPACE();
}
+#elif defined(AFS_DARWIN80_ENV)
+ afs_cacheVfsp = vnode_mount(filevp);
+ if (afs_cacheVfsp && !VFS_STATFS(afs_cacheVfsp, &st, current_proc()))
#elif defined(AFS_DARWIN_ENV)
if (!VFS_STATFS(filevp->v_mount, &st, current_proc()))
#elif defined(AFS_FBSD50_ENV)
#endif
cacheInode = afs_vnodeToInumber(filevp);
cacheDev.dev = afs_vnodeToDev(filevp);
+#ifndef AFS_DARWIN80_ENV
afs_cacheVfsp = filevp->v_vfsp;
+#endif
#endif /* AFS_LINUX20_ENV */
AFS_RELE(filevp);
#endif /* AFS_LINUX22_ENV */
{
register struct memCacheEntry *mceP =
(struct memCacheEntry *)afs_MemCacheOpen(blkno);
- int length = mceP->size - uioP->uio_offset;
+ int length = mceP->size - AFS_UIO_OFFSET(uioP);
afs_int32 code;
AFS_STATCNT(afs_MemReadUIO);
MObtainReadLock(&mceP->afs_memLock);
- length = (length < uioP->uio_resid) ? length : uioP->uio_resid;
- AFS_UIOMOVE(mceP->data + uioP->uio_offset, length, UIO_READ, uioP, code);
+ length = (length < AFS_UIO_RESID(uioP)) ? length : AFS_UIO_RESID(uioP);
+ AFS_UIOMOVE(mceP->data + AFS_UIO_OFFSET(uioP), length, UIO_READ, uioP, code);
MReleaseReadLock(&mceP->afs_memLock);
return code;
}
AFS_STATCNT(afs_MemWriteUIO);
MObtainWriteLock(&mceP->afs_memLock, 312);
- if (uioP->uio_resid + uioP->uio_offset > mceP->dataSize) {
+ if (AFS_UIO_RESID(uioP) + AFS_UIO_OFFSET(uioP) > mceP->dataSize) {
char *oldData = mceP->data;
- mceP->data = afs_osi_Alloc(uioP->uio_resid + uioP->uio_offset);
+ mceP->data = afs_osi_Alloc(AFS_UIO_RESID(uioP) + AFS_UIO_OFFSET(uioP));
AFS_GUNLOCK();
memcpy(mceP->data, oldData, mceP->size);
AFS_GLOCK();
afs_osi_Free(oldData, mceP->dataSize);
- mceP->dataSize = uioP->uio_resid + uioP->uio_offset;
+ mceP->dataSize = AFS_UIO_RESID(uioP) + AFS_UIO_OFFSET(uioP);
}
- if (mceP->size < uioP->uio_offset)
+ if (mceP->size < AFS_UIO_OFFSET(uioP))
memset(mceP->data + mceP->size, 0,
- (int)(uioP->uio_offset - mceP->size));
- AFS_UIOMOVE(mceP->data + uioP->uio_offset, uioP->uio_resid, UIO_WRITE,
+ (int)(AFS_UIO_OFFSET(uioP) - mceP->size));
+ AFS_UIOMOVE(mceP->data + AFS_UIO_OFFSET(uioP), AFS_UIO_RESID(uioP), UIO_WRITE,
uioP, code);
- if (uioP->uio_offset > mceP->size)
- mceP->size = uioP->uio_offset;
+ if (AFS_UIO_OFFSET(uioP) > mceP->size)
+ mceP->size = AFS_UIO_OFFSET(uioP);
MReleaseWriteLock(&mceP->afs_memLock);
return code;
curproc->p_flag |= SSYS;
#elif defined(AFS_HPUX101_ENV) && !defined(AFS_HPUX1123_ENV)
set_system_proc(u.u_procp);
+#elif defined(AFS_DARWIN80_ENV)
#elif defined(AFS_DARWIN_ENV)
/* maybe call init_process instead? */
current_proc()->p_flag |= P_SYSTEM;
}
#endif
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if (defined(AFS_DARWIN_ENV) && !defined(AFS_DARWIN80_ENV)) || defined(AFS_FBSD_ENV)
void
afs_osi_TraverseProcTable(void)
{
return rv;
}
+#elif defined(AFS_DARWIN80_ENV)
+const struct AFS_UCRED *
+afs_osi_proc2cred(AFS_PROC * pr)
+{
+ struct AFS_UCRED *rv = NULL;
+ static struct AFS_UCRED cr;
+ struct ucred *pcred;
+
+ if (pr == NULL) {
+ return NULL;
+ }
+ pcred = proc_ucred(pr);
+ cr.cr_ref = 1;
+ cr.cr_uid = pcred->cr_uid;
+ cr.cr_ngroups = pcred->cr_ngroups;
+ memcpy(cr.cr_groups, pcred->cr_groups,
+ NGROUPS * sizeof(gid_t));
+ return &cr;
+}
#elif defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
const struct AFS_UCRED *
afs_osi_proc2cred(AFS_PROC * pr)
/*
* Vnode related macros
*/
-#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_DARWIN80_ENV)
+#define vType(vc) vnode_vtype(AFSTOV(vc))
+#else
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
#define vSetVfsp(vc, vfsp) AFSTOV(vc)->v_mount = (vfsp)
#define vSetType(vc, type) AFSTOV(vc)->v_type = (type)
#define vType(vc) AFSTOV(vc)->v_type
-#else
-#define vType(vc) (vc)->v.v_type
-#define vSetType(vc,type) (vc)->v.v_type = (type)
-#define vSetVfsp(vc,vfsp) (vc)->v.v_vfsp = (vfsp)
-#endif
-
-#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
extern int (**afs_vnodeop_p) ();
#define IsAfsVnode(v) ((v)->v_op == afs_vnodeop_p)
#define SetAfsVnode(v) /* nothing; done in getnewvnode() */
#else
+#define vType(vc) (vc)->v.v_type
+#define vSetType(vc,type) (vc)->v.v_type = (type)
+#define vSetVfsp(vc,vfsp) (vc)->v.v_vfsp = (vfsp)
extern struct vnodeops *afs_ops;
#define IsAfsVnode(v) ((v)->v_op == afs_ops)
#define SetAfsVnode(v) (v)->v_op = afs_ops
#endif
+#endif
#ifdef AFS_SGI65_ENV
#define gop_lookupname(fnamep,segflg,followlink,compvpp) \
AFS_GLOCK(); \
} while(0)
+#if defined(AFS_DARWIN80_ENV)
+#define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE) \
+ do { \
+ int haveGlock = ISAFS_GLOCK(); \
+ if (haveGlock) \
+ AFS_GUNLOCK(); \
+ uio_setrw((UIO),(RW)); \
+ CODE = uiomove((SRC),(LEN),(UIO)); \
+ if (haveGlock) \
+ AFS_GLOCK(); \
+ } while(0)
+#else
#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
#define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE) \
do { \
AFS_GLOCK(); \
} while(0)
#endif
+#endif /* AFS_DARWIN80_ENV */
#else /* AFS_GLOBAL_SUNLOCK */
CODE = copyout((SRC),(DST),(LEN)); \
} while(0)
+#if defined(AFS_DARWIN80_ENV)
+#define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE) \
+ do { \
+ uio_setrw((UIO),(RW)); \
+ CODE = uiomove((SRC),(LEN),(UIO)); \
+ } while(0)
+#else /* AFS_OSF_ENV || AFS_FBSD_ENV */
#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
#define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE) \
do { \
CODE = uiomove((SRC),(LEN),(RW),(UIO)); \
} while(0)
#endif /* AFS_OSF_ENV || AFS_FBSD_ENV */
+#endif /* AFS_DARWIN80_ENV */
#endif /* AFS_GLOBAL_SUNLOCK */
+#ifdef AFS_DARWIN80_ENV
+#define AFS_UIO_OFFSET(uio) uio_offset(uio)
+#define AFS_UIO_RESID(uio) uio_resid(uio)
+#else
+#define AFS_UIO_OFFSET(uio) (uio)->uio_offset
+#define AFS_UIO_RESID(uio) (uio)->uio_resid
+#endif
+
+
/*
* encapsulation of kernel data structure accesses
*/
code = AddPag(genpag(), &credp);
crfree(credp);
}
+#elif defined(AFS_DARWIN80_ENV)
+ {
+ struct ucred *credp = kauth_cred_dup(proc_ucred(p));
+ code = AddPag(p, genpag(), &credp);
+ kauth_cred_rele(credp);
+ }
#elif defined(AFS_DARWIN_ENV)
{
struct ucred *credp = crdup(p->p_cred->pc_ucred);
* UIO routines
*/
+#ifndef AFS_DARWIN80_ENV
/* routine to make copy of uio structure in ainuio, using aoutvec for space */
int
afsio_copy(struct uio *ainuio, struct uio *aoutuio,
}
return 0;
}
+#endif
/* skip asize bytes in the current uio structure */
int
register int cnt;
AFS_STATCNT(afsio_skip);
+#ifdef AFS_DARWIN80_ENV
+ uio_update(auio, asize);
+#else
/* It isn't guaranteed that multiple iovecs work ok (hasn't been tested!) */
while (asize > 0 && auio->afsio_resid) {
tv = auio->afsio_iov;
auio->uio_offset += cnt;
asize -= cnt;
}
+#endif
return 0;
}
-#if !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN80_ENV)
/* This is the common part of the vget VFS call. */
int
afs_osi_vget(struct vcache **avcpp, struct fid *afidp, struct vrequest *areqp)
void
afsi_SetServerIPRank(sa, ifa)
struct srvAddr *sa;
+#ifdef AFS_DARWIN80_ENV
+ ifaddr_t ifa;
+#else
struct ifaddr *ifa;
+#endif
{
+ struct sockaddr sout;
struct sockaddr_in *sin;
int t;
afs_uint32 subnetmask, myAddr, myNet, myDstaddr, mySubnet, netMask;
afs_uint32 serverAddr;
- if (ifa->ifa_addr->sa_family != AF_INET)
+ if (ifaddr_address_family(ifa) != AF_INET)
return;
- sin = (struct sockaddr_in *)ifa->ifa_addr;
- myAddr = ntohl(sin->sin_addr.s_addr); /* one of my IP addr in host order */
+ t = ifaddr_address(ifa, &sout, sizeof(sout));
+ if (t == 0) {
+ sin = (struct sockaddr_in *)&sout;
+ myAddr = ntohl(sin->sin_addr.s_addr); /* one of my IP addr in host order */
+ } else {
+ myAddr = 0;
+ }
serverAddr = ntohl(sa->sa_ip); /* server's IP addr in host order */
- sin = (struct sockaddr_in *)ifa->ifa_netmask;
- subnetmask = ntohl(sin->sin_addr.s_addr); /* subnet mask in host order */
- sin = (struct sockaddr_in *)ifa->ifa_dstaddr;
- if (sin)
+ t = ifaddr_netmask(ifa, &sout, sizeof(sout));
+ if (t == 0) {
+ sin = (struct sockaddr_in *)&sout;
+ subnetmask = ntohl(sin->sin_addr.s_addr); /* subnet mask in host order */
+ } else {
+ subnetmask = 0;
+ }
+ t = ifaddr_dstaddress(ifa, &sout, sizeof(sout));
+ if (t == 0) {
+ sin = (struct sockaddr_in *)&sout;
myDstaddr = sin->sin_addr.s_addr;
+ } else {
+ myDstaddr = 0;
+ }
if (IN_CLASSA(myAddr))
netMask = IN_CLASSA_NET;
if (serverAddr == myAddr) { /* same machine */
sa->sa_iprank = afs_min(sa->sa_iprank, TOPR);
} else { /* same subnet */
- sa->sa_iprank = afs_min(sa->sa_iprank, HI + ifa->ifa_metric);
+ sa->sa_iprank = afs_min(sa->sa_iprank, HI + ifnet_metric(ifaddr_ifnet(ifa)));
}
} else { /* same net */
- sa->sa_iprank = afs_min(sa->sa_iprank, MED + ifa->ifa_metric);
+ sa->sa_iprank = afs_min(sa->sa_iprank, MED + ifnet_metric(ifaddr_ifnet(ifa)));
}
}
#ifdef IFF_POINTTOPOINT
/* check for case #4 -- point-to-point link */
- if ((ifa->ia_ifp->if_flags & IFF_POINTOPOINT)
+ if ((ifnet_flags(ifaddr_ifnet(ifa)) & IFF_POINTOPOINT)
&& (myDstaddr == serverAddr)) {
- if (ifa->ia_ifp->if_metric >= (MAXDEFRANK - MED) / PPWEIGHT)
+ if (ifnet_metric(ifaddr_ifnet(ifa)) >= (MAXDEFRANK - MED) / PPWEIGHT)
t = MAXDEFRANK;
else
- t = MED + (PPWEIGHT << ifa->->ifa_metric);
+ t = MED + (PPWEIGHT << ifnet_metric(ifaddr_ifnet(ifa)));
if (sa->sa_iprank > t)
sa->sa_iprank = t;
}
#ifdef AFS_SGI62_ENV
(void)hash_enum(&hashinfo_inaddr, afsi_enum_set_rank, HTF_INET, NULL,
(caddr_t) sa, NULL);
+#elif defined(AFS_DARWIN80_ENV)
+ {
+ errno_t t;
+ int cnt=0;
+ ifaddr_t *addresses, address;
+ t = ifnet_get_address_list_family(NULL, &addresses, AF_INET);
+ if (t == 0) {
+ while(addresses[cnt] != NULL) {
+ afsi_SetServerIPRank(sa, address);
+ cnt++;
+ }
+ ifnet_free_address_list(addresses);
+ }
+ }
#elif defined(AFS_DARWIN60_ENV)
{
struct ifnet *ifn;
if (VREFCOUNT(tvc) > 1)
#else /* AFS_OSF_ENV */
#ifdef AFS_DARWIN80_ENV
- if (vnode_isinuse(AFSTOV(tvc)))
+ if (vnode_isinuse(AFSTOV(tvc), 0))
#else
if (VREFCOUNT(tvc))
#endif
afs_vcount--;
vSetType(avc, VREG);
#ifdef AFS_DARWIN80_ENV
- if (vnode_isinuse(AFSTOV(avc))) {
+ if (vnode_isinuse(AFSTOV(avc), 0)) {
#else
if (VREFCOUNT(avc) > 0) {
#endif
else if (QNext(uq) != tq)
refpanic("VLRU inconsistent");
#ifdef AFS_DARWIN80_ENV
- else if (!vnode_isinuse(AFSTOV(tvc)))
+ else if (!vnode_isinuse(AFSTOV(tvc), 0))
#else
else if (VREFCOUNT(tvc) < 1)
#endif
refpanic("refcnt 0 on VLRU");
#ifdef AFS_DARWIN80_ENV
- if (vnode_isinuse(AFSTOV(tvc)) &&
+ if (vnode_isinuse(AFSTOV(tvc), 0) &&
#else
if (VREFCOUNT(tvc) == 1 &&
#endif
#endif
#ifdef AFS_DARWIN80_ENV
- if (!vnode_isinuse(AFSTOV(tvc)
+ if (!vnode_isinuse(AFSTOV(tvc), 0
#else
if (((VREFCOUNT(tvc) == 0)
#if defined(AFS_DARWIN_ENV) && !defined(UKERNEL)
#define AFSBIG_ENDIAN 1
#define AFS_HAVE_FFS 1 /* Use system's ffs. */
-#define AFS_GCPAGS 1 /* if nonzero, garbage collect PAGs */
+#define AFS_GCPAGS 0
#define RXK_LISTENER_ENV 1
#ifdef KERNEL
#define va_nodeid va_fileid
#define vfs_vnodecovered mnt_vnodecovered
#define direct dirent
-#define vnode_t struct vnode
-//#define VN_RELE(vp) vrele(((struct vnode *)(vp)))
-//#define VN_HOLD(vp) VREF(((struct vnode *)(vp)))
#define BIND_8_COMPAT
#endif
KDEFS=
DBUG =
DEFINES= -D_KERNEL -DKERNEL -DKERNEL_PRIVATE -DDIAGNOSTIC -DUSE_SELECT -DMACH_USER_API -DMACH_KERNEL
+<ppc_darwin_80>
+KOPTS=-static -g -nostdinc -nostdlib -no-cpp-precomp -fno-builtin -finline -fno-keep-inline-functions -msoft-float -fsigned-bitfields -arch ppc -Dppc -DPPC -D__PPC__ -DPAGE_SIZE_FIXED -O2 -mcpu=750 -mmultiple -fschedule-insns
<ppc_darwin_70>
KOPTS=-static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch
<ppc_darwin_60>