freebsd-50-20030416
authorJim Rees <rees@umich.edu>
Wed, 16 Apr 2003 23:28:52 +0000 (23:28 +0000)
committerJim Rees <rees@umich.edu>
Wed, 16 Apr 2003 23:28:52 +0000 (23:28 +0000)
More FreeBSD 5.0. Most of it builds now.

17 files changed:
src/afs/FBSD/osi_file.c
src/afs/FBSD/osi_groups.c
src/afs/FBSD/osi_inode.c
src/afs/FBSD/osi_machdep.h
src/afs/FBSD/osi_misc.c
src/afs/FBSD/osi_vfsops.c
src/afs/FBSD/osi_vm.c
src/afs/FBSD/osi_vnodeops.c
src/afs/VNOPS/afs_vnop_strategy.c
src/afs/afs_analyze.c
src/afs/afs_init.c
src/afs/sysincludes.h
src/config/param.i386_fbsd_50.h
src/rx/FBSD/rx_kmutex.h
src/rx/FBSD/rx_knet.c
src/rx/rx_kcommon.c
src/rx/rx_kcommon.h

index 86016c6..22fc559 100644 (file)
@@ -123,7 +123,6 @@ int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_in
 {
     unsigned int resid;
     register afs_int32 code;
-    register afs_int32 cnt1=0;
     AFS_STATCNT(osi_Read);
 
     /**
index 1c70217..9a8984a 100644 (file)
  */
 #include <afsconfig.h>
 #include "afs/param.h"
+#include <sys/param.h>
+#ifdef AFS_FBSD50_ENV
+#include <sys/sysproto.h>
+#endif
 
 RCSID("$Header$");
 
@@ -37,6 +41,52 @@ afs_setgroups(
     gid_t *gidset,
     int change_parent);
 
+#ifdef AFS_FBSD50_ENV
+/*
+ * This does nothing useful yet.
+ * In 5.0, creds are associated not with a process, but with a thread.
+ * Probably the right thing to do is replace struct proc with struct thread
+ * everywhere, including setpag.
+ * That will be a tedious undertaking.
+ * For now, I'm just passing curproc to AddPag.
+ * This is probably wrong and I don't know what the consequences might be.
+ */
+
+int
+Afs_xsetgroups(struct thread *td, struct setgroups_args *uap)
+{
+    int code = 0;
+    struct vrequest treq;
+    struct ucred *cr;
+
+    cr = crdup(td->td_ucred);
+
+    AFS_STATCNT(afs_xsetgroups);
+    AFS_GLOCK();
+
+    code = afs_InitReq(&treq, cr);
+    AFS_GUNLOCK();
+    crfree(cr);
+    if (code) return setgroups(td, uap); /* afs has shut down */
+
+    code = setgroups(td, uap);
+    /* Note that if there is a pag already in the new groups we don't
+     * overwrite it with the old pag.
+     */
+    cr = crdup(td->td_ucred);
+
+    if (PagInCred(cr) == NOPAG) {
+       if (((treq.uid >> 24) & 0xff) == 'A') {
+           AFS_GLOCK();
+           /* we've already done a setpag, so now we redo it */
+           AddPag(curproc, treq.uid, &cr);
+           AFS_GUNLOCK();
+       }
+    }
+    crfree(cr);
+    return code;
+}
+#else /* FBSD50 */
 int
 Afs_xsetgroups(p, args, retval)
     struct proc *p;
@@ -74,6 +124,7 @@ Afs_xsetgroups(p, args, retval)
     crfree(cr);
     return code;
 }
+#endif
 
 
 int
@@ -125,7 +176,6 @@ afs_getgroups(
 }
 
 
-
 static int
 afs_setgroups(
     struct proc *proc,
@@ -134,6 +184,7 @@ afs_setgroups(
     gid_t *gidset,
     int change_parent)
 {
+#ifndef AFS_FBSD50_ENV
     int ngrps;
     int i;
     gid_t *gp;
@@ -161,5 +212,6 @@ afs_setgroups(
     oldcr=proc->p_cred->pc_ucred;
     proc->p_cred->pc_ucred=cr;
     crfree(oldcr);
+#endif
     return(0);
 }
index 262bf5f..d57a822 100644 (file)
@@ -24,9 +24,13 @@ RCSID("$Header$");
 #include "afs/afs_stats.h" /* statistics stuff */
 #include <sys/queue.h>
 #include <sys/lock.h>
-#include <ufs/ufsmount.h>
 #include <ufs/ufs/dinode.h>
+#if defined(AFS_FBSD50_ENV)
+#include <ufs/ufs/extattr.h>
+#endif
+#include <ufs/ufsmount.h>
 
+int
 getinode(fs, dev, inode, ipp, perror)
      struct mount *fs;
      struct inode **ipp;
@@ -42,15 +46,19 @@ getinode(fs, dev, inode, ipp, perror)
     if (!fs) {
        register struct ufsmount *ump;
        register struct mount *mp;
-       
-        simple_lock(&mountlist_slock);
+
+#if defined(AFS_FBSD50_ENV)
+       mtx_lock(&mountlist_mtx);
+#else
+       simple_lock(&mountlist_slock);
+#endif
        if (mp = TAILQ_FIRST(&mountlist)) do {
            /*
-            * XXX Also do the test for MFS 
+            * XXX Also do the test for MFS
             */
 #undef m_data
 #undef m_next
-           if (mp->mnt_stat.f_type == MOUNT_UFS) {     
+           if (mp->mnt_stat.f_type == MOUNT_UFS) {
                ump = VFSTOUFS(mp);
                if (ump->um_fs == NULL)
                    break;
@@ -60,11 +68,19 @@ getinode(fs, dev, inode, ipp, perror)
            }
            mp = TAILQ_NEXT(mp, mnt_list);
        } while (mp != TAILQ_FIRST(&mountlist));
+#if defined(AFS_FBSD50_ENV)
+        mtx_unlock(&mountlist_mtx);
+#else
         simple_unlock(&mountlist_slock);
+#endif
        if (!fs)
            return(ENXIO);
     }
-    code = VFS_VGET(fs,inode, &vp);
+#if defined(AFS_FBSD50_ENV)
+    code = VFS_VGET(fs, inode, 0, &vp);
+#else
+    code = VFS_VGET(fs, inode, &vp);
+#endif
     if (code != 0) {
        *perror = BAD_IGET;
         return code;
@@ -74,6 +90,7 @@ getinode(fs, dev, inode, ipp, perror)
     }
 }
 
+int
 igetinode(vfsp, dev, inode, ipp, perror)
      struct inode **ipp;
      struct mount *vfsp;
@@ -81,8 +98,7 @@ igetinode(vfsp, dev, inode, ipp, perror)
      ino_t inode;
      int *perror;
 {
-    struct inode *pip, *ip;
-    extern struct osi_dev cacheDev;
+    struct inode *ip;
     register int code = 0;
 
     *perror = 0;
@@ -95,12 +111,12 @@ igetinode(vfsp, dev, inode, ipp, perror)
 
     if (ip->i_mode == 0) {
        /* Not an allocated inode */
-       vput(ITOV(ip));     
+       vput(ITOV(ip));
        return(ENOENT);
     }
 
     if (ip->i_nlink == 0 || (ip->i_mode&IFMT) != IFREG) {
-       vput(ITOV(ip));     
+       vput(ITOV(ip));
        return(ENOENT);
     }
 
@@ -186,6 +202,7 @@ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval)
 }
 
 
+int
 afs_syscall_iopen(dev, inode, usrmod, retval)
      long *retval;
      int dev, inode, usrmod;
@@ -231,6 +248,7 @@ afs_syscall_iopen(dev, inode, usrmod, retval)
  * Restricted to super user.
  * Only VICEMAGIC type inodes.
  */
+int
 afs_syscall_iincdec(dev, inode, inode_p1, amount)
      int dev, inode, inode_p1, amount;
 {
@@ -259,18 +277,23 @@ afs_syscall_iincdec(dev, inode, inode_p1, amount)
     return(0);
 }
 #else
+int
 afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval)
      long *retval;
      long dev, near_inode, param1, param2, param3, param4;
 {
      return EOPNOTSUPP;
 }
+
+int
 afs_syscall_iopen(dev, inode, usrmod, retval)
      long *retval;
      int dev, inode, usrmod;
 {
      return EOPNOTSUPP;
 }
+
+int
 afs_syscall_iincdec(dev, inode, inode_p1, amount)
      int dev, inode, inode_p1, amount;
 {
index 2dfa67b..c714a86 100644 (file)
@@ -42,8 +42,6 @@ extern struct simplelock afs_rxglobal_lock;
 
 #define osi_vnhold(avc,r) do { VN_HOLD((struct vnode *)(avc)); } while (0)
 
-#define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
-  vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
 #undef gop_lookupname
 #define gop_lookupname osi_lookupname
 
@@ -51,10 +49,16 @@ extern struct simplelock afs_rxglobal_lock;
 
 #ifdef KERNEL
 extern struct lock afs_global_lock;
+
 #if defined(AFS_FBSD50_ENV)
 #define VT_AFS         "afs"
 #define VROOT          VV_ROOT
 #define v_flag         v_vflag
+#define afs_suser()    (!suser(curthread))
+#define simple_lock(x) mtx_lock(x)
+#define simple_unlock(x) mtx_unlock(x)
+#define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
+  vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(cred),(aresid), curthread)
 extern struct thread * afs_global_owner;
 #define AFS_GLOCK() \
     do { \
@@ -71,7 +75,11 @@ extern struct thread * afs_global_owner;
         lockmgr(&afs_global_lock, LK_RELEASE, 0, curthread); \
     } while(0)
 #define ISAFS_GLOCK() (afs_global_owner == curthread && curthread)
+
 #else /* FBSD50 */
+
+#define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
+  vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
 extern struct proc * afs_global_owner;
 #define AFS_GLOCK() \
     do { \
@@ -89,6 +97,7 @@ extern struct proc * afs_global_owner;
     } while(0)
 #define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
 #endif /* FBSD50 */
+
 #define AFS_RXGLOCK()
 #define AFS_RXGUNLOCK()
 #define ISAFS_RXGLOCK() 1
index a073b92..197822b 100644 (file)
@@ -22,6 +22,8 @@ RCSID("$Header$");
 #include "afs/sysincludes.h"   /* Standard vendor system headers */
 #include "afsincludes.h"       /* Afs-based standard headers */
 #include <sys/namei.h>
+
+#ifndef AFS_FBSD50_ENV
 /*
  * afs_suser() returns true if the caller is superuser, false otherwise.
  *
@@ -36,6 +38,7 @@ afs_suser() {
     }
     return(0);
 }
+#endif
 
 int osi_lookupname(char *aname, enum uio_seg seg, int followlink,
                           struct vnode **dirvpp, struct vnode **vpp)
index 9eaf227..4ac23d0 100644 (file)
@@ -229,7 +229,13 @@ struct vfsops afs_vfsops = {
   afs_sync,
   afs_vget,
   afs_fhtovp,
+#ifdef AFS_FBSD50_ENV
+  vfs_stdcheckexp,
+#endif
   afs_vptofh,
   afs_init,
+#ifdef AFS_FBSD50_ENV
+  vfs_stduninit,
+#endif
   afs_sysctl
 };
index 8cc84c8..5d74406 100644 (file)
@@ -62,7 +62,7 @@ int osi_VM_FlushVCache(struct vcache *avc, int *slept)
        return EBUSY;
 
     AFS_GUNLOCK();
-    vp=avc;
+    vp = AFSTOV(avc);
     simple_lock(&vp->v_interlock);
     if (VOP_GETVOBJECT(vp, &obj) == 0) {
        vm_object_page_remove(obj, 0, 0, FALSE);
@@ -91,26 +91,29 @@ void osi_VM_StoreAllSegments(struct vcache *avc)
     struct vnode *vp;
     struct vm_object *obj;
     int anyio,tries;
+
     ReleaseWriteLock(&avc->lock);
     AFS_GUNLOCK();
     tries=5;
-    vp=avc;
+    vp = AFSTOV(avc);
     do {
-    anyio=0;
-    simple_lock(&vp->v_interlock);
-    if (VOP_GETVOBJECT(vp, &obj) == 0 &&
-       (obj->flags & OBJ_MIGHTBEDIRTY)) {
-        if (!vget(vp,
-            LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY | LK_NOOBJ, curproc)) {
-            if (VOP_GETVOBJECT(vp, &obj) == 0) {
-               vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
-               anyio = 1;
-            }
-            vput(vp);
-        }
-    } else {
-        simple_unlock(&vp->v_interlock);
-    }
+       anyio=0;
+       simple_lock(&vp->v_interlock);
+       if (VOP_GETVOBJECT(vp, &obj) == 0 &&
+           (obj->flags & OBJ_MIGHTBEDIRTY)) {
+#ifdef AFS_FBSD50_ENV
+           if (!vget(vp, LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY, curthread)) {
+#else
+           if (!vget(vp, LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY | LK_NOOBJ, curproc)) {
+#endif
+               if (VOP_GETVOBJECT(vp, &obj) == 0) {
+                   vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
+                   anyio = 1;
+               }
+               vput(vp);
+           }
+       } else
+           simple_unlock(&vp->v_interlock);
     } while (anyio && (--tries > 0));
     AFS_GLOCK();
     ObtainWriteLock(&avc->lock,94);
@@ -130,30 +133,33 @@ void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync)
     struct vnode *vp;
     struct vm_object *obj;
     int anyio, tries;
+
     ReleaseWriteLock(&avc->lock);
     AFS_GUNLOCK();
-    tries=5;
-    vp=avc;
+    tries = 5;
+    vp = AFSTOV(avc);
     do {
-       anyio=0;
-       simple_lock(&vp->v_interlock);
-       if (VOP_GETVOBJECT(vp, &obj) == 0 &&
-          (obj->flags & OBJ_MIGHTBEDIRTY)) {
-           if (!vget(vp,
-               LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY | LK_NOOBJ, curproc)) {
-               if (VOP_GETVOBJECT(vp, &obj) == 0) {
-                  vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
-                  anyio = 1;
-               }
-               vput(vp);
-           }
-       } else {
-           simple_unlock(&vp->v_interlock);
-       }
+       anyio=0;
+       simple_lock(&vp->v_interlock);
+       if (VOP_GETVOBJECT(vp, &obj) == 0 &&
+           (obj->flags & OBJ_MIGHTBEDIRTY)) {
+#ifdef AFS_FBSD50_ENV
+           if (!vget(vp, LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY, curthread)) {
+#else
+           if (!vget(vp, LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY | LK_NOOBJ, curproc)) {
+#endif
+               if (VOP_GETVOBJECT(vp, &obj) == 0) {
+                   vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
+                   anyio = 1;
+               }
+               vput(vp);
+           }
+       } else
+           simple_unlock(&vp->v_interlock);
     } while (anyio && (--tries > 0));
     simple_lock(&vp->v_interlock);
     if (VOP_GETVOBJECT(vp, &obj) == 0) {
-       vm_object_page_remove(obj, 0, 0, FALSE);
+       vm_object_page_remove(obj, 0, 0, FALSE);
     }
     simple_unlock(&vp->v_interlock);
     /*vinvalbuf(AFSTOV(avc),0, NOCRED, curproc, 0,0);*/
@@ -169,10 +175,11 @@ void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
 {
     struct vnode *vp;
     struct vm_object *obj;
-    vp=avc;
+
+    vp = AFSTOV(avc);
     simple_lock(&vp->v_interlock);
     if (VOP_GETVOBJECT(vp, &obj) == 0) {
-       vm_object_page_remove(obj, 0, 0, FALSE);
+       vm_object_page_remove(obj, 0, 0, FALSE);
     }
     simple_unlock(&vp->v_interlock);
     /*vinvalbuf(AFSTOV(avc),0, NOCRED, curproc, 0,0);*/
index 2bdbfd8..866c981 100644 (file)
@@ -8,7 +8,9 @@ RCSID("$Header$");
 #include <afs/afs_stats.h>              /* statistics */
 #include <sys/malloc.h>
 #include <sys/namei.h>
+#ifndef AFS_FBSD50_ENV
 #include <vm/vm_zone.h>
+#endif
 #include <vm/vm_page.h>
 #include <vm/vm_object.h>
 #include <vm/vm_pager.h>
@@ -58,7 +60,9 @@ struct vnodeopv_entry_desc afs_vnodeop_entries[] = {
        { &vop_access_desc, (vop_t *) afs_vop_access },          /* access */
        { &vop_advlock_desc, (vop_t *) afs_vop_advlock },        /* advlock */
        { &vop_bmap_desc, (vop_t *) afs_vop_bmap },              /* bmap */
+#ifndef AFS_FBSD50_ENV
        { &vop_bwrite_desc, (vop_t *) vop_stdbwrite },
+#endif
        { &vop_close_desc, (vop_t *) afs_vop_close },            /* close */
         { &vop_createvobject_desc,  (vop_t *) vop_stdcreatevobject },
         { &vop_destroyvobject_desc, (vop_t *) vop_stddestroyvobject },
@@ -125,9 +129,13 @@ struct vop_lookup_args /* {
     register int flags = ap->a_cnp->cn_flags;
     int lockparent;                     /* 1 => lockparent flag is set */
     int wantparent;                     /* 1 => wantparent or lockparent flag */
-    struct proc *p;
+#ifdef AFS_FBSD50_ENV
+    struct thread *p = ap->a_cnp->cn_thread;
+#else
+    struct proc *p = ap->a_cnp->cn_proc;
+#endif
     GETNAME();
-    p=cnp->cn_proc;
+
     lockparent = flags & LOCKPARENT;
     wantparent = flags & (LOCKPARENT|WANTPARENT);
 
index f5b2a64..6ee5778 100644 (file)
@@ -28,7 +28,7 @@ RCSID("$Header$");
 
 
 
-
+int
 #if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
 afs_ustrategy(abp, credp)
     struct AFS_UCRED *credp;
@@ -64,7 +64,11 @@ afs_ustrategy(abp)
     ReleaseReadLock(&tvc->lock);
     osi_Assert(credp);
 #endif
+#ifdef AFS_FBSD50_ENV
+    if (abp->b_iocmd == BIO_READ) {
+#else
     if ((abp->b_flags & B_READ) == B_READ) {
+#endif
        /* read b_bcount bytes into kernel address b_un.b_addr starting
            at byte DEV_BSIZE * b_blkno.  Bzero anything we can't read,
            and finally call iodone(abp).  File is in abp->b_vp.  Credentials
@@ -178,7 +182,7 @@ afs_ustrategy(abp)
 #endif
     }
 #if    !defined(AFS_AIX32_ENV) && !defined(AFS_SUN5_ENV)
-#if defined(AFS_DUX40_ENV) || defined (AFS_XBSD_ENV)
+#if defined(AFS_DUX40_ENV) || (defined (AFS_XBSD_ENV) && !defined (AFS_FBSD50_ENV))
     if (code) {
        abp->b_error = code;
        abp->b_flags |= B_ERROR;
index a9af1eb..12e0bf8 100644 (file)
@@ -246,7 +246,7 @@ int afs_CheckCode(afs_int32 acode, struct vrequest *areq, int where)
        afs_Trace2(afs_iclSetp, CM_TRACE_CHECKCODE,
                   ICL_TYPE_INT32, acode, ICL_TYPE_INT32, where);
     }
-    if (acode & ~0xff == ERROR_TABLE_BASE_uae) 
+    if ((acode & ~0xff) == ERROR_TABLE_BASE_uae) 
        acode = et_to_sys_error(acode);
     if (!areq || !areq->initd)
        return acode;
@@ -533,7 +533,7 @@ int afs_Analyze(register struct conn *aconn, afs_int32 acode,
 
     /* Before we do anything with acode, make sure we translate it back to
        a system error */
-    if (acode & ~0xff == ERROR_TABLE_BASE_uae) 
+    if ((acode & ~0xff) == ERROR_TABLE_BASE_uae) 
        acode = et_to_sys_error(acode);
 
     if (acode == 0) {
index a325994..b68634d 100644 (file)
@@ -378,21 +378,17 @@ int afs_InitCacheInfo(register char *afile)
 #else
        if (!VFS_STATFS(filevp->v_vfsp, &st, NULL))
 #endif /* AFS_SGI65_ENV */
-#else  /* AFS_SGI_ENV */
-#if    defined(AFS_SUN5_ENV) || defined(AFS_HPUX100_ENV)
+#elif  defined(AFS_SUN5_ENV) || defined(AFS_HPUX100_ENV)
        if (!VFS_STATVFS(filevp->v_vfsp, &st)) 
-#else
-#ifdef AFS_OSF_ENV
+#elif defined(AFS_OSF_ENV)
       
        VFS_STATFS(filevp->v_vfsp, code);
        /* struct copy */
        st = filevp->v_vfsp->m_stat;
        if (code == 0)
-#else  /* AFS_OSF_ENV */
-#ifdef AFS_AIX41_ENV
+#elif defined(AFS_AIX41_ENV)
        if (!VFS_STATFS(filevp->v_vfsp, &st, &afs_osi_cred))
-#else
-#ifdef AFS_LINUX20_ENV
+#elif defined(AFS_LINUX20_ENV)
        {
            KERNEL_SPACE_DECL;
            TO_USER_SPACE();
@@ -400,21 +396,15 @@ int afs_InitCacheInfo(register char *afile)
            VFS_STATFS(filevp->v_vfsp, &st);
            TO_KERNEL_SPACE();
        }
-#else
-#if defined(AFS_DARWIN_ENV)
+#elif defined(AFS_DARWIN_ENV)
        if (!VFS_STATFS(filevp->v_mount, &st, current_proc()))
-#else 
-#if defined(AFS_XBSD_ENV)
+#elif defined(AFS_FBSD50_ENV)
+       if (!VFS_STATFS(filevp->v_mount, &st, curthread))
+#elif defined(AFS_XBSD_ENV)
        if (!VFS_STATFS(filevp->v_mount, &st, curproc))
 #else 
        if (!VFS_STATFS(filevp->v_vfsp, &st))  
-#endif /* AFS_XBSD_ENV */
-#endif /* AFS_DARWIN_ENV */
-#endif /* AFS_LINUX20_ENV */
-#endif /* AIX41 */
-#endif /* OSF */
-#endif /* SUN5 HP10 */
-#endif /* SGI */
+#endif /* SGI... */
 #if    defined(AFS_SUN5_ENV) || defined(AFS_HPUX100_ENV)
            afs_fsfragsize = st.f_frsize - 1; 
 #else
index f40f4ba..c1bef9f 100644 (file)
@@ -237,7 +237,10 @@ struct vfspage;                    /* for vnode.h compiler warnings */
 #    include "h/resource.h"
 #endif
 #  endif /* AFS_HPUX_ENV */
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD40_ENV)
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#  if defined(AFS_FBSD50_ENV)
+struct vop_getwritemount_args;
+#  endif
 #  include <sys/uio.h>
 #  include <sys/mount.h> 
 #  include <sys/namei.h>
index 4accf88..81a3b14 100644 (file)
@@ -148,8 +148,6 @@ enum vcexcl {NONEXCL, EXCL};
 #define AFS_USR_FBSD_ENV       1
 #define AFS_NONFSTRANS 1
 
-#define O_SYNC O_FSYNC
-
 #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
 #define AFS_SYSCALL 339
 #define AFS_NAMEI_ENV         1   /* User space interface to file system */
index ec9bb74..78842c5 100644 (file)
 
 #include <sys/systm.h>
 #include <sys/proc.h>
+#ifdef AFS_FBSD50_ENV
+#include <sys/lockmgr.h>
+#else
 #include <sys/lock.h>
+#endif
 
 #define RX_ENABLE_LOCKS         1
 #define AFS_GLOBAL_RXLOCK_KERNEL
@@ -56,7 +60,7 @@
 typedef int afs_kcondvar_t;
 
 #define HEAVY_LOCKS
-#ifdef NULL_LOCKS
+#if defined(NULL_LOCKS)
 typedef struct {
     struct proc *owner;
 } afs_kmutex_t;
@@ -85,8 +89,42 @@ typedef struct {
 #undef MUTEX_ISMINE
 #define MUTEX_ISMINE(a) (((afs_kmutex_t *)(a))->owner == curproc)
 
-#else
-#ifdef HEAVY_LOCKS
+#elif defined(AFS_FBSD50_ENV)
+typedef struct {
+    struct lock lock;
+    struct thread *owner;
+} afs_kmutex_t;
+
+
+#define MUTEX_INIT(a,b,c,d) \
+    do { \
+       lockinit(&(a)->lock,PSOCK, "afs rx mutex", 0, 0); \
+       (a)->owner = 0; \
+    } while(0);
+#define MUTEX_DESTROY(a) \
+    do { \
+       (a)->owner = (struct proc *)-1; \
+    } while(0);
+#define MUTEX_ENTER(a) \
+    do { \
+       lockmgr(&(a)->lock, LK_EXCLUSIVE, 0, curthread); \
+       osi_Assert((a)->owner == 0); \
+       (a)->owner = curthread; \
+    } while(0);
+#define MUTEX_TRYENTER(a) \
+    ( lockmgr(&(a)->lock, LK_EXCLUSIVE|LK_NOWAIT, 0, curthread) ? 0 : ((a)->owner = curthread, 1) )
+#define xMUTEX_TRYENTER(a) \
+    ( osi_Assert((a)->owner == 0), (a)->owner = curthread, 1)
+#define MUTEX_EXIT(a) \
+    do { \
+       osi_Assert((a)->owner == curthread); \
+       (a)->owner = 0; \
+       lockmgr(&(a)->lock, LK_RELEASE, 0, curthread); \
+    } while(0);
+
+#undef MUTEX_ISMINE
+#define MUTEX_ISMINE(a) (((afs_kmutex_t *)(a))->owner == curthread)
+#elif defined(HEAVY_LOCKS)
 typedef struct {
     struct lock lock;
     struct proc *owner;
@@ -155,7 +193,6 @@ typedef struct {
 #undef MUTEX_ISMINE
 #define MUTEX_ISMINE(a) (((afs_kmutex_t *)(a))->owner == curproc)
 #endif
-#endif
 
 
 #undef osirx_AssertMine
index 4fe2ba6..1c17f63 100644 (file)
@@ -17,10 +17,9 @@ RCSID("$Header$");
 #include "rx/rx_kcommon.h"
 
 #ifdef RXK_LISTENER_ENV
-int osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec,
+int osi_NetReceive(osi_socket asocket, struct sockaddr_in *addr, struct iovec *dvec,
                   int nvecs, int *alength)
 {
-    struct socket *asocket = (struct socket *)so;
     struct uio u;
     int i;
     struct iovec iov[RX_MAXIOVECS];
@@ -42,7 +41,11 @@ int osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec,
     u.uio_resid = *alength;
     u.uio_segflg = UIO_SYSSPACE;
     u.uio_rw = UIO_READ;
+#ifdef AFS_FBSD50_ENV
+    u.uio_td = NULL;
+#else
     u.uio_procp = NULL;
+#endif
 
     if (haveGlock)
         AFS_GUNLOCK();
@@ -106,7 +109,11 @@ osi_NetSend(osi_socket asocket, struct sockaddr_in *addr,
     u.uio_resid = alength;
     u.uio_segflg = UIO_SYSSPACE;
     u.uio_rw = UIO_WRITE;
+#ifdef AFS_FBSD50_ENV
+    u.uio_td = NULL;
+#else
     u.uio_procp = NULL;
+#endif
 
     addr->sin_len = sizeof(struct sockaddr_in);
 
@@ -115,7 +122,11 @@ osi_NetSend(osi_socket asocket, struct sockaddr_in *addr,
 #if KNET_DEBUG
     printf("+");
 #endif
+#ifdef AFS_FBSD50_ENV
+    code = sosend(asocket, (struct sockaddr *) addr, &u, NULL, NULL, 0, curthread);
+#else
     code = sosend(asocket, (struct sockaddr *) addr, &u, NULL, NULL, 0, curproc);
+#endif
 #if KNET_DEBUG
     if (code) {
         if (code == EINVAL)
index 3eac062..bf23203 100644 (file)
@@ -720,7 +720,7 @@ struct osi_socket *rxk_NewSocket(short aport)
 {
     register afs_int32 code;
     struct socket *newSocket;
-#if !defined(AFS_HPUX1122_ENV)
+#if (!defined(AFS_HPUX1122_ENV) && !defined(AFS_FBSD50_ENV))
     struct mbuf *nam;
 #endif
     struct sockaddr_in myaddr;
@@ -747,7 +747,9 @@ struct osi_socket *rxk_NewSocket(short aport)
 #endif     /* else AFS_HPUX110_ENV */
 #elif defined(AFS_SGI65_ENV) || defined(AFS_OBSD_ENV)
     code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP);
-#elif defined(AFS_FBSD_ENV)
+#elif defined(AFS_FBSD50_ENV)
+    code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP, &afs_osi_cred, curthread);
+#elif defined(AFS_FBSD40_ENV)
     code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP, curproc);
 #else
     code = socreate(AF_INET, &newSocket, SOCK_DGRAM, 0);
@@ -788,7 +790,9 @@ struct osi_socket *rxk_NewSocket(short aport)
            osi_Panic("osi_NewSocket: last attempt to reserve 32K failed!\n");
     }
 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-#if defined(AFS_FBSD_ENV)
+#if defined(AFS_FBSD50_ENV)
+    code = sobind(newSocket, (struct sockaddr *) &myaddr, curthread);
+#elif defined(AFS_FBSD40_ENV)
     code = sobind(newSocket, (struct sockaddr *) &myaddr, curproc);
 #else
     code = sobind(newSocket, (struct sockaddr *) &myaddr);
index 50ab143..5723498 100644 (file)
@@ -53,6 +53,9 @@ typedef unsigned short                  etap_event_t;
 #include "h/dirent.h"
 #include "h/socket.h"
 #include "h/domain.h"
+#if defined(AFS_FBSD50_ENV)
+#include "h/bio.h"
+#endif
 #include "h/buf.h"
 #include "h/mbuf.h"
 #endif /* AFS_FBSD_ENV */