afs: Avoid using logical OR when setting f_fsid
[openafs.git] / src / afs / SOLARIS / osi_vfsops.c
index 7d69c34..1f03b8f 100644 (file)
@@ -72,9 +72,6 @@ afs_mount(struct vfs *afsp, struct vnode *amvp, struct mounta *uap,
 static void
 afs_freevfs(void)
 {
-    int i;
-    struct vcache *vc, *nvc;
-    extern struct vcache *afs_vhashT[VCSIZE];
 
     afs_globalVFS = 0;
 
@@ -119,11 +116,13 @@ afs_unmount(struct vfs *afsp, int flag, afs_ucred_t *credp)
 
     afsp->vfs_flag |= VFS_UNMOUNTED;
 
-    /* release the root vnode, which should be the last reference to us
-     * besides the caller of afs_unmount */
-    rootvp = afs_globalVp;
-    afs_globalVp = NULL;
-    AFS_RELE(rootvp);
+    if (afs_globalVp) {
+       /* release the root vnode, which should be the last reference to us
+        * besides the caller of afs_unmount */
+       rootvp = afs_globalVp;
+       afs_globalVp = NULL;
+       AFS_RELE(AFSTOV(rootvp));
+    }
 
     AFS_GUNLOCK();
     return 0;
@@ -179,7 +178,7 @@ again:
 
        if (!(code = afs_InitReq(&treq, proc->p_cred))
            && !(code = afs_CheckInit())) {
-           tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
+           tvp = afs_GetVCache(&afs_rootFid, &treq);
            /* we really want this to stay around */
            if (tvp) {
                if (afs_globalVp) {
@@ -190,11 +189,11 @@ again:
                }
                afs_globalVp = tvp;
            } else
-               code = ENOENT;
+               code = EIO;
        }
     }
     if (tvp) {
-       AFS_FAST_HOLD(tvp);
+       osi_Assert(osi_vnhold(tvp) == 0);
        mutex_enter(&AFSTOV(tvp)->v_lock);
        AFSTOV(tvp)->v_flag |= VROOT;
        mutex_exit(&AFSTOV(tvp)->v_lock);
@@ -227,11 +226,10 @@ afs_statvfs(struct vfs *afsp, struct statvfs64 *abp)
     AFS_STATCNT(afs_statfs);
 
     abp->f_frsize = 1024;
-    abp->f_favail = 9000000;
     abp->f_bsize = afsp->vfs_bsize;
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-       abp->f_ffree = 9000000;
-    abp->f_fsid = (AFS_VFSMAGIC << 16) || AFS_VFSFSID;
+       abp->f_favail = abp->f_ffree = AFS_VFS_FAKEFREE;
+    abp->f_fsid = (AFS_VFSMAGIC << 16) | AFS_VFSFSID;
 
     AFS_GUNLOCK();
     return 0;
@@ -256,7 +254,11 @@ afs_vget(struct vfs *afsp, struct vnode **avcp, struct fid *fidp)
 
     *avcp = NULL;
     if (!(code = afs_InitReq(&treq, credp))) {
-       code = afs_osi_vget((struct vcache **)avcp, fidp, &treq);
+        struct vcache *tvc = NULL;
+       code = afs_osi_vget(&tvc, fidp, &treq);
+        if (tvc) {
+            *avcp = AFSTOV(tvc);
+        }
     }
 
     afs_Trace3(afs_iclSetp, CM_TRACE_VGET, ICL_TYPE_POINTER, *avcp,
@@ -457,7 +459,7 @@ static vfsdef_t afs_vfsdef = {
     VFSDEF_VERSION,
     "afs",
     afsinit,
-    0,
+    VSW_STATS,
     NULL
 };
 #else
@@ -465,7 +467,7 @@ static struct vfsdef_v3 afs_vfsdef = {
     VFSDEF_VERSION,
     "afs",
     afsinit,
-    0
+    VSW_STATS
 };
 #endif
 #else
@@ -485,9 +487,6 @@ static struct sysent afssysent = {
 };
 #endif /* AFS_SUN511_ENV */
 
-/* inter-module dependencies */
-char _depends_on[] = "drv/ip drv/udp strmod/rpcmod";
-
 /*
  * Info/Structs to link the afs module into the kernel
  */