Catch up with FBSD80's removal of thread argument to VFS calls
[openafs.git] / src / afs / FBSD / osi_vfsops.c
index 16cdf5d..b9766fd 100644 (file)
@@ -1,8 +1,6 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
 
 #include <afs/sysincludes.h>   /* Standard vendor system headers */
 #include <afsincludes.h>       /* Afs-based standard headers */
@@ -25,7 +23,6 @@ int afs_pbuf_freecnt = -1;
 #define        THREAD_OR_PROC struct proc *p
 #endif
 
-extern int afs3_syscall();
 extern int Afs_xsetgroups();
 extern int afs_xioctl();
 
@@ -73,7 +70,9 @@ afs_start(struct mount *mp, int flags, THREAD_OR_PROC)
 }
 
 int
-#ifdef AFS_FBSD53_ENV
+#if defined(AFS_FBSD80_ENV)
+afs_omount(struct mount *mp, char *path, caddr_t data)
+#elif defined(AFS_FBSD53_ENV)
 afs_omount(struct mount *mp, char *path, caddr_t data, struct thread *p)
 #else
 afs_omount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
@@ -98,6 +97,11 @@ afs_omount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
     afs_globalVFS = mp;
     mp->vfs_bsize = 8192;
     vfs_getnewfsid(mp);
+#ifdef AFS_FBSD70_ENV /* XXX 70? */
+    MNT_ILOCK(mp);
+    mp->mnt_flag &= ~MNT_LOCAL;
+    mp->mnt_kern_flag |= MNTK_MPSAFE; /* solid steel */
+#endif
     mp->mnt_stat.f_iosize = 8192;
 
     if (path != NULL)
@@ -109,29 +113,53 @@ afs_omount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
     strcpy(mp->mnt_stat.f_mntfromname, "AFS");
     /* null terminated string "AFS" will fit, just leave it be. */
     strcpy(mp->mnt_stat.f_fstypename, "afs");
+#ifdef AFS_FBSD70_ENV
+    MNT_IUNLOCK(mp);
+#endif
     AFS_GUNLOCK();
+#ifdef AFS_FBSD80_ENV
+    afs_statfs(mp, &mp->mnt_stat);
+#else
     afs_statfs(mp, &mp->mnt_stat, p);
+#endif
+
     return 0;
 }
 
 #ifdef AFS_FBSD53_ENV
 int
+#ifdef AFS_FBSD80_ENV
+afs_mount(struct mount *mp)
+#else
 afs_mount(struct mount *mp, struct thread *td)
+#endif
 {
+#ifdef AFS_FBSD80_ENV
+    return afs_omount(mp, NULL, NULL);
+#else
     return afs_omount(mp, NULL, NULL, td);
+#endif
 }
 #endif
 
 #ifdef AFS_FBSD60_ENV
 static int
+#ifdef AFS_FBSD80_ENV
+afs_cmount(struct mntarg *ma, void *data, int flags)
+#else
 afs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td)
+#endif
 {
     return kernel_mount(ma, flags);
 }
 #endif
 
 int
+#ifdef AFS_FBSD80_ENV
+afs_unmount(struct mount *mp, int flags)
+#else
 afs_unmount(struct mount *mp, int flags, THREAD_OR_PROC)
+#endif
 {
 
     /*
@@ -140,7 +168,9 @@ afs_unmount(struct mount *mp, int flags, THREAD_OR_PROC)
      * the root vnode (this is just a guess right now).
      * This has to be done outside the global lock.
      */
-#ifdef AFS_FBSD53_ENV
+#if defined(AFS_FBSD80_ENV)
+  /* do nothing */
+#elif defined(AFS_FBSD53_ENV)
     vflush(mp, 1, (flags & MNT_FORCE) ? FORCECLOSE : 0, p);
 #else
     vflush(mp, 1, (flags & MNT_FORCE) ? FORCECLOSE : 0);
@@ -155,7 +185,11 @@ afs_unmount(struct mount *mp, int flags, THREAD_OR_PROC)
 }
 
 int
-#ifdef AFS_FBSD53_ENV
+#if defined(AFS_FBSD80_ENV)
+afs_root(struct mount *mp, int flags, struct vnode **vpp)
+#elif defined(AFS_FBSD60_ENV)
+afs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td)
+#elif defined(AFS_FBSD53_ENV)
 afs_root(struct mount *mp, struct vnode **vpp, struct thread *td)
 #else
 afs_root(struct mount *mp, struct vnode **vpp)
@@ -165,10 +199,10 @@ afs_root(struct mount *mp, struct vnode **vpp)
     struct vrequest treq;
     register struct vcache *tvp = 0;
 #ifdef AFS_FBSD50_ENV
-#ifndef AFS_FBSD53_ENV
+#if !defined(AFS_FBSD53_ENV) || defined(AFS_FBSD80_ENV)
     struct thread *td = curthread;
 #endif
-    struct ucred *cr = td->td_ucred;
+    struct ucred *cr = osi_curcred();
 #else
     struct proc *p = curproc;
     struct ucred *cr = p->p_cred->pc_ucred;
@@ -177,17 +211,18 @@ afs_root(struct mount *mp, struct vnode **vpp)
     AFS_GLOCK();
     AFS_STATCNT(afs_root);
     crhold(cr);
-    if (afs_globalVp && (afs_globalVp->states & CStatd)) {
+    if (afs_globalVp && (afs_globalVp->f.states & CStatd)) {
        tvp = afs_globalVp;
        error = 0;
     } else {
 tryagain:
+#ifndef AFS_FBSD80_ENV
        if (afs_globalVp) {
            afs_PutVCache(afs_globalVp);
            /* vrele() needed here or not? */
            afs_globalVp = NULL;
        }
-
+#endif
        if (!(error = afs_InitReq(&treq, cr)) && !(error = afs_CheckInit())) {
            tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
            /* we really want this to stay around */
@@ -224,7 +259,7 @@ tryagain:
        *vpp = vp;
     }
 
-    afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *vpp,
+    afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, tvp ? AFSTOV(tvp) : NULL,
               ICL_TYPE_INT32, error);
     AFS_GUNLOCK();
     crfree(cr);
@@ -232,7 +267,11 @@ tryagain:
 }
 
 int
+#ifdef AFS_FBSD80_ENV
+afs_statfs(struct mount *mp, struct statfs *abp)
+#else
 afs_statfs(struct mount *mp, struct statfs *abp, THREAD_OR_PROC)
+#endif
 {
     AFS_GLOCK();
     AFS_STATCNT(afs_statfs);
@@ -262,7 +301,9 @@ afs_statfs(struct mount *mp, struct statfs *abp, THREAD_OR_PROC)
 }
 
 int
-#ifdef AFS_FBSD60_ENV
+#if defined(AFS_FBSD80_ENV)
+afs_sync(struct mount *mp, int waitfor)
+#elif defined(AFS_FBSD60_ENV)
 afs_sync(struct mount *mp, int waitfor, struct thread *td)
 #else
 afs_sync(struct mount *mp, int waitfor, struct ucred *cred, THREAD_OR_PROC)