From 2463bcf625dcac3b53380927532c2d1a928c94b5 Mon Sep 17 00:00:00 2001 From: Chaskiel M Grundman Date: Sun, 19 Jun 2005 00:29:05 +0000 Subject: [PATCH] macos-104-notyet-20050618 next update of 10.4 --- src/afs/DARWIN/osi_machdep.h | 5 +- src/afs/DARWIN/osi_misc.c | 8 +- src/afs/DARWIN/osi_prototypes.h | 1 + src/afs/DARWIN/osi_sleep.c | 10 +- src/afs/DARWIN/osi_vfsops.c | 28 ++-- src/afs/DARWIN/osi_vm.c | 3 +- src/afs/DARWIN/osi_vnodeops.c | 127 ++++++++++----- src/afs/VNOPS/afs_vnop_lookup.c | 8 +- src/afs/VNOPS/afs_vnop_read.c | 10 +- src/afs/VNOPS/afs_vnop_readdir.c | 7 +- src/afs/afs_dcache.c | 6 +- src/afs/afs_osidnlc.c | 3 + src/afs/afs_vcache.c | 255 ++++++++++++++++++++++--------- src/config/afs_args.h | 14 +- src/rx/DARWIN/rx_knet.c | 49 +++++- src/rx/rx_kcommon.c | 2 - src/rx/rx_packet.c | 56 +------ src/sys/afssyscalls.c | 2 +- 18 files changed, 381 insertions(+), 213 deletions(-) diff --git a/src/afs/DARWIN/osi_machdep.h b/src/afs/DARWIN/osi_machdep.h index 80acb080e3..d51a2df4dd 100644 --- a/src/afs/DARWIN/osi_machdep.h +++ b/src/afs/DARWIN/osi_machdep.h @@ -82,11 +82,14 @@ enum vcexcl { EXCL, NONEXCL }; #ifdef AFS_DARWIN80_ENV #define vrele vnode_rele -#define vput(v) do { vnode_put((v)); vnode_rele((v)); } while(0) +#define vput vnode_rele #define vref vnode_ref #define vattr vnode_attr +#if 0 +#define vn_lock(v, unused1, unused2) vnode_get((v)) #define VOP_LOCK(v, unused1, unused2) vnode_get((v)) #define VOP_UNLOCK(v, unused1, unused2) vnode_put((v)) +#endif #define va_size va_data_size #define va_atime va_access_time diff --git a/src/afs/DARWIN/osi_misc.c b/src/afs/DARWIN/osi_misc.c index 9263b13eaf..5ccd33004f 100644 --- a/src/afs/DARWIN/osi_misc.c +++ b/src/afs/DARWIN/osi_misc.c @@ -207,16 +207,18 @@ int afs_cdev_nop_openclose(dev_t dev, int flags, int devtype,struct proc *p) { int afs_cdev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p) { int retval=0; + int code; struct afssysargs *a = data; if (proc_is64bit(p)) return EINVAL; if (cmd != VIOC_SYSCALL) { - printf("ioctl mismatch 0x%lx (wanted 0x%lx)\n", cmd, VIOC_SYSCALL); - /*return EINVAL;*/ + return EINVAL; } - afs3_syscall(p, (struct afssysargs *)data, &retval); + code=afs3_syscall(p, (struct afssysargs *)data, &retval); + if (code) + return code; return retval; } diff --git a/src/afs/DARWIN/osi_prototypes.h b/src/afs/DARWIN/osi_prototypes.h index 8dac77d1d6..26099dafc6 100644 --- a/src/afs/DARWIN/osi_prototypes.h +++ b/src/afs/DARWIN/osi_prototypes.h @@ -27,6 +27,7 @@ extern void put_vfs_context(void); /* osi_sleep.c */ extern void afs_osi_fullSigMask(void); extern void afs_osi_fullSigRestore(void); +extern int osi_TimedSleep(char *event, afs_int32 ams, int aintok); /* osi_vm.c */ extern void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size); diff --git a/src/afs/DARWIN/osi_sleep.c b/src/afs/DARWIN/osi_sleep.c index 582215a7f5..4c4a6d1f08 100644 --- a/src/afs/DARWIN/osi_sleep.c +++ b/src/afs/DARWIN/osi_sleep.c @@ -18,7 +18,7 @@ RCSID #include "afs/afs_stats.h" /* afs statistics */ -static int osi_TimedSleep(char *event, afs_int32 ams, int aintok); +int osi_TimedSleep(char *event, afs_int32 ams, int aintok); static char waitV; @@ -202,18 +202,19 @@ afs_osi_SleepSig(void *event) * * Returns 0 if timeout and EINTR if signalled. */ -static int +int osi_TimedSleep(char *event, afs_int32 ams, int aintok) { int code = 0; struct afs_event *evp; - int ticks, seq; + int seq; int prio; #ifdef AFS_DARWIN80_ENV struct timespec ts; +#else + int ticks; #endif - ticks = (ams * afs_hz) / 1000; evp = afs_getevent(event); @@ -228,6 +229,7 @@ osi_TimedSleep(char *event, afs_int32 ams, int aintok) ts.tv_nsec = (ams % 1000) * 1000000; code = msleep(event, NULL, prio, "afs_osi_TimedSleep", &ts); #else + ticks = (ams * afs_hz) / 1000; #ifdef AFS_DARWIN14_ENV /* this is probably safe for all versions, but testing is hard. */ /* using tsleep instead of assert_wait/thread_set_timer/thread_block diff --git a/src/afs/DARWIN/osi_vfsops.c b/src/afs/DARWIN/osi_vfsops.c index a31e9bd55c..792d310fa7 100644 --- a/src/afs/DARWIN/osi_vfsops.c +++ b/src/afs/DARWIN/osi_vfsops.c @@ -180,6 +180,8 @@ afs_mount(mp, path, data, ndp, p) } #ifdef AFS_DARWIN80_ENV afs_vfs_typenum=vfs_typenum(mp); + vfs_setauthopaque(mp); + vfs_setauthopaqueaccess(mp); #else strcpy(mp->mnt_stat.f_fstypename, "afs"); #endif @@ -283,7 +285,9 @@ afs_root(struct mount *mp, struct vnode **vpp) } } if (tvp) { +#ifndef AFS_DARWIN80_ENV osi_vnhold(tvp, 0); +#endif AFS_GUNLOCK(); #ifdef AFS_DARWIN80_ENV afs_darwin_finalizevnode(tvp, NULL, NULL, 1); @@ -292,10 +296,14 @@ afs_root(struct mount *mp, struct vnode **vpp) #endif AFS_GLOCK(); if (mdata == NULL) { +#ifdef AFS_DARWIN80_ENV /* afs_globalVp ref */ + vnode_get(AFSTOV(tvp)); + osi_vnhold(tvp, 0); +#endif afs_globalVFS = mp; } *vpp = AFSTOV(tvp); -#ifndef AFS_DARWIN80_ENV /* XXX VROOT can only be set in vnode_create */ +#ifndef AFS_DARWIN80_ENV AFSTOV(tvp)->v_flag |= VROOT; AFSTOV(tvp)->v_vfsp = mp; #endif @@ -307,7 +315,7 @@ afs_root(struct mount *mp, struct vnode **vpp) return error; } -#if 0 /* vget never had this prototype AFAIK */ +#ifndef AFS_DARWIN80_ENV /* vget vfsop never had this prototype AFAIK */ int afs_vget(mp, lfl, vp) struct mount *mp; @@ -320,23 +328,13 @@ afs_vget(mp, lfl, vp) vprint("bad usecount", vp); panic("afs_vget"); } -#ifdef AFS_DARWIN80_ENV - error = vnode_get(vp); -#else error = vget(vp, lfl, current_proc()); -#endif if (!error) insmntque(vp, mp); /* take off free list */ return error; } -#else -#ifdef AFS_DARWIN80_ENV -int afs_vget(struct mount *mp, ino64_t ino, struct vnode **vpp, - vfs_context_t ctx) -#else -int afs_vget(struct mount *mp, void *ino, struct vnode **vpp) -#endif +int afs_vfs_vget(struct mount *mp, void *ino, struct vnode **vpp) { return ENOENT; /* cannot implement */ } @@ -590,13 +588,13 @@ struct vfsops afs_vfsops = { #ifdef AFS_DARWIN80_ENV 0,0,0, #else - afs_vget, + afs_vfs_vget, afs_fhtovp, afs_vptofh, #endif afs_init, afs_sysctl, -#ifdef AFS_DARWIN80_ENVX +#ifdef AFS_DARWIN80_ENV 0 /*setattr */, {0} #endif diff --git a/src/afs/DARWIN/osi_vm.c b/src/afs/DARWIN/osi_vm.c index 89fb2f614b..07a5d31e3d 100644 --- a/src/afs/DARWIN/osi_vm.c +++ b/src/afs/DARWIN/osi_vm.c @@ -125,7 +125,8 @@ osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp) kern_return_t kret; off_t size; #ifdef AFS_DARWIN80_ENV - ubc_sync_range(vp, 0, ubc_getsize(vp), UBC_INVALIDATE); + size = ubc_getsize(vp); + ubc_sync_range(vp, 0, size, UBC_INVALIDATE); /* XXX what about when not CStatd */ if (avc->states & CStatd && size != avc->m.Length) ubc_setsize(vp, avc->m.Length); diff --git a/src/afs/DARWIN/osi_vnodeops.c b/src/afs/DARWIN/osi_vnodeops.c index 02f1c8b1eb..74d216128a 100644 --- a/src/afs/DARWIN/osi_vnodeops.c +++ b/src/afs/DARWIN/osi_vnodeops.c @@ -238,6 +238,10 @@ darwin_vn_hold(struct vnode *vp) #ifndef AFS_DARWIN80_ENV tvc->states |= CUBCinit; +#endif +#ifdef AFS_DARWIN80_ENV + if (tvc->states & CDeadVnode) + osi_Assert(!vnode_isinuse(vp, 1)); #endif if (haveGlock) AFS_GUNLOCK(); @@ -284,26 +288,38 @@ afs_vop_lookup(ap) int lockparent; /* 1 => lockparent flag is set */ int wantparent; /* 1 => wantparent or lockparent flag */ struct proc *p; +#ifdef AFS_DARWIN80_ENV + error = cache_lookup(ap->a_dvp, ap->a_vpp, ap->a_cnp); + if (error == -1) + return 0; + if (error == ENOENT) + return error; +#endif + GETNAME(); p = vop_cn_proc; lockparent = flags & LOCKPARENT; wantparent = flags & (LOCKPARENT | WANTPARENT); - if (vnode_isdir(ap->a_dvp)) { + if (!vnode_isdir(ap->a_dvp)) { *ap->a_vpp = 0; DROPNAME(); return ENOTDIR; } dvp = ap->a_dvp; +#ifndef AFS_DARWIN80_ENV if (flags & ISDOTDOT) VOP_UNLOCK(dvp, 0, p); +#endif AFS_GLOCK(); error = afs_lookup(VTOAFS(dvp), name, &vcp, vop_cn_cred); AFS_GUNLOCK(); if (error) { +#ifndef AFS_DARWIN80_ENV if (flags & ISDOTDOT) VOP_LOCK(dvp, LK_EXCLUSIVE | LK_RETRY, p); +#endif if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) && (flags & ISLASTCN) && error == ENOENT) error = EJUSTRETURN; @@ -351,6 +367,7 @@ afs_vop_lookup(ap) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); /* always return the child locked */ } +#endif *ap->a_vpp = vp; #ifndef AFS_DARWIN80_ENV @@ -362,7 +379,6 @@ afs_vop_lookup(ap) DROPNAME(); return error; } -#endif int afs_vop_create(ap) @@ -387,8 +403,10 @@ afs_vop_create(ap) &vcp, vop_cn_cred); AFS_GUNLOCK(); if (error) { +#ifndef AFS_DARWIN80_ENV VOP_ABORTOP(dvp, cnp); vput(dvp); +#endif DROPNAME(); return (error); } @@ -413,8 +431,8 @@ afs_vop_create(ap) #ifndef AFS_DARWIN80_ENV if ((cnp->cn_flags & SAVESTART) == 0) FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI); -#endif vput(dvp); +#endif DROPNAME(); return error; } @@ -430,8 +448,8 @@ afs_vop_mknod(ap) { #ifndef AFS_DARWIN80_ENV FREE_ZONE(ap->a_cnp->cn_pnbuf, ap->a_cnp->cn_pnlen, M_NAMEI); -#endif vput(ap->a_dvp); +#endif return (ENODEV); } @@ -555,7 +573,7 @@ afs_vop_access(ap) bits |= PRSFS_READ; if (ap->a_action & KAUTH_VNODE_WRITE_ATTRIBUTES) bits |= PRSFS_WRITE; -#if 0 +#if 0 /* no extended attributes */ if (ap->a_action & KAUTH_VNODE_READ_EXTATTRIBUTES) bits |= PRSFS_READ; if (ap->a_action & KAUTH_VNODE_WRITE_EXTATTRIBUTES) @@ -709,7 +727,6 @@ afs_vop_pagein(ap) int code; struct vcache *tvc = VTOAFS(vp); - #ifndef AFS_DARWIN80_ENV if (UBCINVALID(vp)) { #if DIAGNOSTIC @@ -771,12 +788,8 @@ afs_vop_pagein(ap) /* Zero out rest of last page if there wasn't enough data in the file */ if (code == 0 && AFS_UIO_RESID(uio) > 0) { #ifdef AFS_DARWIN80_ENV - do { - int len = AFS_UIO_RESID(uio); - if (len > AFS_ZEROS) - len = AFS_ZEROS; - code = uiomove(afs_zeros, len, uio); - } while (code == 0 && AFS_UIO_RESID(uio) > 0); + memset(((caddr_t)ioaddr) + (size - AFS_UIO_RESID(uio)), 0, + AFS_UIO_RESID(uio)); #else memset(aiov.iov_base, 0, auio.uio_resid); #endif @@ -860,7 +873,6 @@ afs_vop_pageout(ap) int code; struct vcache *tvc = VTOAFS(vp); - #ifndef AFS_DARWIN80_ENV if (UBCINVALID(vp)) { #if DIAGNOSTIC @@ -1123,10 +1135,10 @@ afs_vop_remove(ap) error = afs_remove(VTOAFS(dvp), name, vop_cn_cred); AFS_GUNLOCK(); cache_purge(vp); - vput(dvp); if (!error) { #ifdef AFS_DARWIN80_ENV ubc_setsize(vp, (off_t)0); + vnode_recycle(vp); #else /* necessary so we don't deadlock ourselves in vclean */ VOP_UNLOCK(vp, 0, cnp->cn_proc); @@ -1136,10 +1148,13 @@ afs_vop_remove(ap) #endif } +#ifndef AFS_DARWIN80_ENV + vput(dvp); if (dvp == vp) vrele(vp); else vput(vp); +#endif #ifndef AFS_DARWIN80_ENV FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI); @@ -1185,7 +1200,9 @@ afs_vop_link(ap) VOP_UNLOCK(vp, 0, p); #endif out: +#ifndef AFS_DARWIN80_ENV vput(dvp); +#endif DROPNAME(); return error; } @@ -1229,6 +1246,10 @@ afs_vop_rename(ap) } #endif +#ifdef AFS_DARWIN80_ENV + /* the generic code doesn't do this, so we really should, but all the + vrele's are wrong... */ +#else /* * if fvp == tvp, we're just removing one name of a pair of * directory entries for the same element. convert call into rename. @@ -1292,6 +1313,7 @@ afs_vop_rename(ap) vput(fvp); return (error); } +#endif #if !defined(AFS_DARWIN80_ENV) if (error = vn_lock(fvp, LK_EXCLUSIVE, p)) goto abortit; @@ -1316,6 +1338,14 @@ afs_vop_rename(ap) #endif FREE(fname, M_TEMP); FREE(tname, M_TEMP); +#ifdef AFS_DARWIN80_ENV + if (tvp) { + cache_purge(tvp); + if (!error) { + vnode_recycle(tvp); + } + } +#else if (error) goto abortit; /* XXX */ if (tdvp == tvp) @@ -1326,6 +1356,7 @@ afs_vop_rename(ap) vput(tvp); vrele(fdvp); vrele(fvp); +#endif return error; } @@ -1373,8 +1404,8 @@ afs_vop_mkdir(ap) DROPNAME(); #ifndef AFS_DARWIN80_ENV FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI); -#endif vput(dvp); +#endif return error; } @@ -1392,9 +1423,9 @@ afs_vop_rmdir(ap) GETNAME(); if (dvp == vp) { +#ifndef AFS_DARWIN80_ENV vrele(dvp); vput(vp); -#ifndef AFS_DARWIN80_ENV FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI); #endif DROPNAME(); @@ -1405,8 +1436,10 @@ afs_vop_rmdir(ap) error = afs_rmdir(VTOAFS(dvp), name, vop_cn_cred); AFS_GUNLOCK(); DROPNAME(); +#ifndef AFS_DARWIN80_ENV vput(dvp); vput(vp); +#endif return error; } @@ -1432,8 +1465,8 @@ afs_vop_symlink(ap) DROPNAME(); #ifndef AFS_DARWIN80_ENV FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI); -#endif vput(dvp); +#endif return error; } @@ -1521,14 +1554,14 @@ afs_vop_inactive(ap) * } */ *ap; { register struct vnode *vp = ap->a_vp; - + struct vcache *tvc = VTOAFS(vp); + int haveGlock = ISAFS_GLOCK(); #ifndef AFS_DARWIN80_ENV if (prtactive && vnode_isinuse(vp, 0) != 0) vprint("afs_vop_inactive(): pushing active", vp); #endif - AFS_GLOCK(); - afs_InactiveVCache(VTOAFS(vp), 0); /* decrs ref counts */ + afs_InactiveVCache(tvc, 0); /* decrs ref counts */ AFS_GUNLOCK(); #ifndef AFS_DARWIN80_ENV VOP_UNLOCK(vp, 0, ap->a_p); @@ -1545,27 +1578,20 @@ afs_vop_reclaim(ap) int error = 0; int sl; register struct vnode *vp = ap->a_vp; - int haveGlock = ISAFS_GLOCK(); struct vcache *tvc = VTOAFS(vp); + osi_Assert(!ISAFS_GLOCK()) cache_purge(vp); /* just in case... */ - if (!haveGlock) - AFS_GLOCK(); + AFS_GLOCK(); ObtainWriteLock(&afs_xvcache, 335); - error = afs_FlushVCache(VTOAFS(vp), &sl); /* toss our stuff from vnode */ + error = afs_FlushVCache(tvc, &sl); /* toss our stuff from vnode */ ReleaseWriteLock(&afs_xvcache); - if (!haveGlock) - AFS_GUNLOCK(); - + AFS_GUNLOCK(); + if (!error && vnode_fsnode(vp)) panic("afs_reclaim: vnode not cleaned"); if (!error && (tvc->v != NULL)) panic("afs_reclaim: vcache not cleaned"); - -#ifdef AFS_DARWIN80_ENV - /* XXX do we need to call vnode_recycle here? */ -#endif - return error; } @@ -1838,20 +1864,34 @@ afs_darwin_getnewvnode(struct vcache *tvc) { #ifdef AFS_DARWIN80_ENV vnode_t vp; - int error; + int error, dead; struct vnode_fsparam par; memset(&par, 0, sizeof(struct vnode_fsparam)); + AFS_GLOCK(); + ObtainWriteLock(&avc->lock,342); + if (tvc->states & CStatd) { /* XXX markroot */ + par.vnfs_vtype = avc->m.Type; + par.vnfs_vops = afs_vnodeop_p; + par.vnfs_filesize = avc->m.Length; + dead = 0; + } else { + par.vnfs_vtype = VNON; + par.vnfs_vops = afs_dead_vnodeop_p; + par.vnfs_flags = VNFS_NOCACHE|VNFS_CANTCACHE; + dead = 1; + } par.vnfs_mp = afs_globalVFS; - par.vnfs_vtype = VNON; - par.vnfs_vops = afs_dead_vnodeop_p; par.vnfs_fsnode = tvc; - par.vnfs_flags = VNFS_NOCACHE|VNFS_CANTCACHE; error = vnode_create(VNCREATE_FLAVOR, VCREATESIZE, &par, &vp); if (!error) { + vnode_addfsref(vp); + vnode_ref(vp); tvc->v = vp; - vnode_recycle(vp); /* terminate as soon as iocount drops */ - tvc->states |= CDeadVnode; + if (dead) { + vnode_recycle(vp); /* terminate as soon as iocount drops */ + tvc->states |= CDeadVnode; + } } #else while (getnewvnode(VT_AFS, afs_globalVFS, afs_vnodeop_p, &tvc->v)) { @@ -1873,25 +1913,34 @@ afs_darwin_finalizevnode(struct vcache *avc, struct vnode *dvp, struct component if (!(avc->states & CDeadVnode) && vnode_vtype(ovp) != VNON) { ReleaseWriteLock(&avc->lock); AFS_GUNLOCK(); + vnode_update_identity(ovp, dvp, cnp->cn_nameptr, cnp->cn_namelen, + cnp->cn_hash, + VNODE_UPDATE_PARENT|VNODE_UPDATE_NAME); + vnode_rele(ovp); return; } + if ((avc->states & CDeadVnode) && vnode_vtype(ovp) != VNON) + panic("vcache %p should not be CDeadVnode", avc); AFS_GUNLOCK(); memset(&par, 0, sizeof(struct vnode_fsparam)); par.vnfs_mp = afs_globalVFS; par.vnfs_vtype = avc->m.Type; par.vnfs_vops = afs_vnodeop_p; + par.vnfs_filesize = avc->m.Length; par.vnfs_fsnode = avc; par.vnfs_dvp = dvp; par.vnfs_cnp = cnp; - par.vnfs_filesize = avc->m.Length; if (isroot) par.vnfs_markroot = 1; error = vnode_create(VNCREATE_FLAVOR, VCREATESIZE, &par, &nvp); if (!error) { + vnode_addfsref(nvp); avc->v = nvp; avc->states &=~ CDeadVnode; vnode_clearfsnode(ovp); + vnode_removefsref(ovp); vnode_put(ovp); + vnode_rele(ovp); } AFS_GLOCK(); ReleaseWriteLock(&avc->lock); diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 90fa84ef2b..7648752c37 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -873,6 +873,9 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) ReleaseReadLock(&afs_xvcache); /* could be read lock */ if (retry) goto reskip; +#ifdef AFS_DARWIN80_ENV + vnode_get(AFSTOV(lruvcp)); +#endif /* otherwise, merge in the info. We have to be quite careful here, * since we need to ensure that we don't merge old info over newer @@ -1074,7 +1077,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) } /* was: (AFS_DEC_ENV) || defined(AFS_OSF30_ENV) || defined(AFS_NCR_ENV) */ -static int AFSDOBULK = 1; +static int AFSDOBULK = 0; int #ifdef AFS_OSF_ENV @@ -1210,6 +1213,9 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED ObtainReadLock(&afs_xvcache); osi_vnhold(adp, 0); ReleaseReadLock(&afs_xvcache); +#ifdef AFS_DARWIN80_ENV + vnode_get(AFSTOV(adp)); +#endif code = 0; *avcp = tvc = adp; hit = 1; diff --git a/src/afs/VNOPS/afs_vnop_read.c b/src/afs/VNOPS/afs_vnop_read.c index 822fd77f04..c3da3fa999 100644 --- a/src/afs/VNOPS/afs_vnop_read.c +++ b/src/afs/VNOPS/afs_vnop_read.c @@ -61,7 +61,7 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, struct dcache *tdc = 0; afs_int32 error, trybusy = 1; #ifdef AFS_DARWIN80_ENV - uio_t tuiop; + uio_t tuiop = NULL; #else struct uio tuio; struct uio *tuiop = &tuio; @@ -378,7 +378,8 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, if (!noLock) ReleaseReadLock(&avc->lock); #ifdef AFS_DARWIN80_ENV - uio_free(tuiop); + if (tuiop) + uio_free(tuiop); #else osi_FreeSmallSpace(tvec); #endif @@ -471,7 +472,7 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, struct dcache *tdc = 0; afs_int32 error; #ifdef AFS_DARWIN80_ENV - uio_t tuiop; + uio_t tuiop=NULL; #else struct uio tuio; struct uio *tuiop = &tuio; @@ -900,7 +901,8 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, ReleaseReadLock(&avc->lock); #ifdef AFS_DARWIN80_ENV - uio_free(tuiop); + if (tuiop) + uio_free(tuiop); #else osi_FreeSmallSpace(tvec); #endif diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index 7190ec148e..9717ce3a44 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -143,7 +143,12 @@ struct irix5_min_dirent { /* miniature dirent structure */ #else struct min_direct { /* miniature direct structure */ /* If struct direct changes, this must too */ -#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) +#if defined(AFS_DARWIN80_ENV) + ino_t d_fileno; + u_short d_reclen; + u_char d_type; + u_char d_namlen; +#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) afs_uint32 d_fileno; u_short d_reclen; u_char d_type; diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 3db7b85737..c21672f724 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -646,9 +646,9 @@ afs_GetDownD(int anumber, int *aneedSpace, afs_int32 buckethint) if (tvc) { tchunkoffset = AFS_CHUNKTOBASE(tdc->f.chunk); chunkFlags = afs_indexFlags[tdc->index]; - if ((((phase / 2) & 1) == 0) && osi_Active(tvc)) + if (((phase & 1) == 0) && osi_Active(tvc)) skip = 1; - if ((((phase / 2) & 1) == 1) && osi_Active(tvc) + if (((phase & 1) == 1) && osi_Active(tvc) && (tvc->states & CDCLock) && (chunkFlags & IFAnyPages)) skip = 1; @@ -794,7 +794,7 @@ afs_GetDownD(int anumber, int *aneedSpace, afs_int32 buckethint) } } else { /* found no one in phases 0-5, we're hosed */ - if (victimPtr == 0) + if (j == 0) break; } } /* big while loop */ diff --git a/src/afs/afs_osidnlc.c b/src/afs/afs_osidnlc.c index 919d2f2f03..ab856edad3 100644 --- a/src/afs/afs_osidnlc.c +++ b/src/afs/afs_osidnlc.c @@ -242,6 +242,9 @@ osi_dnlc_lookup(struct vcache *adp, char *aname, int locktype) #ifdef AFS_OSF_ENV VN_HOLD((vnode_t *) tvc); #else +#ifdef AFS_DARWIN80_ENV + vnode_get(tvc->v); +#endif osi_vnhold(tvc, 0); #endif ReleaseReadLock(&afs_xvcache); diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index ee95ceb1d2..41a1e88ed7 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -150,6 +150,10 @@ afs_FlushVCache(struct vcache *avc, int *slept) code = EBUSY; goto bad; } + if (avc->states & CVInit) { + code = EBUSY; + goto bad; + } if (avc->nextfree || !avc->vlruq.prev || !avc->vlruq.next) { /* qv afs.h */ refpanic("LRU vs. Free inconsistency"); } @@ -187,8 +191,9 @@ afs_FlushVCache(struct vcache *avc, int *slept) /* OK, there are no internal vrefCounts, so there shouldn't * be any more refs here. */ if (avc->v) { -#ifdef AFS_DARWIN_ENV +#ifdef AFS_DARWIN80_ENV vnode_clearfsnode(AFSTOV(avc)); + vnode_removefsref(AFSTOV(avc)); #else avc->v->v_data = NULL; /* remove from vnode */ #endif @@ -675,7 +680,9 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) #endif } else if (QNext(uq) != tq) { refpanic("VLRU inconsistent"); - } + } else if (tvc->states & CVInit) { + continue; + } #if defined(AFS_LINUX22_ENV) if (tvc != afs_globalVp && VREFCOUNT(tvc) && tvc->opens == 0) { struct dentry *dentry; @@ -724,6 +731,21 @@ restart: #endif && tvc->opens == 0 && (tvc->states & CUnlinkedDel) == 0) { #if defined (AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) +#ifdef AFS_DARWIN80_ENV + fv_slept=1; + /* must release lock, since vnode_recycle will immediately + reclaim if there are no other users */ + ReleaseWriteLock(&afs_xvcache); + AFS_GUNLOCK(); + /* VREFCOUNT_GT only sees usecounts, not iocounts */ + /* so this may fail to actually recycle the vnode now */ + if (vnode_recycle(AFSTOV(tvc))) + code=0; + else + code=EBUSY; + AFS_GLOCK(); + ObtainWriteLock(&afs_xvcache, 336); +#else /* * vgone() reclaims the vnode, which calls afs_FlushVCache(), * then it puts the vnode on the free list. @@ -732,13 +754,11 @@ restart: * XXX assume FreeBSD is the same for now. */ AFS_GUNLOCK(); -#ifdef AFS_DARWIN80_ENV - vnode_recycle(AFSTOV(tvc)); -#else vgone(AFSTOV(tvc)); -#endif + fv_slept = 0; + code = 0; AFS_GLOCK(); - code = fv_slept = 0; +#endif #else code = afs_FlushVCache(tvc, &fv_slept); #endif @@ -807,19 +827,66 @@ restart: RWLOCK_INIT(&tvc->vlock, "vcache vlock"); #endif /* defined(AFS_SUN5_ENV) */ + tvc->parentVnode = 0; + tvc->mvid = NULL; + tvc->linkData = NULL; + tvc->cbExpires = 0; + tvc->opens = 0; + tvc->execsOrWriters = 0; + tvc->flockCount = 0; + tvc->anyAccess = 0; + tvc->states = CVInit; + tvc->last_looker = 0; + tvc->fid = *afid; + tvc->asynchrony = -1; + tvc->vc_error = 0; + afs_symhint_inval(tvc); +#ifdef AFS_TEXT_ENV + tvc->flushDV.low = tvc->flushDV.high = AFS_MAXDV; +#endif + hzero(tvc->mapDV); + tvc->truncPos = AFS_NOTRUNC; /* don't truncate until we need to */ + hzero(tvc->m.DataVersion); /* in case we copy it into flushDV */ + tvc->Access = NULL; + tvc->callback = serverp; /* to minimize chance that clear + * request is lost */ + + i = VCHash(afid); + + tvc->hnext = afs_vhashT[i]; + afs_vhashT[i] = tvc; + if ((VLRU.next->prev != &VLRU) || (VLRU.prev->next != &VLRU)) { + refpanic("NewVCache VLRU inconsistent"); + } + QAdd(&VLRU, &tvc->vlruq); /* put in lruq */ + if ((VLRU.next->prev != &VLRU) || (VLRU.prev->next != &VLRU)) { + refpanic("NewVCache VLRU inconsistent2"); + } + if (tvc->vlruq.next->prev != &(tvc->vlruq)) { + refpanic("NewVCache VLRU inconsistent3"); + } + if (tvc->vlruq.prev->next != &(tvc->vlruq)) { + refpanic("NewVCache VLRU inconsistent4"); + } + vcachegen++; +/* it should now be safe to drop the xvcache lock */ #ifdef AFS_OBSD_ENV + ReleaseWriteLock(&afs_xvcache); AFS_GUNLOCK(); afs_nbsd_getnewvnode(tvc); /* includes one refcount */ AFS_GLOCK(); + ObtainWriteLock(&afs_xvcache,337); lockinit(&tvc->rwlock, PINOD, "vcache", 0, 0); #endif #ifdef AFS_DARWIN_ENV - AFS_GUNLOCK(); - afs_darwin_getnewvnode(tvc); /* includes one refcount */ - AFS_GLOCK(); #ifdef AFS_DARWIN80_ENV LOCKINIT(tvc->rwlock); #else + ReleaseWriteLock(&afs_xvcache); + AFS_GUNLOCK(); + afs_darwin_getnewvnode(tvc); /* includes one refcount */ + AFS_GLOCK(); + ObtainWriteLock(&afs_xvcache,338); lockinit(&tvc->rwlock, PINOD, "vcache", 0, 0); #endif #endif @@ -827,6 +894,7 @@ restart: { struct vnode *vp; + ReleaseWriteLock(&afs_xvcache); AFS_GUNLOCK(); #if defined(AFS_FBSD60_ENV) if (getnewvnode(MOUNT_AFS, afs_globalVFS, &afs_vnodeops, &vp)) @@ -837,6 +905,7 @@ restart: #endif panic("afs getnewvnode"); /* can't happen */ AFS_GLOCK(); + ObtainWriteLock(&afs_xvcache,339); if (tvc->v != NULL) { /* I'd like to know if this ever happens... * We don't drop global for the rest of this function, @@ -855,30 +924,7 @@ restart: lockinit(&tvc->rwlock, PINOD, "vcache", 0, 0); } #endif - tvc->parentVnode = 0; - tvc->mvid = NULL; - tvc->linkData = NULL; - tvc->cbExpires = 0; - tvc->opens = 0; - tvc->execsOrWriters = 0; - tvc->flockCount = 0; - tvc->anyAccess = 0; -#ifdef AFS_DARWIN80_ENV - tvc->states = CDeadVnode; -#else - tvc->states = 0; -#endif - tvc->last_looker = 0; - tvc->fid = *afid; - tvc->asynchrony = -1; - tvc->vc_error = 0; - afs_symhint_inval(tvc); -#ifdef AFS_TEXT_ENV - tvc->flushDV.low = tvc->flushDV.high = AFS_MAXDV; -#endif - hzero(tvc->mapDV); - tvc->truncPos = AFS_NOTRUNC; /* don't truncate until we need to */ - hzero(tvc->m.DataVersion); /* in case we copy it into flushDV */ + #if defined(AFS_LINUX22_ENV) { struct inode *ip = AFSTOI(tvc); @@ -999,9 +1045,6 @@ restart: afs_BozonInit(&tvc->pvnLock, tvc); #endif - tvc->Access = NULL; - tvc->callback = serverp; /* to minimize chance that clear - * request is lost */ /* initialize vnode data, note vrefCount is v.v_count */ #ifdef AFS_AIX_ENV /* Don't forget to free the gnode space */ @@ -1091,24 +1134,9 @@ restart: memset((char *)&(tvc->quick), 0, sizeof(struct vtodc)); memset((char *)&(tvc->callsort), 0, sizeof(struct afs_q)); tvc->slocks = NULL; - i = VCHash(afid); - tvc->hnext = afs_vhashT[i]; - afs_vhashT[i] = tvc; - if ((VLRU.next->prev != &VLRU) || (VLRU.prev->next != &VLRU)) { - refpanic("NewVCache VLRU inconsistent"); - } - QAdd(&VLRU, &tvc->vlruq); /* put in lruq */ - if ((VLRU.next->prev != &VLRU) || (VLRU.prev->next != &VLRU)) { - refpanic("NewVCache VLRU inconsistent2"); - } - if (tvc->vlruq.next->prev != &(tvc->vlruq)) { - refpanic("NewVCache VLRU inconsistent3"); - } - if (tvc->vlruq.prev->next != &(tvc->vlruq)) { - refpanic("NewVCache VLRU inconsistent4"); - } - vcachegen++; + tvc->states &=~ CVInit; + afs_osi_Wakeup(&tvc->states); return tvc; @@ -1141,6 +1169,7 @@ afs_FlushActiveVcaches(register afs_int32 doflocks) ObtainReadLock(&afs_xvcache); for (i = 0; i < VCSIZE; i++) { for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { + if (tvc->states & CVInit) continue; if (doflocks && tvc->flockCount != 0) { /* if this entry has an flock, send a keep-alive call out */ osi_vnhold(tvc, 0); @@ -1718,6 +1747,7 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq, #ifdef AFS_LINUX22_ENV vcache2inode(tvc); #endif + osi_Assert(tvc->states & CVInit == 0); ReleaseWriteLock(&tvc->lock); return tvc; } @@ -1839,6 +1869,15 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq, code = afs_FetchStatus(tvc, afid, areq, &OutStatus); } } +#ifdef AFS_DARWIN80_ENV + if (tvc->states & CVInit) { + AFS_GUNLOCK(); + afs_darwin_getnewvnode(tvc); /* instantiate, now that we might have a + filetype */ + AFS_GLOCK(); + tvc->states &=~ CVInit; + } +#endif if (code) { ReleaseWriteLock(&tvc->lock); @@ -1975,6 +2014,15 @@ afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq, if (tvp) afs_PutVolume(tvp, READ_LOCK); ReleaseWriteLock(&tvc->lock); +#ifdef AFS_DARWIN80_ENV + if (tvc->states & CVInit) { + AFS_GUNLOCK(); + afs_darwin_getnewvnode(tvc); /* instantiate, now that we might have a + filetype */ + AFS_GLOCK(); + tvc->states &=~ CVInit; + } +#endif ObtainReadLock(&afs_xvcache); AFS_FAST_RELE(tvc); ReleaseReadLock(&afs_xvcache); @@ -2016,6 +2064,15 @@ afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq, afs_ProcessFS(tvc, &OutStatus, areq); ReleaseWriteLock(&tvc->lock); +#ifdef AFS_DARWIN80_ENV + if (tvc->states & CVInit) { + AFS_GUNLOCK(); + afs_darwin_getnewvnode(tvc); /* instantiate, now that we might have a + filetype */ + AFS_GLOCK(); + tvc->states &=~ CVInit; + } +#endif return tvc; } @@ -2062,10 +2119,17 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, afid->Fid.Unique = tvolp->rootUnique; } +rootvc_loop: ObtainSharedLock(&afs_xvcache, 7); i = VCHash(afid); for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { + if (!FidCmp(&(tvc->fid), afid)) { + if (tvc->states & CVInit) { + ReleaseSharedLock(&afs_xvcache); + afs_osi_Sleep(&tvc->states); + goto rootvc_loop; + } #ifdef AFS_OSF_ENV /* Grab this vnode, possibly reactivating from the free list */ /* for the present (95.05.25) everything on the hash table is @@ -2078,6 +2142,19 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, if (vg) continue; #endif /* AFS_OSF_ENV */ +#ifdef AFS_DARWIN80_ENV + int vg; + if (tvc->states & CDeadVnode) { + ReleaseSharedLock(&afs_xvcache); + osi_TimedSleep(&tvc->v, 500, 0); + goto rootvc_loop; + } + AFS_GUNLOCK(); + vg = vnode_get(AFSTOV(tvc)); /* this bumps ref count */ + AFS_GLOCK(); + if (vg) + continue; +#endif break; } } @@ -2088,9 +2165,13 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, if (tvc) AFS_RELE(AFSTOV(tvc)); #endif - tvc = NULL; getNewFid = 1; ReleaseSharedLock(&afs_xvcache); +#ifdef AFS_DARWIN80_ENV + if (tvc) + vnode_put(AFSTOV(tvc)); +#endif + tvc = NULL; goto newmtpt; } @@ -2479,6 +2560,9 @@ afs_PutVCache(register struct vcache *avc) ObtainReadLock(&afs_xvcache); AFS_FAST_RELE(avc); ReleaseReadLock(&afs_xvcache); +#ifdef AFS_DARWIN80_ENV + vnode_put(AFSTOV(avc)); +#endif } /*afs_PutVCache */ /* @@ -2514,6 +2598,19 @@ findloop: i = VCHash(afid); for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { if (FidMatches(afid, tvc)) { + while (tvc->states & CVInit) { + int lock; + lock = CheckLock(&afs_xvcache); + if (lock > 0) + ReleaseReadLock(&afs_xvcache); + else + ReleaseSharedLock(&afs_xvcache); + afs_osi_Sleep(&tvc->states); + if (lock > 0) + ObtainReadLock(&afs_xvcache); + else + ObtainSharedLock(&afs_xvcache, 341); + } #ifdef AFS_OSF_ENV /* Grab this vnode, possibly reactivating from the free list */ int vg; @@ -2525,28 +2622,11 @@ findloop: #endif /* AFS_OSF_ENV */ #ifdef AFS_DARWIN80_ENV int vg; - /* wait for the vnode to be replaced by afs_darwin_finalizevnode - or reclaimed. locks must be released so reclaim doesn't block */ - if (tvc->flags & CDeadVnode) { - int lock; - lock = CheckLock(&afs_vcache); - if (lock > 0) - ReleaseReadLock(&afs_vcache); - else - ReleaseSharedLock(&afs_vcache); - osi_TimedSleep(&tvc->v, 500, 0); - if (lock > 0) - ObtainReadLock(&afs_vcache); - else - ObtainSharedLock(&afs_vcache, 344); - goto findloop; - } AFS_GUNLOCK(); vg = vnode_get(AFSTOV(tvc)); AFS_GLOCK(); if (vg) continue; - #endif break; } @@ -2556,7 +2636,7 @@ findloop: if (tvc) { if (retry) *retry = 0; -#if !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN80_ENV) +#if !defined(AFS_OSF_ENV) osi_vnhold(tvc, retry); /* already held, above */ if (retry && *retry) return 0; @@ -2667,6 +2747,19 @@ afs_NFSFindVCache(struct vcache **avcp, struct VenusFid *afid) && (tvc->fid.Fid.Volume == afid->Fid.Volume) && ((tvc->fid.Fid.Unique & 0xffffff) == afid->Fid.Unique) && (tvc->fid.Cell == afid->Cell)) { + while (tvc->states & CVInit) { + int lock; + lock = CheckLock(&afs_xvcache); + if (lock > 0) + ReleaseReadLock(&afs_xvcache); + else + ReleaseSharedLock(&afs_xvcache); + afs_osi_Sleep(&tvc->states); + if (lock > 0) + ObtainReadLock(&afs_xvcache); + else + ObtainSharedLock(&afs_xvcache, 341); + } #ifdef AFS_OSF_ENV /* Grab this vnode, possibly reactivating from the free list */ int vg; @@ -2678,6 +2771,17 @@ afs_NFSFindVCache(struct vcache **avcp, struct VenusFid *afid) continue; } #endif /* AFS_OSF_ENV */ +#ifdef AFS_DARWIN80_ENV + /* Grab this vnode, possibly reactivating from the free list */ + int vg; + AFS_GUNLOCK(); + vg = vnode_get(AFSTOV(tvc)); + AFS_GLOCK(); + if (vg) { + /* This vnode no longer exists. */ + continue; + } +#endif /* AFS_DARWIN80_ENV */ count++; if (found_tvc) { /* Duplicates */ @@ -2688,6 +2792,11 @@ afs_NFSFindVCache(struct vcache **avcp, struct VenusFid *afid) #endif afs_duplicate_nfs_fids++; ReleaseSharedLock(&afs_xvcache); +#ifdef AFS_OSF_ENV + /* Drop our reference counts. */ + vnode_put(AFSTOV(tvc)); + vnode_put(AFSTOV(found_tvc)); +#endif return count; } found_tvc = tvc; diff --git a/src/config/afs_args.h b/src/config/afs_args.h index d208ebef27..b151d1ae8f 100644 --- a/src/config/afs_args.h +++ b/src/config/afs_args.h @@ -213,13 +213,13 @@ struct afsprocdata32 { #ifdef AFS_DARWIN80_ENV struct afssysargs { - long syscall; - long param1; - long param2; - long param3; - long param4; - long param5; - long param6; + unsigned long syscall; + unsigned long param1; + unsigned long param2; + unsigned long param3; + unsigned long param4; + unsigned long param5; + unsigned long param6; }; #define VIOC_SYSCALL_TYPE 'C' #define VIOC_SYSCALL _IOW(VIOC_SYSCALL_TYPE,1,struct afssysargs) diff --git a/src/rx/DARWIN/rx_knet.c b/src/rx/DARWIN/rx_knet.c index 9e02292796..71d5b1e8c3 100644 --- a/src/rx/DARWIN/rx_knet.c +++ b/src/rx/DARWIN/rx_knet.c @@ -27,6 +27,10 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec, socket_t asocket = (socket_t)so; struct msghdr msg; struct sockaddr_storage ss; + int rlen; +#if 1 + mbuf_t m; +#endif #else struct socket *asocket = (struct socket *)so; struct uio u; @@ -35,7 +39,7 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec, struct iovec iov[RX_MAXIOVECS]; struct sockaddr *sa = NULL; int code; - size_t rlen; + size_t resid; int haveGlock = ISAFS_GLOCK(); /*AFS_STATCNT(osi_NetReceive); */ @@ -51,6 +55,37 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec, thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL); #endif #ifdef AFS_DARWIN80_ENV +#if 1 + resid = *alength; + memset(&msg, 0, sizeof(struct msghdr)); + msg.msg_name = &ss; + msg.msg_namelen = sizeof(struct sockaddr_storage); + sa =(struct sockaddr *) &ss; + code = sock_receivembuf(asocket, &msg, &m, 0, alength); + if (!code) { + size_t offset=0,sz; + resid = *alength; + for (i=0;i rlen) + resid -= rlen; + else + resid = 0; +#endif #else u.uio_iov = &iov[0]; @@ -68,7 +111,7 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec, u.uio_rw = UIO_READ; u.uio_procp = NULL; code = soreceive(asocket, &sa, &u, NULL, NULL, NULL); - rlen = u.uio_resid; + resid = u.uio_resid; #endif #if defined(KERNEL_FUNNEL) @@ -79,7 +122,7 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec, if (code) return code; - *alength -= rlen; + *alength -= resid; if (sa) { if (sa->sa_family == AF_INET) { if (addr) diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 8793c9a62d..d8612dac46 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -1232,7 +1232,6 @@ rxk_Listener(void) #if defined(RX_ENABLE_LOCKS) && !defined(AFS_SUN5_ENV) AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS && !AFS_SUN5_ENV */ -printf("rxk_Listener starting...\n"); while (afs_termState != AFSOP_STOP_RXK_LISTENER) { if (rxp) { rxi_RestoreDataBufs(rxp); @@ -1242,7 +1241,6 @@ printf("rxk_Listener starting...\n"); osi_Panic("rxk_Listener: No more Rx buffers!\n"); } if (!(code = rxk_ReadPacket(rx_socket, rxp, &host, &port))) { - printf("."); rxp = rxi_ReceivePacket(rxp, rx_socket, host, port, 0, 0); } } diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index fd9f380243..cfc7b022f6 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -1478,61 +1478,7 @@ cpytoiovec(mblk_t * mp, int off, int len, register struct iovec *iovs, #define m_cpytoc(a, b, c, d) cpytoc(a, b, c, d) #define m_cpytoiovec(a, b, c, d, e) cpytoiovec(a, b, c, d, e) #else -#if defined(AFS_DARWIN80_ENV) -static int -m_cpytoiovec(mbuf_t m, int off, int len, struct iovec iovs[], int niovs) -{ - caddr_t p1, p2; - unsigned int l1, l2, i, t; - - if (m == NULL || off < 0 || len < 0 || iovs == NULL) - osi_Panic("m_cpytoiovec"); /* MTUXXX probably don't need this check */ - - while (off && m) - if (mbuf_len(m) <= off) { - off -= mbuf_len(m); - m = mbuf_next(m); - continue; - } else - break; - - if (m == NULL) - return len; - - - p1 = mbuf_data(m) + off; - l1 = mbuf_len(m) - off; - i = 0; - p2 = iovs[0].iov_base; - l2 = iovs[0].iov_len; - - while (len) { - t = MIN(l1, MIN(l2, (unsigned int)len)); - memcpy(p2, p1, t); - p1 += t; - p2 += t; - l1 -= t; - l2 -= t; - len -= t; - if (!l1) { - m = mbuf_next(m); - if (!m) - break; - p1 = mbuf_data(m); - l1 = mbuf_len(m); - } - if (!l2) { - if (++i >= niovs) - break; - p2 = iovs[i].iov_base; - l2 = iovs[i].iov_len; - } - - } - - return len; -} -#elif !defined(AFS_LINUX20_ENV) +#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN80_ENV) static int m_cpytoiovec(struct mbuf *m, int off, int len, struct iovec iovs[], int niovs) { diff --git a/src/sys/afssyscalls.c b/src/sys/afssyscalls.c index 1c3d9e6d4a..d519dd6537 100644 --- a/src/sys/afssyscalls.c +++ b/src/sys/afssyscalls.c @@ -392,7 +392,7 @@ lpioctl(char *path, int cmd, char *cmarg, int follow) if(rval) errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg, follow); #elif defined(AFS_DARWIN80_ENV) - if (ioctl_afs_syscall(AFSCALL_SETPAG,(long)path,(long)cmarg,follow,0,0,0,&errcode)) + if (ioctl_afs_syscall(AFSCALL_PIOCTL,(long)path,cmd,(long)cmarg,follow,0,0,&errcode)) errcode=ENOSYS; #else errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg, follow);