venus: Remove dedebug
[openafs.git] / src / afs / IRIX / osi_vfsops.c
index 6ddae66..5b29ed2 100644 (file)
@@ -13,8 +13,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 */
@@ -34,8 +32,6 @@ mutex_t afs_init_kern_lock;
 
 #define SYS_setgroups SGI_SETGROUPS
 
-int (*nfs_rfsdisptab_v2) () = NULL;
-
 int afs_fstype;
 lock_t afs_rxlock;
 
@@ -57,11 +53,7 @@ extern void afs_mpservice(void *);
 extern struct vfsops Afs_vfsops, *afs_vfsopsp;
 extern struct vnodeops Afs_vnodeops, *afs_vnodeopsp;
 extern void (*afsidestroyp) (struct inode *);
-extern void (*afsdptoipp) (struct efs_dinode *, struct inode *);
-extern void (*afsiptodpp) (struct inode *, struct efs_dinode *);
 extern void afsidestroy(struct inode *);
-extern void afsdptoip(struct efs_dinode *, struct inode *);
-extern void afsiptodp(struct inode *, struct efs_dinode *);
 extern int (*idbg_prafsnodep) (vnode_t *);
 extern int (*idbg_afsvfslistp) (void);
 extern int idbg_prafsnode(vnode_t *);
@@ -93,8 +85,6 @@ Afs_init(struct vfssw *vswp, int fstype)
     afs_vnodeopsp = &Afs_vnodeops;
     afs_vfsopsp = &Afs_vfsops;
     afsidestroyp = afsidestroy;
-    afsiptodpp = afsiptodp;
-    afsdptoipp = afsdptoip;
     idbg_prafsnodep = idbg_prafsnode;
     idbg_afsvfslistp = idbg_afsvfslist;
     NewSystemCall(AFS_SYSCALL, Afs_syscall, 6);
@@ -120,11 +110,7 @@ Afs_init(struct vfssw *vswp, int fstype)
 
 
 extern int afs_mount(), afs_unmount(), afs_root(), afs_statfs();
-#ifdef AFS_SGI65_ENV
 extern int afs_sync(OSI_VFS_DECL(afsp), int flags, struct cred *cr);
-#else
-extern int afs_sync(OSI_VFS_DECL(afsp), short flags, struct cred *cr);
-#endif
 extern int afs_vget(OSI_VFS_DECL(afsp), vnode_t ** vpp, struct fid *afidp);
 #ifdef MP
 struct vfsops afs_lockedvfsops =
@@ -132,42 +118,26 @@ struct vfsops afs_lockedvfsops =
 struct vfsops Afs_vfsops =
 #endif
 {
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
     BHV_IDENTITY_INIT_POSITION(VFS_POSITION_BASE),
-#else
-    VFS_POSITION_BASE,
-#endif
-#endif
     afs_mount,
-#ifdef AFS_SGI64_ENV
     fs_nosys,                  /* rootinit */
     fs_nosys,                  /* mntupdate */
     fs_dounmount,
-#endif
     afs_unmount,
     afs_root,
     afs_statfs,
     afs_sync,
     afs_vget,
     fs_nosys,                  /* mountroot */
-#ifdef AFS_SGI65_ENV
     fs_nosys,                  /* realvfsops */
     fs_import,                 /* import */
     fs_nosys,                  /* quotactl */
-#else
-    fs_nosys,                  /* swapvp */
-#endif
 };
 extern struct afs_q VLRU;      /*vcache LRU */
 
-#ifdef AFS_SGI64_ENV
 static bhv_desc_t afs_vfs_bhv;
-#endif
 afs_mount(struct vfs *afsp, vnode_t * mvp, struct mounta *uap,
-#ifdef AFS_SGI65_ENV
          char *attrs,
-#endif
          cred_t * cr)
 {
     AFS_STATCNT(afs_mount);
@@ -186,19 +156,10 @@ afs_mount(struct vfs *afsp, vnode_t * mvp, struct mounta *uap,
     afsp->vfs_bsize = 8192;
     afsp->vfs_fsid.val[0] = AFS_VFSMAGIC;      /* magic */
     afsp->vfs_fsid.val[1] = afs_fstype;
-#ifdef AFS_SGI64_ENV
     vfs_insertbhv(afsp, &afs_vfs_bhv, &Afs_vfsops, &afs_vfs_bhv);
-#else
-    afsp->vfs_data = NULL;
-#endif
     afsp->vfs_fstype = afs_fstype;
     afsp->vfs_dev = 0xbabebabe;        /* XXX this should be unique */
 
-#ifndef        AFS_NONFSTRANS
-    if (nfs_rfsdisptab_v2)
-       afs_xlatorinit_v2(nfs_rfsdisptab_v2);
-    afs_xlatorinit_v3();
-#endif
     return 0;
 }
 
@@ -207,15 +168,14 @@ afs_unmount(OSI_VFS_ARG(afsp), flags, cr)
      int flags;
      cred_t *cr;
 {
-    extern int afs_afs_cold_shutdown;
     struct vcache *tvc;
     vnode_t *vp, *rootvp = NULL;
-    register struct afs_q *tq;
+    struct afs_q *tq;
     struct afs_q *uq;
     int error, fv_slept;
-    OSI_VFS_CONVERT(afsp)
+    OSI_VFS_CONVERT(afsp);
 
-       AFS_STATCNT(afs_unmount);
+    AFS_STATCNT(afs_unmount);
 
     if (!suser())
        return EPERM;
@@ -225,11 +185,12 @@ afs_unmount(OSI_VFS_ARG(afsp), flags, cr)
      * EBUSY if any still in use
      */
     ObtainWriteLock(&afs_xvcache, 172);
+ retry:
     for (tq = VLRU.prev; tq != &VLRU; tq = uq) {
        tvc = QTOV(tq);
        uq = QPrev(tq);
        vp = (vnode_t *) tvc;
-       if (error = afs_FlushVCache(tvc, &fv_slept))
+       if (error = afs_FlushVCache(tvc, &fv_slept)) {
            if (vp->v_flag & VROOT) {
                rootvp = vp;
                continue;
@@ -237,6 +198,10 @@ afs_unmount(OSI_VFS_ARG(afsp), flags, cr)
                ReleaseWriteLock(&afs_xvcache);
                return error;
            }
+       }
+       if (fv_slept) {
+           goto retry;
+       }
     }
 
     /*
@@ -256,10 +221,8 @@ afs_unmount(OSI_VFS_ARG(afsp), flags, cr)
     }
     ReleaseWriteLock(&afs_xvcache);
     afs_globalVFS = 0;
-    afs_shutdown();
-#ifdef AFS_SGI65_ENV
+    afs_shutdown(AFS_WARM);
     VFS_REMOVEBHV(afsp, &afs_vfs_bhv);
-#endif
     return 0;
 }
 
@@ -269,13 +232,13 @@ afs_root(OSI_VFS_ARG(afsp), avpp)
     OSI_VFS_DECL(afsp);
      struct vnode **avpp;
 {
-    register afs_int32 code = 0;
+    afs_int32 code = 0;
     struct vrequest treq;
-    register struct vcache *tvp = 0;
-    OSI_VFS_CONVERT(afsp)
+    struct vcache *tvp = 0;
+    OSI_VFS_CONVERT(afsp);
 
-       AFS_STATCNT(afs_root);
-    if (afs_globalVp && (afs_globalVp->states & CStatd)) {
+    AFS_STATCNT(afs_root);
+    if (afs_globalVp && (afs_globalVp->f.states & CStatd)) {
        tvp = afs_globalVp;
     } else {
        if (afs_globalVp) {
@@ -285,12 +248,12 @@ afs_root(OSI_VFS_ARG(afsp), avpp)
 
        if (!(code = afs_InitReq(&treq, OSI_GET_CURRENT_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) {
                afs_globalVp = tvp;
            } else
-               code = ENOENT;
+               code = EIO;
        }
     }
     if (tvp) {
@@ -314,9 +277,9 @@ afs_statfs(OSI_VFS_ARG(afsp), abp, avp)
      struct statvfs *abp;
      struct vnode *avp;                /* unused */
 {
-    OSI_VFS_CONVERT(afsp)
+    OSI_VFS_CONVERT(afsp);
 
-       AFS_STATCNT(afs_statfs);
+    AFS_STATCNT(afs_statfs);
     abp->f_bsize = afsp->vfs_bsize;
     abp->f_frsize = afsp->vfs_bsize;
     /* Fake a high number below to satisfy programs that use the statfs
@@ -324,10 +287,10 @@ afs_statfs(OSI_VFS_ARG(afsp), abp, avp)
      * before storing something there.
      */
     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
-       abp->f_ffree = abp->f_favail = 900000;
+       abp->f_ffree = abp->f_favail = AFS_VFS_FAKEFREE;
 
     abp->f_fsid = AFS_VFSMAGIC;        /* magic */
-    strcpy(abp->f_basetype, AFS_MOUNT_AFS);
+    strcpy(abp->f_basetype, AFS_MOUNT_STR);
     abp->f_flag = 0;
     abp->f_namemax = 256;
     return 0;
@@ -358,17 +321,11 @@ afs_statfs(OSI_VFS_ARG(afsp), abp, avp)
 
 extern afs_int32 vcachegen;
 #define PREEMPT_MASK    0x7f
-#ifdef AFS_SGI64_ENV
 #define PREEMPT()
-#endif
 
 int
 afs_sync(OSI_VFS_DECL(afsp),
-#ifdef AFS_SGI65_ENV
         int flags,
-#else
-        short flags,
-#endif
         struct cred *cr)
 {
     /* Why enable the vfs sync operation?? */
@@ -376,22 +333,17 @@ afs_sync(OSI_VFS_DECL(afsp),
     struct vcache *tvc;
     struct vnode *vp;
     afs_uint32 lvcachegen;
-    register struct afs_q *tq;
+    struct afs_q *tq;
     struct afs_q *uq;
     int s;
-    OSI_VFS_CONVERT(afsp)
+    OSI_VFS_CONVERT(afsp);
 
-       error = lasterr = 0;
+    error = lasterr = 0;
     /*
      * if not interested in vnodes, skip all this
      */
-#ifdef AFS_SGI61_ENV
     if ((flags & (SYNC_CLOSE | SYNC_DELWRI | SYNC_PDFLUSH)) == 0)
        goto end;
-#else /* AFS_SGI61_ENV */
-    if ((flags & (SYNC_CLOSE | SYNC_DELWRI | SYNC_ATTR)) == 0)
-       goto end;
-#endif /* AFS_SGI61_ENV */
   loop:
     ObtainReadLock(&afs_xvcache);
     for (tq = VLRU.prev; tq != &VLRU; tq = uq) {
@@ -422,14 +374,12 @@ afs_sync(OSI_VFS_DECL(afsp),
                continue;
            }
        }
-#ifdef AFS_SGI61_ENV
        else if (flags & SYNC_PDFLUSH) {
            if (!VN_GET_DPAGES(vp)) {
                VN_UNLOCK(vp, s);
                continue;
            }
        }
-#endif /* AFS_SGI61_ENV */
 
        vp->v_count++;
        VN_UNLOCK(vp, s);
@@ -441,11 +391,7 @@ afs_sync(OSI_VFS_DECL(afsp),
         * sleep for rwlock.
         */
        if (afs_rwlock_nowait(vp, 1) == 0) {
-#ifdef AFS_SGI61_ENV
            if (flags & (SYNC_BDFLUSH | SYNC_PDFLUSH))
-#else /* AFS_SGI61_ENV */
-           if (flags & SYNC_BDFLUSH)
-#endif /* AFS_SGI61_ENV */
            {
                AFS_RELE(vp);
                ObtainReadLock(&afs_xvcache);
@@ -460,33 +406,18 @@ afs_sync(OSI_VFS_DECL(afsp),
 
        AFS_GUNLOCK();
        if (flags & SYNC_CLOSE) {
-           PFLUSHINVALVP(vp, (off_t) 0, (off_t) tvc->m.Length);
+           PFLUSHINVALVP(vp, (off_t) 0, (off_t) tvc->f.m.Length);
        }
-#ifdef AFS_SGI61_ENV
        else if (flags & SYNC_PDFLUSH) {
            if (VN_GET_DPAGES(vp)) {
                pdflush(vp, B_ASYNC);
            }
        }
-#endif /* AFS_SGI61_ENV */
 
 
        if ((flags & SYNC_DELWRI) && AFS_VN_DIRTY(vp)) {
-#ifdef AFS_SGI61_ENV
-           PFLUSHVP(vp, (off_t) tvc->m.Length,
+           PFLUSHVP(vp, (off_t) tvc->f.m.Length,
                     (flags & SYNC_WAIT) ? 0 : B_ASYNC, error);
-#else /* AFS_SGI61_ENV */
-           if (flags & SYNC_WAIT)
-               /* push all and wait */
-               PFLUSHVP(vp, (off_t) tvc->m.Length, (off_t) 0, error);
-           else if (flags & SYNC_BDFLUSH) {
-               /* push oldest */
-               error = pdflush(vp, B_ASYNC);
-           } else {
-               /* push all but don't wait */
-               PFLUSHVP(vp, (off_t) tvc->m.Length, (off_t) B_ASYNC, error);
-           }
-#endif /* AFS_SGI61_ENV */
        }
 
        /*
@@ -520,27 +451,27 @@ afs_vget(OSI_VFS_DECL(afsp), vnode_t ** avcp, struct fid * fidp)
 {
     struct VenusFid vfid;
     struct vrequest treq;
-    register struct cell *tcell;
-    register afs_int32 code = 0;
+    struct cell *tcell;
+    afs_int32 code = 0;
     afs_int32 ret;
 
-#if defined(AFS_SGI64_ENV) && defined(CKPT) && !defined(_R5000_CVT_WAR)
+#if defined(CKPT) && !defined(_R5000_CVT_WAR)
     afs_fid2_t *afid2;
 #endif
 
-    OSI_VFS_CONVERT(afsp)
+    OSI_VFS_CONVERT(afsp);
 
-       AFS_STATCNT(afs_vget);
+    AFS_STATCNT(afs_vget);
 
     *avcp = NULL;
 
-#if defined(AFS_SGI64_ENV) && defined(CKPT) && !defined(_R5000_CVT_WAR)
+#if defined(CKPT) && !defined(_R5000_CVT_WAR)
     afid2 = (afs_fid2_t *) fidp;
     if (afid2->af_len == sizeof(afs_fid2_t) - sizeof(afid2->af_len)) {
        /* It's a checkpoint restart fid. */
        tcell = afs_GetCellByIndex(afid2->af_cell, READ_LOCK);
        if (!tcell) {
-           code = ENOENT;
+           code = EIO;
            goto out;
        }
        vfid.Cell = tcell->cellNum;
@@ -552,9 +483,9 @@ afs_vget(OSI_VFS_DECL(afsp), vnode_t ** avcp, struct fid * fidp)
        if (code = afs_InitReq(&treq, OSI_GET_CURRENT_CRED()))
            goto out;
        *avcp =
-           (vnode_t *) afs_GetVCache(&vfid, &treq, NULL, (struct vcache *)0);
+           (vnode_t *) afs_GetVCache(&vfid, &treq);
        if (!*avcp) {
-           code = ENOENT;
+           code = EIO;
        }
        goto out;
     }
@@ -575,25 +506,17 @@ afs_vget(OSI_VFS_DECL(afsp), vnode_t ** avcp, struct fid * fidp)
 #ifdef MP                      /* locked versions of vfs operations. */
 
 /* wrappers for vfs calls */
-#ifdef AFS_SGI64_ENV
 #define AFS_MP_VFS_ARG(A) bhv_desc_t A
-#else
-#define AFS_MP_VFS_ARG(A) struct vfs A
-#endif
 
 int
 mp_afs_mount(struct vfs *a, struct vnode *b, struct mounta *c,
-#ifdef AFS_SGI65_ENV
             char *d,
-#endif
             struct cred *e)
 {
     int rv;
     AFS_GLOCK();
     rv = afs_lockedvfsops.vfs_mount(a, b, c, d
-#ifdef AFS_SGI65_ENV
                                    , e
-#endif
        );
     AFS_GUNLOCK();
     return rv;
@@ -631,11 +554,7 @@ mp_afs_statvfs(AFS_MP_VFS_ARG(*a), struct statvfs *b, struct vnode *c)
 
 int
 mp_afs_sync(AFS_MP_VFS_ARG(*a),
-#ifdef AFS_SGI65_ENV
            int b,
-#else
-           short b,
-#endif
            struct cred *c)
 {
     int rv;
@@ -656,32 +575,20 @@ mp_afs_vget(AFS_MP_VFS_ARG(*a), struct vnode **b, struct fid *c)
 }
 
 struct vfsops Afs_vfsops = {
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
     BHV_IDENTITY_INIT_POSITION(VFS_POSITION_BASE),
-#else
-    VFS_POSITION_BASE,
-#endif
-#endif
     mp_afs_mount,
-#ifdef AFS_SGI64_ENV
     fs_nosys,                  /* rootinit */
     fs_nosys,                  /* mntupdate */
     fs_dounmount,
-#endif
     mp_afs_unmount,
     mp_afs_root,
     mp_afs_statvfs,
     mp_afs_sync,
     mp_afs_vget,
     fs_nosys,                  /* mountroot */
-#ifdef AFS_SGI65_ENV
     fs_nosys,                  /* realvfsops */
     fs_import,                 /* import */
     fs_nosys,                  /* quotactl */
-#else
-    fs_nosys,                  /* swapvp */
-#endif
 };
 
 #endif /* MP */