From: Derrick Brashear Date: Tue, 24 May 2005 21:32:36 +0000 (+0000) Subject: unroll-macos-104-20050523 X-Git-Tag: openafs-devel-1_5_0~551 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=0d57910b60b3283803464eb26cd0a33d16c2d7db unroll-macos-104-20050523 we'll finish it on a branch and remerge; 1.3.83 needs to happen and 1.4 needs to go out. ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== we'll finish it on a branch and remerge; 1.3.83 needs to happen and 1.4 needs to go out. --- diff --git a/src/afs/DARWIN/osi_machdep.h b/src/afs/DARWIN/osi_machdep.h index f7db2cd..409d64d 100644 --- a/src/afs/DARWIN/osi_machdep.h +++ b/src/afs/DARWIN/osi_machdep.h @@ -25,21 +25,12 @@ typedef unsigned short etap_event_t; #endif #endif -#ifdef AFS_DARWIN80_ENV -#include -#else #include -#include -#endif #include +#include -#ifdef AFS_DARWIN80_ENV -#define getpid() proc_selfpid() -#define getppid() proc_selfppid() -#else #define getpid() current_proc()->p_pid #define getppid() current_proc()->p_pptr->p_pid -#endif #undef gop_lookupname #define gop_lookupname osi_lookupname @@ -48,75 +39,13 @@ typedef unsigned short etap_event_t; /* 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 - -#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) - -#define vnode_clearfsnode(x) ((x)->v_data = 0) -#define vnode_fsnode(x) (x)->v_data -#define vnode_lock(x) vn_lock(x, LK_EXCLUSIVE | LK_RETRY, current_proc()); -#define vnode_isvroot(x) (((x)->v_flag & VROOT)?1:0) -#endif - -#ifdef AFS_DARWIN80_ENV -#define vrele vnode_rele -#define vput vnode_put -#define vref vnode_ref -#define vattr vnode_attr - -#define va_size va_data_size -#define va_atime va_access_time -#define va_mtime va_modify_time -#define va_ctime va_change_time -#define va_bytes va_total_alloc -#define va_blocksize va_iosize -#define va_nodeid va_fileid - -#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 - /* * Time related macros */ #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 @@ -138,22 +67,6 @@ static inline time_t osi_Time(void) { #ifdef KERNEL extern thread_t afs_global_owner; /* simple locks cannot be used since sleep can happen at any time */ -#ifdef AFS_DARWIN80_ENV -/* mach locks still don't have an exported try, but we are forced to use them */ -extern lck_mtx_t *afs_global_lock; -#define AFS_GLOCK() \ - do { \ - lk_mtx_lock(afs_global_lock); \ - osi_Assert(afs_global_owner == 0); \ - afs_global_owner = current_thread(); \ - } while (0) -#define AFS_GUNLOCK() \ - do { \ - osi_Assert(afs_global_owner == current_thread()); \ - afs_global_owner = 0; \ - lk_mtx_unlock(afs_global_lock); \ - } while(0) -#else /* Should probably use mach locks rather than bsd locks, since we use the mach thread control api's elsewhere (mach locks not used for consistency with rx, since rx needs lock_write_try() in order to use mach locks @@ -171,7 +84,6 @@ extern struct lock__bsd__ afs_global_lock; afs_global_owner = 0; \ lockmgr(&afs_global_lock, LK_RELEASE, 0, current_proc()); \ } while(0) -#endif #define ISAFS_GLOCK() (afs_global_owner == current_thread()) #define SPLVAR @@ -189,18 +101,14 @@ extern struct lock__bsd__ afs_global_lock; #define AFS_APPL_UFS_CACHE 1 #define AFS_APPL_HFS_CACHE 2 -extern ino_t VnodeToIno(struct vnode * vp); -extern dev_t VnodeToDev(struct vnode * vp); +extern ino_t VnodeToIno(vnode_t * vp); +extern dev_t VnodeToDev(vnode_t * 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_ */ diff --git a/src/afs/DARWIN/osi_misc.c b/src/afs/DARWIN/osi_misc.c index c776154..701b091 100644 --- a/src/afs/DARWIN/osi_misc.c +++ b/src/afs/DARWIN/osi_misc.c @@ -17,29 +17,6 @@ RCSID #include "afsincludes.h" #include -#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) @@ -60,50 +37,20 @@ osi_lookupname(char *aname, enum uio_seg seg, int followlink, 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 diff --git a/src/afs/DARWIN/osi_module.c b/src/afs/DARWIN/osi_module.c index cc8b86b..d4e1136 100644 --- a/src/afs/DARWIN/osi_module.c +++ b/src/afs/DARWIN/osi_module.c @@ -49,10 +49,6 @@ afs_modload(struct kmod_info *ki, void *data) #ifdef KERNEL_FUNNEL sysent[AFS_SYSCALL].sy_funnel = KERNEL_FUNNEL; #endif -#ifdef AFS_DARWIN80_ENV - MUTEX_SETUP(); - afs_global_lock = lck_mtx_alloc(openafs_lck_grp, 0); -#endif return KERN_SUCCESS; } @@ -71,10 +67,6 @@ afs_modunload(struct kmod_info * ki, void *data) /* give up the stolen syscall entry */ sysent[AFS_SYSCALL].sy_narg = 0; sysent[AFS_SYSCALL].sy_call = nosys; -#ifdef AFS_DARWIN80_ENV - MUTEX_FINISH(); - lck_mtx_free(afs_global_lock); -#endif return KERN_SUCCESS; } diff --git a/src/afs/DARWIN/osi_vfsops.c b/src/afs/DARWIN/osi_vfsops.c index 74b9bd4..64d085e 100644 --- a/src/afs/DARWIN/osi_vfsops.c +++ b/src/afs/DARWIN/osi_vfsops.c @@ -156,11 +156,7 @@ afs_unmount(mp, flags, p) if (flags & MNT_FORCE) { if (afs_globalVp) { AFS_GUNLOCK(); -#ifdef AFS_DARWIN80_ENV - vnode_rele(AFSTOV(afs_globalVp)); -#else vrele(AFSTOV(afs_globalVp)); -#endif AFS_GLOCK(); } afs_globalVp = NULL; @@ -252,11 +248,7 @@ 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; diff --git a/src/afs/DARWIN/osi_vnodeops.c b/src/afs/DARWIN/osi_vnodeops.c index 71e65e4..8fa5e0f 100644 --- a/src/afs/DARWIN/osi_vnodeops.c +++ b/src/afs/DARWIN/osi_vnodeops.c @@ -153,18 +153,10 @@ darwin_vn_hold(struct vnode *vp) ourselves during vop_inactive, except we also need to not reinst the ubc... so we just call VREF there now anyway. */ - if (VREFCOUNT_GT(tvc, 0)) -#ifdef AFS_DARWIN80_ENV - vnode_ref(vp); -#else + if (VREFCOUNT(tvc) > 0) VREF(((struct vnode *)(vp))); -#endif else -#ifdef AFS_DARWIN80_ENV - vnode_get(vp); -#else afs_vget(afs_globalVFS, 0, (vp)); -#endif if (UBCINFOMISSING(vp) || UBCINFORECLAIMED(vp)) { ubc_info_init(vp); diff --git a/src/afs/FBSD/osi_vm.c b/src/afs/FBSD/osi_vm.c index f584368..5634658 100644 --- a/src/afs/FBSD/osi_vm.c +++ b/src/afs/FBSD/osi_vm.c @@ -86,7 +86,7 @@ osi_VM_FlushVCache(struct vcache *avc, int *slept) { struct vm_object *obj; struct vnode *vp; - if (VREFCOUNT_GT(avc, 1)) + if (VREFCOUNT(avc) > 1) return EBUSY; if (avc->opens) diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index 2cfdb9c..a728851 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -63,7 +63,7 @@ extern struct simplelock afs_rxglobal_lock; #define AFS_PROC struct proc #define AFS_UCRED ucred #define afs_suser(x) afs_osi_suser(osi_curcred()) -#define getpid() (curproc->p_pid) +#define getpid() curproc #define osi_curcred() (curproc->p_cred->pc_ucred) #define osi_curproc() curproc #define p_rcred p_ucred diff --git a/src/afs/SOLARIS/osi_machdep.h b/src/afs/SOLARIS/osi_machdep.h index 22455ca..e596578 100644 --- a/src/afs/SOLARIS/osi_machdep.h +++ b/src/afs/SOLARIS/osi_machdep.h @@ -101,6 +101,4 @@ extern kmutex_t afs_rxglobal_lock; #define AfsLargeFileSize(pos, off) ( ((offset_t)(pos)+(offset_t)(off) > (offset_t)0x7fffffff)?1:0) #endif -/* for afs/VNOPS/afs_vnop_attrs.c */ -#define va_blocks va_nblocks #endif /* _OSI_MACHDEP_H_ */ diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index 2e53131..84fd3f2 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -93,8 +93,6 @@ afs_CopyOutAttrs(register struct vcache *avc, register struct vattr *attrs) attrs->va_fsid = avc->v.v_vfsp->vfs_fsid.val[0]; #elif defined(AFS_OSF_ENV) attrs->va_fsid = avc->v.v_mount->m_stat.f_fsid.val[0]; -#elif defined(AFS_DARWIN80_ENV) - VATTR_RETURN(attrs, va_fsid, vfs_statfs(vnode_mount(AFSTOV(avc)))->f_fsid.val[0]); #elif defined(AFS_DARWIN70_ENV) attrs->va_fsid = avc->v->v_mount->mnt_stat.f_fsid.val[0]; #else /* ! AFS_DARWIN70_ENV */ @@ -158,19 +156,26 @@ afs_CopyOutAttrs(register struct vcache *avc, register struct vattr *attrs) * Below return 0 (and not 1) blocks if the file is zero length. This conforms * better with the other filesystems that do return 0. */ -#ifdef AFS_HPUX_ENV - attrs->va_blocks = (attrs->va_size ? ((attrs->va_size + 1023) >> 10) : 0); +#if !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV) +#if !defined(AFS_HPUX_ENV) +#ifdef AFS_SUN5_ENV + attrs->va_nblocks = + (attrs->va_size ? ((attrs->va_size + 1023) >> 10) << 1 : 0); #elif defined(AFS_SGI_ENV) attrs->va_blocks = BTOBB(attrs->va_size); -#elif defined(AFS_XBSD_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) - attrs->va_bytes = (attrs->va_size ? (attrs->va_size + 1023) : 1024); -#ifdef va_bytes_rsv - attrs->va_bytes_rsv = -1; -#endif #else attrs->va_blocks = (attrs->va_size ? ((attrs->va_size + 1023) >> 10) << 1 : 0); #endif +#else /* !defined(AFS_HPUX_ENV) */ + attrs->va_blocks = (attrs->va_size ? ((attrs->va_size + 1023) >> 10) : 0); +#endif /* !defined(AFS_HPUX_ENV) */ +#else /* ! AFS_OSF_ENV && !AFS_DARWIN_ENV && !AFS_XBSD_ENV */ + attrs->va_bytes = (attrs->va_size ? (attrs->va_size + 1023) : 1024); +#ifdef va_bytes_rsv + attrs->va_bytes_rsv = -1; +#endif +#endif /* ! AFS_OSF_ENV && !AFS_DARWIN_ENV && !AFS_XBSD_ENV */ #ifdef AFS_LINUX22_ENV /* And linux has its own stash as well. */ @@ -296,13 +301,9 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, struct AFS_UCRED *acred) attrs->va_nodeid = ip->i_ino; } #else - if (vnode_isvroot(AFSTOV(avc))) { + if (AFSTOV(avc)->v_flag & VROOT) { struct vnode *vp = AFSTOV(avc); -#ifdef AFS_DARWIN80_ENV - /* XXX vp = vnode_mount(vp)->mnt_vnodecovered; */ - vp = 0; -#else vp = vp->v_vfsp->vfs_vnodecovered; if (vp) { /* Ignore weird failures */ #ifdef AFS_SGI62_ENV @@ -315,7 +316,6 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, struct AFS_UCRED *acred) attrs->va_nodeid = ip->i_number; #endif } -#endif } #endif /* AFS_LINUX22_ENV */ } diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 90fa84e..c82496a 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -1177,7 +1177,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED *avcp = tvc; code = (tvc ? 0 : ENOENT); hit = 1; - if (tvc && !VREFCOUNT_GT(tvc, 0)) { + if (tvc && !VREFCOUNT(tvc)) { osi_Panic("TT1"); } if (code) { @@ -1213,7 +1213,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED code = 0; *avcp = tvc = adp; hit = 1; - if (adp && !VREFCOUNT_GT(adp, 0)) { + if (adp && !VREFCOUNT(adp)) { osi_Panic("TT2"); } goto done; @@ -1497,7 +1497,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED } } *avcp = tvc; - if (tvc && !VREFCOUNT_GT(tvc, 0)) { + if (tvc && !VREFCOUNT(tvc)) { osi_Panic("TT3"); } code = 0; diff --git a/src/afs/VNOPS/afs_vnop_read.c b/src/afs/VNOPS/afs_vnop_read.c index 8b1c788..5efc7b4 100644 --- a/src/afs/VNOPS/afs_vnop_read.c +++ b/src/afs/VNOPS/afs_vnop_read.c @@ -60,13 +60,8 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, 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; @@ -94,11 +89,9 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, } #endif -#ifndef AFS_DARWIN80_ENV tvec = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec)); -#endif - totalLength = AFS_UIO_RESID(auio); - filePos = AFS_UIO_OFFSET(auio); + totalLength = auio->afsio_resid; + filePos = auio->afsio_offset; 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, @@ -308,15 +301,10 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, 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); -#endif - AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, tuiop, code); + AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, &tuio, code); if (code) { error = code; break; @@ -325,18 +313,12 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, /* 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, tuiop); + code = afs_MemReadUIO(tdc->f.inode, &tuio); if (code) { error = code; @@ -344,7 +326,7 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, } } /* otherwise we've read some, fixup length, etc and continue with next seg */ - len = len - AFS_UIO_RESID(tuiop); /* compute amount really transferred */ + len = len - tuio.afsio_resid; /* compute amount really transferred */ trimlen = len; afsio_skip(auio, trimlen); /* update input uio structure */ totalLength -= len; @@ -377,11 +359,7 @@ afs_MemRead(register struct vcache *avc, struct uio *auio, } 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; } @@ -470,13 +448,8 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, afs_int32 trimlen; struct dcache *tdc = 0; afs_int32 error; -#ifdef AFS_DARWIN80_ENV - uio_t tuiop; -#else struct uio tuio; - struct uio *tuiop = &tuio; struct iovec *tvec; -#endif struct osi_file *tfile; afs_int32 code; int trybusy = 1; @@ -510,11 +483,9 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, } #endif -#ifndef AFS_DARWIN80_ENV tvec = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec)); -#endif - totalLength = AFS_UIO_RESID(auio); - filePos = AFS_UIO_OFFSET(auio); + totalLength = auio->afsio_resid; + filePos = auio->afsio_offset; 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, @@ -715,15 +686,10 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, 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); -#endif - AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, tuiop, code); + AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, &tuio, code); if (code) { error = code; break; @@ -746,18 +712,11 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, #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 = @@ -837,16 +796,6 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, 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); @@ -877,7 +826,7 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, } } /* otherwise we've read some, fixup length, etc and continue with next seg */ - len = len - AFS_UIO_RESID(tuiop); /* compute amount really transferred */ + len = len - tuio.afsio_resid; /* compute amount really transferred */ trimlen = len; afsio_skip(auio, trimlen); /* update input uio structure */ totalLength -= len; @@ -905,11 +854,7 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio, 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; } diff --git a/src/afs/VNOPS/afs_vnop_remove.c b/src/afs/VNOPS/afs_vnop_remove.c index a00b80e..301e4e9 100644 --- a/src/afs/VNOPS/afs_vnop_remove.c +++ b/src/afs/VNOPS/afs_vnop_remove.c @@ -366,23 +366,20 @@ afs_remove(OSI_VC_ARG(adp), aname, acred) afs_symhint_inval(tvc); Tadp1 = adp; -#ifndef AFS_DARWIN80_ENV Tadpr = VREFCOUNT(adp); -#endif Ttvc = tvc; Tnam = aname; Tnam1 = 0; if (tvc) -#ifndef AFS_DARWIN80_ENV Ttvcr = VREFCOUNT(tvc); -#endif #ifdef AFS_AIX_ENV - if (tvc && VREFCOUNT_GT(tvc, 2) && tvc->opens > 0 - && !(tvc->states & CUnlinked)) { + if (tvc && (VREFCOUNT(tvc) > 2) && tvc->opens > 0 + && !(tvc->states & CUnlinked)) #else - if (tvc && VREFCOUNT_GT(tvc, 1) && tvc->opens > 0 - && !(tvc->states & CUnlinked)) { + if (tvc && (VREFCOUNT(tvc) > 1) && tvc->opens > 0 + && !(tvc->states & CUnlinked)) #endif + { char *unlname = afs_newname(); ReleaseWriteLock(&adp->lock); diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index 0d90649..4a93e55 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -105,13 +105,8 @@ afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, 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; @@ -258,20 +253,13 @@ afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, * 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, tuiop); + code = afs_MemWriteUIO(tdc->f.inode, &tuio); if (code) { void *mep; /* XXX in prototype world is struct memCacheEntry * */ error = code; @@ -286,7 +274,7 @@ afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, break; } /* otherwise we've written some, fixup length, etc and continue with next seg */ - len = len - AFS_UIO_RESID(tuiop); /* compute amount really transferred */ + len = len - tuio.afsio_resid; /* compute amount really transferred */ tlen = len; afsio_skip(auio, tlen); /* advance auio over data written */ /* compute new file size */ @@ -334,11 +322,7 @@ afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, 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; } @@ -362,13 +346,8 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, 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; @@ -413,12 +392,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, #if defined(AFS_SUN56_ENV) auio->uio_loffset = 0; #endif - filePos = avc->m.Length; -#ifdef AFS_DARWIN80_ENV - uio_setoffset(auio, avc->m.Length); -#else - auio->afsio_offset = avc->m.Length; -#endif + filePos = auio->afsio_offset = avc->m.Length; } #endif /* @@ -452,9 +426,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, 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 @@ -526,19 +498,11 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, * 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 = @@ -598,10 +562,6 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, 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()); @@ -639,7 +599,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, break; } /* otherwise we've written some, fixup length, etc and continue with next seg */ - len = len - AFS_UIO_RESID(tuiop); /* compute amount really transferred */ + len = len - tuio.afsio_resid; /* compute amount really transferred */ tlen = len; afsio_skip(auio, tlen); /* advance auio over data written */ /* compute new file size */ @@ -690,11 +650,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, 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 diff --git a/src/afs/afs.h b/src/afs/afs.h index 10ddf60..0205b75 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -557,20 +557,13 @@ struct SimpleLocks { #define vrefCount v.v_count #endif /* AFS_XBSD_ENV */ -#if defined(AFS_DARWIN80_ENV) -#define VREFCOUNT_GT(v, y) vnode_isinuse(AFSTOV(v), (y)) -#elif defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) -#define VREFCOUNT(v) ((v)->vrefCount) -#define VREFCOUNT_GT(v, y) (AFSTOV(v)->v_usecount > (y)) -#elif defined(AFS_LINUX24_ENV) +#if defined(AFS_LINUX24_ENV) #define VREFCOUNT(v) atomic_read(&((vnode_t *) v)->v_count) -#define VREFCOUNT_GT(v, y) ((atomic_read(&((vnode_t *) v)->v_count)>y)?1:0) #define VREFCOUNT_SET(v, c) atomic_set(&((vnode_t *) v)->v_count, c) #define VREFCOUNT_DEC(v) atomic_dec(&((vnode_t *) v)->v_count) #define VREFCOUNT_INC(v) atomic_inc(&((vnode_t *) v)->v_count) #else #define VREFCOUNT(v) ((v)->vrefCount) -#define VREFCOUNT_GT(v,y) ((v)->vrefCount > (y)) #define VREFCOUNT_SET(v, c) (v)->vrefCount = c; #define VREFCOUNT_DEC(v) (v)->vrefCount--; #define VREFCOUNT_INC(v) (v)->vrefCount++; @@ -601,10 +594,7 @@ struct vtodc { extern afs_uint32 afs_stampValue; /* stamp for pair's usage */ #define MakeStamp() (++afs_stampValue) -#if defined(AFS_DARWIN_ENV) -#define VTOAFS(v) ((struct vcache *)vnode_fsnode((v))) -#define AFSTOV(vc) ((vc)->v) -#elif defined(AFS_XBSD_ENV) +#if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) #define VTOAFS(v) ((struct vcache *)(v)->v_data) #define AFSTOV(vc) ((vc)->v) #else @@ -668,12 +658,8 @@ struct vcache { int ownslock; /* pid of owner of excl lock, else 0 - defect 3083 */ #endif #ifdef AFS_DARWIN_ENV -#ifdef AFS_DARWIN80_ENV - lck_mtx_t *rwlock; -#else struct lock__bsd__ rwlock; #endif -#endif #ifdef AFS_XBSD_ENV struct lock rwlock; #endif diff --git a/src/afs/afs_callback.c b/src/afs/afs_callback.c index ec73310..bc044c2 100644 --- a/src/afs/afs_callback.c +++ b/src/afs/afs_callback.c @@ -151,11 +151,7 @@ SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index, a_result->DataVersion = hgetlo(tvc->m.DataVersion); 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),0)?1:0; /* XXX fix */ -#else a_result->refCount = VREFCOUNT(tvc); -#endif a_result->opens = tvc->opens; a_result->writers = tvc->execsOrWriters; a_result->mvstat = tvc->mvstat; @@ -234,11 +230,7 @@ SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index, a_result->DataVersion = hgetlo(tvc->m.DataVersion); 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),0)?1:0; /* XXX fix */ -#else a_result->refCount = VREFCOUNT(tvc); -#endif a_result->opens = tvc->opens; a_result->writers = tvc->execsOrWriters; a_result->mvstat = tvc->mvstat; diff --git a/src/afs/afs_init.c b/src/afs/afs_init.c index a429ed3..219bd8b 100644 --- a/src/afs/afs_init.c +++ b/src/afs/afs_init.c @@ -381,9 +381,6 @@ afs_InitCacheInfo(register char *afile) 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) @@ -416,9 +413,7 @@ afs_InitCacheInfo(register char *afile) #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 */ diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index 279238b..786ec62 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -181,13 +181,13 @@ afs_MemReadUIO(ino_t blkno, struct uio *uioP) { register struct memCacheEntry *mceP = (struct memCacheEntry *)afs_MemCacheOpen(blkno); - int length = mceP->size - AFS_UIO_OFFSET(uioP); + int length = mceP->size - uioP->uio_offset; afs_int32 code; AFS_STATCNT(afs_MemReadUIO); MObtainReadLock(&mceP->afs_memLock); - length = (length < AFS_UIO_RESID(uioP)) ? length : AFS_UIO_RESID(uioP); - AFS_UIOMOVE(mceP->data + AFS_UIO_OFFSET(uioP), length, UIO_READ, uioP, code); + length = (length < uioP->uio_resid) ? length : uioP->uio_resid; + AFS_UIOMOVE(mceP->data + uioP->uio_offset, length, UIO_READ, uioP, code); MReleaseReadLock(&mceP->afs_memLock); return code; } @@ -282,25 +282,25 @@ afs_MemWriteUIO(ino_t blkno, struct uio *uioP) AFS_STATCNT(afs_MemWriteUIO); MObtainWriteLock(&mceP->afs_memLock, 312); - if (AFS_UIO_RESID(uioP) + AFS_UIO_OFFSET(uioP) > mceP->dataSize) { + if (uioP->uio_resid + uioP->uio_offset > mceP->dataSize) { char *oldData = mceP->data; - mceP->data = afs_osi_Alloc(AFS_UIO_RESID(uioP) + AFS_UIO_OFFSET(uioP)); + mceP->data = afs_osi_Alloc(uioP->uio_resid + uioP->uio_offset); AFS_GUNLOCK(); memcpy(mceP->data, oldData, mceP->size); AFS_GLOCK(); afs_osi_Free(oldData, mceP->dataSize); - mceP->dataSize = AFS_UIO_RESID(uioP) + AFS_UIO_OFFSET(uioP); + mceP->dataSize = uioP->uio_resid + uioP->uio_offset; } - if (mceP->size < AFS_UIO_OFFSET(uioP)) + if (mceP->size < uioP->uio_offset) memset(mceP->data + mceP->size, 0, - (int)(AFS_UIO_OFFSET(uioP) - mceP->size)); - AFS_UIOMOVE(mceP->data + AFS_UIO_OFFSET(uioP), AFS_UIO_RESID(uioP), UIO_WRITE, + (int)(uioP->uio_offset - mceP->size)); + AFS_UIOMOVE(mceP->data + uioP->uio_offset, uioP->uio_resid, UIO_WRITE, uioP, code); - if (AFS_UIO_OFFSET(uioP) > mceP->size) - mceP->size = AFS_UIO_OFFSET(uioP); + if (uioP->uio_offset > mceP->size) + mceP->size = uioP->uio_offset; MReleaseWriteLock(&mceP->afs_memLock); return code; diff --git a/src/afs/afs_osi.c b/src/afs/afs_osi.c index 7b6d260..3ea337a 100644 --- a/src/afs/afs_osi.c +++ b/src/afs/afs_osi.c @@ -60,9 +60,7 @@ osi_Init(void) #elif defined(AFS_FBSD50_ENV) mtx_init(&afs_global_mtx, "AFS global lock", NULL, MTX_DEF); #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) -#if !defined(AFS_DARWIN80_ENV) lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0); -#endif afs_global_owner = 0; #elif defined(AFS_AIX41_ENV) lock_alloc((void *)&afs_global_lock, LOCK_ALLOC_PIN, 1, 1); @@ -286,7 +284,6 @@ afs_osi_Invisible(void) 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; @@ -768,7 +765,7 @@ afs_osi_TraverseProcTable(void) } #endif -#if (defined(AFS_DARWIN_ENV) && !defined(AFS_DARWIN80_ENV)) || defined(AFS_FBSD_ENV) +#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) void afs_osi_TraverseProcTable(void) { @@ -992,25 +989,6 @@ afs_osi_proc2cred(AFS_PROC * pr) 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) diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index ed3919a..2e2879d 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -123,19 +123,21 @@ struct afs_osi_WaitHandle { /* * Vnode related macros */ -#if defined(AFS_DARWIN80_ENV) -#define vType(vc) vnode_vtype(AFSTOV(vc)) -#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) +#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_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 -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) +#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 extern struct vnodeops *afs_ops; #define IsAfsVnode(v) ((v)->v_op == afs_ops) #define SetAfsVnode(v) (v)->v_op = afs_ops @@ -302,18 +304,6 @@ typedef struct timeval osi_timeval_t; 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 { \ @@ -336,7 +326,6 @@ typedef struct timeval osi_timeval_t; AFS_GLOCK(); \ } while(0) #endif -#endif /* AFS_DARWIN80_ENV */ #else /* AFS_GLOBAL_SUNLOCK */ @@ -355,13 +344,6 @@ typedef struct timeval osi_timeval_t; 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 { \ @@ -374,19 +356,9 @@ typedef struct timeval osi_timeval_t; 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 */ diff --git a/src/afs/afs_osi_pag.c b/src/afs/afs_osi_pag.c index 8c64aec..eb51996 100644 --- a/src/afs/afs_osi_pag.c +++ b/src/afs/afs_osi_pag.c @@ -241,12 +241,6 @@ afs_setpag(void) 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); diff --git a/src/afs/afs_osi_uio.c b/src/afs/afs_osi_uio.c index 8b55c0c..b072dd5 100644 --- a/src/afs/afs_osi_uio.c +++ b/src/afs/afs_osi_uio.c @@ -25,7 +25,6 @@ RCSID * 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, @@ -77,7 +76,6 @@ afsio_trim(register struct uio *auio, register afs_int32 asize) } return 0; } -#endif /* skip asize bytes in the current uio structure */ int @@ -87,9 +85,6 @@ afsio_skip(register struct uio *auio, register afs_int32 asize) 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; @@ -107,6 +102,5 @@ afsio_skip(register struct uio *auio, register afs_int32 asize) auio->uio_offset += cnt; asize -= cnt; } -#endif return 0; } diff --git a/src/afs/afs_osi_vget.c b/src/afs/afs_osi_vget.c index aea7f7a..40e0a9b 100644 --- a/src/afs/afs_osi_vget.c +++ b/src/afs/afs_osi_vget.c @@ -23,7 +23,7 @@ RCSID -#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN80_ENV) +#if !defined(AFS_LINUX20_ENV) /* This is the common part of the vget VFS call. */ int afs_osi_vget(struct vcache **avcpp, struct fid *afidp, struct vrequest *areqp) diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index f2e9e0e..1fc969e 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -532,9 +532,7 @@ extern int afsio_skip(struct uio *auio, afs_int32 asize); /* ARCH/osi_misc.c */ -#ifdef AFS_LINUX20_ENV extern void osi_iput(struct inode *ip); -#endif extern void afs_osi_SetTime(osi_timeval_t * atv); /* LINUX/osi_misc.c */ diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index ed0ff1d..7f8b53c 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -1139,43 +1139,24 @@ afsi_SetServerIPRank(struct srvAddr *sa, struct in_ifaddr *ifa) 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 (ifaddr_address_family(ifa) != AF_INET) + if (ifa->ifa_addr->sa_family != AF_INET) return; - 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; - } + sin = (struct sockaddr_in *)ifa->ifa_addr; + myAddr = ntohl(sin->sin_addr.s_addr); /* one of my IP addr in host order */ serverAddr = ntohl(sa->sa_ip); /* server's IP addr in host order */ - 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; + 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) myDstaddr = sin->sin_addr.s_addr; - } else { - myDstaddr = 0; - } if (IN_CLASSA(myAddr)) netMask = IN_CLASSA_NET; @@ -1194,20 +1175,20 @@ afsi_SetServerIPRank(sa, ifa) 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 + ifnet_metric(ifaddr_ifnet(ifa))); + sa->sa_iprank = afs_min(sa->sa_iprank, HI + ifa->ifa_metric); } } else { /* same net */ - sa->sa_iprank = afs_min(sa->sa_iprank, MED + ifnet_metric(ifaddr_ifnet(ifa))); + sa->sa_iprank = afs_min(sa->sa_iprank, MED + ifa->ifa_metric); } } #ifdef IFF_POINTTOPOINT /* check for case #4 -- point-to-point link */ - if ((ifnet_flags(ifaddr_ifnet(ifa)) & IFF_POINTOPOINT) + if ((ifa->ia_ifp->if_flags & IFF_POINTOPOINT) && (myDstaddr == serverAddr)) { - if (ifnet_metric(ifaddr_ifnet(ifa)) >= (MAXDEFRANK - MED) / PPWEIGHT) + if (ifa->ia_ifp->if_metric >= (MAXDEFRANK - MED) / PPWEIGHT) t = MAXDEFRANK; else - t = MED + (PPWEIGHT << ifnet_metric(ifaddr_ifnet(ifa))); + t = MED + (PPWEIGHT << ifa->->ifa_metric); if (sa->sa_iprank > t) sa->sa_iprank = t; } @@ -1380,20 +1361,6 @@ static int afs_SetServerPrefs(struct srvAddr *sa) { #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; diff --git a/src/afs/afs_util.c b/src/afs/afs_util.c index cb13b38..0d6e37c 100644 --- a/src/afs/afs_util.c +++ b/src/afs/afs_util.c @@ -273,12 +273,8 @@ afs_CheckLocks(void) #ifdef AFS_OSF_ENV if (VREFCOUNT(tvc) > 1) #else /* AFS_OSF_ENV */ -#ifdef AFS_DARWIN80_ENV - if (vnode_isinuse(AFSTOV(tvc), 0)) -#else if (VREFCOUNT(tvc)) #endif -#endif afs_warn("Stat cache entry at %x is held\n", tvc); if (CheckLock(&tvc->lock)) afs_warn("Stat entry at %x is locked\n", tvc); diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 0d19994..820de02 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -187,12 +187,8 @@ 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 - vnode_clearfsnode(AFSTOV(avc)); -#else avc->v->v_data = NULL; /* remove from vnode */ -#endif - AFSTOV(avc) = NULL; /* also drop the ptr to vnode */ + avc->v = NULL; /* also drop the ptr to vnode */ } #endif afs_FreeAllAxs(&(avc->Access)); @@ -235,7 +231,7 @@ afs_FlushVCache(struct vcache *avc, int *slept) /* This should put it back on the vnode free list since usecount is 1 */ afs_vcount--; vSetType(avc, VREG); - if (VREFCOUNT_GT(avc,0)) { + if (VREFCOUNT(avc) > 0) { VN_UNLOCK(AFSTOV(avc)); AFS_RELE(AFSTOV(avc)); } else { @@ -619,11 +615,10 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) refpanic("Exceeded pool of AFS vnodes(VLRU cycle?)"); else if (QNext(uq) != tq) refpanic("VLRU inconsistent"); - else if (!VREFCOUNT_GT(tvc,0)) - refpanic("refcnt 0 on VLRU"); - - if (VREFCOUNT_GT(tvc,0) && !VREFCOUNT_GT(tvc,1) && - tvc->opens == 0 + else if (VREFCOUNT(tvc) < 1) + refpanic("refcnt 0 on VLRU"); + + if (VREFCOUNT(tvc) == 1 && tvc->opens == 0 && (tvc->states & CUnlinkedDel) == 0) { code = afs_FlushVCache(tvc, &fv_slept); if (code == 0) { @@ -716,13 +711,12 @@ restart: } #endif - - if (!VREFCOUNT_GT(tvc,0) -#if defined(AFS_DARWIN_ENV) && !defined(UKERNEL) && !defined(AFS_DARWIN80_ENV) - || ((VREFCOUNT(tvc) == 1) && - (UBCINFOEXISTS(AFSTOV(tvc)))) + if (((VREFCOUNT(tvc) == 0) +#if defined(AFS_DARWIN_ENV) && !defined(UKERNEL) + || ((VREFCOUNT(tvc) == 1) && + (UBCINFOEXISTS(AFSTOV(tvc)))) #endif - && tvc->opens == 0 && (tvc->states & CUnlinkedDel) == 0) { + ) && tvc->opens == 0 && (tvc->states & CUnlinkedDel) == 0) { #if defined (AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) /* * vgone() reclaims the vnode, which calls afs_FlushVCache(), @@ -813,12 +807,8 @@ restart: AFS_GUNLOCK(); afs_darwin_getnewvnode(tvc); /* includes one refcount */ AFS_GLOCK(); -#ifdef AFS_DARWIN80_ENV - LOCKINIT(tvc->rwlock); -#else lockinit(&tvc->rwlock, PINOD, "vcache", 0, 0); #endif -#endif #ifdef AFS_FBSD_ENV { struct vnode *vp; @@ -1178,7 +1168,7 @@ afs_FlushActiveVcaches(register afs_int32 doflocks) /* * That's because if we come in via the CUnlinkedDel bit state path we'll be have 0 refcnt */ - osi_Assert(VREFCOUNT_GT(tvc,0)); + osi_Assert(VREFCOUNT(tvc) > 0); AFS_RWLOCK((vnode_t *) tvc, VRWLOCK_WRITE); #endif ObtainWriteLock(&tvc->lock, 52); @@ -1738,7 +1728,7 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq, #if defined(AFS_DARWIN_ENV) iheldthelock = VOP_ISLOCKED(vp); if (!iheldthelock) - vnode_lock(vp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, current_proc()); /* this is messy. we can call fsync which will try to reobtain this */ if (VTOAFS(vp) == tvc) ReleaseWriteLock(&tvc->lock); @@ -1748,11 +1738,7 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq, if (VTOAFS(vp) == tvc) ObtainWriteLock(&tvc->lock, 954); if (!iheldthelock) -#ifdef AFS_DARWIN80_ENV - vnode_unlock(vp); -#else VOP_UNLOCK(vp, LK_EXCLUSIVE, current_proc()); -#endif #elif defined(AFS_FBSD60_ENV) iheldthelock = VOP_ISLOCKED(vp, curthread); if (!iheldthelock) @@ -2853,7 +2839,7 @@ shutdown_vcache(void) vms_delete(tvc->segid); AFS_GLOCK(); tvc->segid = tvc->vmh = NULL; - if (VREFCOUNT_GT(tvc,0)) + if (VREFCOUNT(tvc)) osi_Panic("flushVcache: vm race"); } if (tvc->credp) { diff --git a/src/afs/lock.h b/src/afs/lock.h index 80e3b79..a5d8253 100644 --- a/src/afs/lock.h +++ b/src/afs/lock.h @@ -107,11 +107,7 @@ extern tid_t thread_self(); #define MyPidxx current->pid #else #if defined(AFS_DARWIN_ENV) -#if defined(AFS_DARWIN80_ENV) -#define MyPidxx (proc_selfpid()) -#else #define MyPidxx (current_proc()->p_pid ) -#endif #else #if defined(AFS_FBSD_ENV) #define MyPidxx (curproc->p_pid ) diff --git a/src/afs/sysincludes.h b/src/afs/sysincludes.h index ade3cdc..33c049d 100644 --- a/src/afs/sysincludes.h +++ b/src/afs/sysincludes.h @@ -214,7 +214,7 @@ typedef unsigned short etap_event_t; # include "h/dir.h" #endif /* SGI || SUN || HPUX */ -#if !defined(AFS_SGI64_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN80_ENV) +#if !defined(AFS_SGI64_ENV) && !defined(AFS_FBSD_ENV) #include "h/user.h" #endif /* AFS_SGI64_ENV */ #define MACH_USER_API 1 @@ -251,11 +251,7 @@ struct vop_getwritemount_args; # include # include # include -#ifdef AFS_DARWIN80_ENV -# include -#else # include -#endif # include # include #ifndef AFS_FBSD_ENV @@ -275,11 +271,9 @@ MALLOC_DECLARE(M_AFS); #undef timeout_fcn_t #define _DIR_H_ #define doff_t int32_t -#ifndef AFS_DARWIN80_ENV # include # include # include -#endif #else # include "h/vfs.h" # include "h/vnode.h" diff --git a/src/config/param.i386_linux26.h b/src/config/param.i386_linux26.h index e89e5ef..60146da 100644 --- a/src/config/param.i386_linux26.h +++ b/src/config/param.i386_linux26.h @@ -30,8 +30,8 @@ #if defined(__KERNEL__) && !defined(KDUMP_KERNEL) #include + #include -#include #ifdef CONFIG_SMP #ifndef AFS_SMP #define AFS_SMP 1 diff --git a/src/config/param.ppc_darwin_80.h b/src/config/param.ppc_darwin_80.h index 2ab604c..443166b 100644 --- a/src/config/param.ppc_darwin_80.h +++ b/src/config/param.ppc_darwin_80.h @@ -39,7 +39,7 @@ #define AFSBIG_ENDIAN 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ -#define AFS_GCPAGS 0 +#define AFS_GCPAGS 1 /* if nonzero, garbage collect PAGs */ #define RXK_LISTENER_ENV 1 #ifdef KERNEL @@ -66,7 +66,10 @@ #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 diff --git a/src/libafs/MakefileProto.DARWIN.in b/src/libafs/MakefileProto.DARWIN.in index 7bee813..20ecf6c 100644 --- a/src/libafs/MakefileProto.DARWIN.in +++ b/src/libafs/MakefileProto.DARWIN.in @@ -33,8 +33,6 @@ AFS_OS_NONFSOBJS = osi_vfsops.o KDEFS= DBUG = DEFINES= -D_KERNEL -DKERNEL -DKERNEL_PRIVATE -DDIAGNOSTIC -DUSE_SELECT -DMACH_USER_API -DMACH_KERNEL - -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 KOPTS=-static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch diff --git a/src/rx/DARWIN/rx_kmutex.c b/src/rx/DARWIN/rx_kmutex.c index e7514ee..f4c7f7b 100644 --- a/src/rx/DARWIN/rx_kmutex.c +++ b/src/rx/DARWIN/rx_kmutex.c @@ -19,26 +19,6 @@ RCSID ("$Header$"); -#ifndef AFS_DARWIN80_ENV /* * Currently everything is implemented in rx_kmutex.h */ -#else -lck_grp_t * openafs_lck_grp; -static lck_grp_attr_t * openafs_lck_grp_attr; -void rx_kmutex_setup(void) { - openafs_lck_grp_attr= lck_grp_attr_alloc_init(); - lck_grp_attr_setstat(openafs_lck_grp_attr); - - openafs_lck_grp = lck_grp_alloc_init("openafs", openafs_lck_grp_attr); - lck_grp_attr_free(openafs_lck_grp_attr); - -} - -void rx_kmutex_finish(void) { - lck_grp_free(openafs_lck_grp); -} - -#endif - - diff --git a/src/rx/DARWIN/rx_kmutex.h b/src/rx/DARWIN/rx_kmutex.h index 92275d0..563c3a2 100644 --- a/src/rx/DARWIN/rx_kmutex.h +++ b/src/rx/DARWIN/rx_kmutex.h @@ -82,59 +82,14 @@ #define CV_BROADCAST(cv) thread_wakeup((event_t)(cv)) #endif -#ifdef AFS_DARWIN80_ENV -typedef struct { - lck_mtx_t *lock; - thread_t owner; -} afs_kmutex_t; -typedef int afs_kcondvar_t; - -extern lck_grp_t * openafs_lck_grp; - -#define MUTEX_SETUP() rx_kmutex_setup() -#define MUTEX_FINISH() rx_kmutex_finish() -#define LOCKINIT(a) \ - do { \ - lck_attr_t * openafs_lck_attr = lck_attr_alloc_init(); \ - (a) = lck_mtx_alloc_init(openafs_lck_grp, openafs_lck_attr); \ - lck_attr_free(openafs_lck_attr); \ - } while(0); -#define MUTEX_INIT(a,b,c,d) \ - do { \ - lck_attr_t * openafs_lck_attr = lck_attr_alloc_init(); \ - (a)->lock = lck_mtx_alloc_init(openafs_lck_grp, openafs_lck_attr); \ - lck_attr_free(openafs_lck_attr); \ - (a)->owner = (thread_t)0; \ - } while(0); -#define MUTEX_DESTROY(a) \ - do { \ - lck_mtx_destroy((a)->lock, openafs_lck_grp); \ - (a)->owner = (thread_t)-1; \ - } while(0); -#define MUTEX_ENTER(a) \ - do { \ - lck_mtx_lock(&(a)->lock); \ - osi_Assert((a)->owner == (thread_t)0); \ - (a)->owner = current_thread(); \ - } while(0); -#define MUTEX_TRYENTER(a) \ - (lck_mtx_try_lock(&(a)->lock) ? ((a)->owner = current_thread(), 1) : 0) -#define MUTEX_EXIT(a) \ - do { \ - osi_Assert((a)->owner == current_thread()); \ - (a)->owner = (thread_t)0; \ - lck_mtx_unlock(&(a)->lock); \ - } while(0); - -#undef MUTEX_ISMINE -#define MUTEX_ISMINE(a) (((afs_kmutex_t *)(a))->owner == current_thread()) -#else typedef struct { struct lock__bsd__ lock; thread_t owner; } afs_kmutex_t; typedef int afs_kcondvar_t; +#define osi_rxWakeup(cv) thread_wakeup((event_t)(cv)) + #define LOCK_INIT(a,b) \ do { \ lockinit(&(a)->lock,PSOCK, "afs rx lock", 0, 0); \ @@ -157,6 +112,8 @@ typedef int afs_kcondvar_t; } while(0); #define MUTEX_TRYENTER(a) \ ( lockmgr(&(a)->lock, LK_EXCLUSIVE|LK_NOWAIT, 0, current_proc()) ? 0 : ((a)->owner = current_thread(), 1) ) +#define xMUTEX_TRYENTER(a) \ + ( osi_Assert((a)->owner == (thread_t)0), (a)->owner = current_thread(), 1) #define MUTEX_EXIT(a) \ do { \ osi_Assert((a)->owner == current_thread()); \ @@ -166,7 +123,6 @@ typedef int afs_kcondvar_t; #undef MUTEX_ISMINE #define MUTEX_ISMINE(a) (((afs_kmutex_t *)(a))->owner == current_thread()) -#endif #undef osirx_AssertMine extern void osirx_AssertMine(afs_kmutex_t * lockaddr, char *msg); diff --git a/src/rx/xdr_prototypes.h b/src/rx/xdr_prototypes.h index 5c1898e..8d0870e 100644 --- a/src/rx/xdr_prototypes.h +++ b/src/rx/xdr_prototypes.h @@ -10,7 +10,13 @@ #ifndef _XDR_PROTOTYPES_H #define _XDR_PROTOTYPES_H -struct rx_call; +/* I don't like this, but some of these defs depend on rx.h */ +#if defined(KERNEL) && defined(UKERNEL) +#include "afs/sysincludes.h" +#include "rx/rx.h" +#else +#include "rx/rx.h" +#endif /* xdr_afsuuid.c */ extern int xdr_afsUUID(XDR * xdrs, afsUUID * objp);