Remove support for Solaris pre-8
[openafs.git] / src / afs / SOLARIS / osi_vnodeops.c
index 71db899..d2ae694 100644 (file)
@@ -10,8 +10,6 @@
 #include <afsconfig.h>
 #include "afs/param.h"
 
-RCSID
-    ("$Header$");
 
 /*
  * SOLARIS/osi_vnodeops.c
@@ -85,18 +83,18 @@ int afs_dump(), afs_cmp(), afs_realvp(), afs_GetOnePage();
 int afs_pvn_vptrunc;
 
 int
-afs_addmap(register struct vnode *avp, offset_t offset, struct as *asp, 
+afs_addmap(struct vnode *avp, offset_t offset, struct as *asp, 
           caddr_t addr, int length, int prot, int maxprot, int flags, 
-          struct AFS_UCRED *credp)
+          afs_ucred_t *credp)
 {
     /* XXX What should we do here?? XXX */
     return (0);
 }
 
 int
-afs_delmap(register struct vnode *avp, offset_t offset, struct as *asp, 
+afs_delmap(struct vnode *avp, offset_t offset, struct as *asp, 
           caddr_t addr, int length, int prot, int maxprot, int flags, 
-          struct AFS_UCRED *credp)
+          afs_ucred_t *credp)
 {
     /* XXX What should we do here?? XXX */
     return (0);
@@ -104,15 +102,15 @@ afs_delmap(register struct vnode *avp, offset_t offset, struct as *asp,
 
 #ifdef AFS_SUN510_ENV
 int
-afs_vmread(register struct vnode *avp, struct uio *auio, int ioflag, 
-          struct AFS_UCRED *acred, caller_context_t *ct)
+afs_vmread(struct vnode *avp, struct uio *auio, int ioflag, 
+          afs_ucred_t *acred, caller_context_t *ct)
 #else
 int
-afs_vmread(register struct vnode *avp, struct uio *auio, int ioflag, 
-          struct AFS_UCRED *acred)
+afs_vmread(struct vnode *avp, struct uio *auio, int ioflag, 
+          afs_ucred_t *acred)
 #endif
 {
-    register int code;
+    int code;
 
     if (!RW_READ_HELD(&(VTOAFS(avp))->rwlock))
        osi_Panic("afs_vmread: !rwlock");
@@ -125,15 +123,15 @@ afs_vmread(register struct vnode *avp, struct uio *auio, int ioflag,
 
 #ifdef AFS_SUN510_ENV
 int
-afs_vmwrite(register struct vnode *avp, struct uio *auio, int ioflag, 
-           struct AFS_UCRED *acred, caller_context_t *ct)
+afs_vmwrite(struct vnode *avp, struct uio *auio, int ioflag, 
+           afs_ucred_t *acred, caller_context_t *ct)
 #else
 int
-afs_vmwrite(register struct vnode *avp, struct uio *auio, int ioflag, 
-           struct AFS_UCRED *acred)
+afs_vmwrite(struct vnode *avp, struct uio *auio, int ioflag, 
+           afs_ucred_t *acred)
 #endif
 {
-    register int code;
+    int code;
 
     if (!RW_WRITE_HELD(&(VTOAFS(avp))->rwlock))
        osi_Panic("afs_vmwrite: !rwlock");
@@ -146,9 +144,9 @@ afs_vmwrite(register struct vnode *avp, struct uio *auio, int ioflag,
 int
 afs_getpage(struct vnode *vp, offset_t off, u_int len, u_int *protp, 
            struct page *pl[], u_int plsz, struct seg *seg, caddr_t addr, 
-           enum seg_rw rw, struct AFS_UCRED *acred)
+           enum seg_rw rw, afs_ucred_t *acred)
 {
-    register afs_int32 code = 0;
+    afs_int32 code = 0;
     AFS_STATCNT(afs_getpage);
 
     if (vp->v_flag & VNOMAP)   /* File doesn't allow mapping */
@@ -158,11 +156,7 @@ afs_getpage(struct vnode *vp, offset_t off, u_int len, u_int *protp,
 
     if (len <= PAGESIZE)
        code =
-           afs_GetOnePage(vp, 
-#if !defined(AFS_SUN56_ENV)
-                          (u_int)
-#endif
-                          off, len, protp, pl, plsz, seg, addr, rw, acred);
+           afs_GetOnePage(vp, off, len, protp, pl, plsz, seg, addr, rw, acred);
     else {
        struct vcache *vcp = VTOAFS(vp);
        ObtainWriteLock(&vcp->vlock, 548);
@@ -170,11 +164,7 @@ afs_getpage(struct vnode *vp, offset_t off, u_int len, u_int *protp,
        ReleaseWriteLock(&vcp->vlock);
        afs_BozonLock(&vcp->pvnLock, vcp);
        code =
-           pvn_getpages(afs_GetOnePage, vp, 
-#if !defined(AFS_SUN56_ENV)
-                        (u_int)
-#endif
-                        off, len, protp, pl, plsz, seg, addr, rw, acred);
+           pvn_getpages(afs_GetOnePage, vp, off, len, protp, pl, plsz, seg, addr, rw, acred);
        afs_BozonUnlock(&vcp->pvnLock, vcp);
        ObtainWriteLock(&vcp->vlock, 549);
        vcp->multiPage--;
@@ -186,23 +176,17 @@ afs_getpage(struct vnode *vp, offset_t off, u_int len, u_int *protp,
 
 /* Return all the pages from [off..off+len) in file */
 int
-#if    defined(AFS_SUN56_ENV)
 afs_GetOnePage(struct vnode *vp, u_offset_t off, u_int alen, u_int *protp, 
               struct page *pl[], u_int plsz, struct seg *seg, caddr_t addr, 
-              enum seg_rw rw, struct AFS_UCRED *acred)
-#else
-afs_GetOnePage(struct vnode *vp, u_int off, u_int alen, u_int *protp, 
-              struct page *pl[], u_int plsz, struct seg *seg, caddr_t addr, 
-              enum seg_rw rw, struct AFS_UCRED *acred)
-#endif
+              enum seg_rw rw, afs_ucred_t *acred)
 {
-    register struct page *page;
-    register afs_int32 code = 0;
+    struct page *page;
+    afs_int32 code = 0;
     u_int len;
     struct buf *buf;
     afs_int32 tlen;
-    register struct vcache *avc;
-    register struct dcache *tdc;
+    struct vcache *avc;
+    struct dcache *tdc;
     int i, s, pexists;
     int slot;
     afs_size_t offset, nlen = 0;
@@ -247,7 +231,8 @@ afs_GetOnePage(struct vnode *vp, u_int off, u_int alen, u_int *protp,
 
                tdc->mflags |= DFFetchReq;
                bp = afs_BQueue(BOP_FETCH, avc, B_DONTWAIT, 0, acred,
-                               (afs_size_t) off, (afs_size_t) 1, tdc);
+                               (afs_size_t) off, (afs_size_t) 1, tdc,
+                               (void *)0, (void *)0);
                if (!bp) {
                    /* Unable to start background fetch; might as well stop */
                    tdc->mflags &= ~DFFetchReq;
@@ -299,7 +284,7 @@ afs_GetOnePage(struct vnode *vp, u_int off, u_int alen, u_int *protp,
     else
        tdc = afs_GetDCache(avc, (afs_offs_t) off, &treq, &offset, &nlen, 1);
     if (!tdc)
-       return EINVAL;
+       return afs_CheckCode(EINVAL, &treq, 62);
     code = afs_VerifyVCache(avc, &treq);
     if (code) {
        afs_PutDCache(tdc);
@@ -363,24 +348,14 @@ afs_GetOnePage(struct vnode *vp, u_int off, u_int alen, u_int *protp,
        /* if we make it here, we can't find the page in memory.  Do a real disk read
         * from the cache to get the data */
        Code |= 0x200;          /* XXX */
-#if    defined(AFS_SUN54_ENV)
        /* use PG_EXCL because we know the page does not exist already.  If it 
         * actually does exist, we have somehow raced between lookup and create.
         * As of 4/98, that shouldn't be possible, but we'll be defensive here
         * in case someone tries to relax all the serialization of read and write
         * operations with harmless things like stat. */
-#if    defined(AFS_SUN58_ENV)
        page =
            page_create_va(vp, toffset, PAGESIZE, PG_WAIT | PG_EXCL, seg,
                           addr);
-#else
-       page =
-           page_create_va(vp, toffset, PAGESIZE, PG_WAIT | PG_EXCL,
-                          seg->s_as, addr);
-#endif
-#else
-       page = page_create(vp, toffset, PAGESIZE, PG_WAIT);
-#endif
        if (!page) {
            continue;
        }
@@ -396,11 +371,7 @@ afs_GetOnePage(struct vnode *vp, u_int off, u_int alen, u_int *protp,
            buf = pageio_setup(page, PAGESIZE, vp, B_READ);     /* allocate a buf structure */
            buf->b_edev = 0;
            buf->b_dev = 0;
-#if defined(AFS_SUN56_ENV)
            buf->b_lblkno = lbtodb(toffset);
-#else
-           buf->b_blkno = btodb(toffset);
-#endif
            bp_mapin(buf);      /* map it in to our address space */
 
            AFS_GLOCK();
@@ -423,12 +394,7 @@ afs_GetOnePage(struct vnode *vp, u_int off, u_int alen, u_int *protp,
       nextpage:
        /* put page in array and continue */
        /* The p_selock must be downgraded to a shared lock after the page is read */
-#if    defined(AFS_SUN56_ENV)
-       if ((rw != S_CREATE) && !(PAGE_SHARED(page)))
-#else
-       if ((rw != S_CREATE) && !(se_shared_assert(&page->p_selock)))
-#endif
-       {
+       if ((rw != S_CREATE) && !(PAGE_SHARED(page))) {
            page_downgrade(page);
        }
        pl[slot++] = page;
@@ -481,23 +447,15 @@ afs_GetOnePage(struct vnode *vp, u_int off, u_int alen, u_int *protp,
 
 int
 afs_putpage(struct vnode *vp, offset_t off, u_int len, int flags, 
-           struct AFS_UCRED *cred)
+           afs_ucred_t *cred)
 {
     struct vcache *avc;
     struct page *pages;
     afs_int32 code = 0;
-#if    defined(AFS_SUN58_ENV)
     size_t tlen;
-#else
-    afs_int32 tlen;
-#endif
     afs_offs_t endPos;
     afs_int32 NPages = 0;
-#if    defined(AFS_SUN56_ENV)
     u_offset_t toff = off;
-#else
-    int toff = (int)off;
-#endif
     int didWriteLock;
 
     AFS_STATCNT(afs_putpage);
@@ -555,11 +513,7 @@ afs_putpage(struct vnode *vp, offset_t off, u_int len, int flags,
        }
 
        AFS_GUNLOCK();
-#if    defined(AFS_SUN56_ENV)
        code = pvn_vplist_dirty(vp, toff, afs_putapage, flags, cred);
-#else
-       code = pvn_vplist_dirty(vp, (u_int) off, afs_putapage, flags, cred);
-#endif
        AFS_GLOCK();
     }
 
@@ -584,16 +538,8 @@ afs_putpage(struct vnode *vp, offset_t off, u_int len, int flags,
 
 
 int
-#if defined(AFS_SUN58_ENV)
-afs_putapage(struct vnode *vp, struct page *pages, u_offset_t * offp,
-            size_t * lenp, int flags, struct AFS_UCRED *credp)
-#elif defined(AFS_SUN56_ENV)
 afs_putapage(struct vnode *vp, struct page *pages, u_offset_t * offp,
-            u_int * lenp, int flags, struct AFS_UCRED *credp)
-#else
-afs_putapage(struct vnode *vp, struct page *pages, u_int * offp,
-            u_int * lenp, int flags, struct AFS_UCRED *credp)
-#endif
+            size_t * lenp, int flags, afs_ucred_t *credp)
 {
     struct buf *tbuf;
     struct vcache *avc = VTOAFS(vp);
@@ -622,11 +568,7 @@ afs_putapage(struct vnode *vp, struct page *pages, u_int * offp,
            return (ENOMEM);
 
        tbuf->b_dev = 0;
-#if defined(AFS_SUN56_ENV)
        tbuf->b_lblkno = lbtodb(pages->p_offset);
-#else
-       tbuf->b_blkno = btodb(pages->p_offset);
-#endif
        bp_mapin(tbuf);
        AFS_GLOCK();
        afs_Trace4(afs_iclSetp, CM_TRACE_PAGEOUTONE, ICL_TYPE_LONG, avc,
@@ -647,21 +589,21 @@ afs_putapage(struct vnode *vp, struct page *pages, u_int * offp,
 }
 
 int
-afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw,
-           int ioflag, struct AFS_UCRED *acred)
+afs_nfsrdwr(struct vcache *avc, struct uio *auio, enum uio_rw arw,
+           int ioflag, afs_ucred_t *acred)
 {
-    register afs_int32 code;
+    afs_int32 code;
     afs_int32 code2;
     int counter;
     afs_int32 mode, sflags;
-    register char *data;
+    char *data;
     struct dcache *dcp, *dcp_newpage;
     afs_size_t fileBase, size;
     afs_size_t pageBase;
-    register afs_int32 tsize;
-    register afs_int32 pageOffset, extraResid = 0;
-    register afs_size_t origLength;    /* length when reading/writing started */
-    register long appendLength;        /* length when this call will finish */
+    afs_int32 tsize;
+    afs_int32 pageOffset, extraResid = 0;
+    afs_size_t origLength;     /* length when reading/writing started */
+    long appendLength; /* length when this call will finish */
     int created;               /* created pages instead of faulting them */
     int lockCode;
     int didFakeOpen, eof;
@@ -719,11 +661,7 @@ afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw,
 
     /* adjust parameters when appending files */
     if ((ioflag & IO_APPEND) && arw == UIO_WRITE) {
-#if defined(AFS_SUN56_ENV)
        auio->uio_loffset = avc->f.m.Length;    /* write at EOF position */
-#else
-       auio->uio_offset = avc->f.m.Length;     /* write at EOF position */
-#endif
     }
     if (auio->afsio_offset < 0 || (auio->afsio_offset + auio->uio_resid) < 0) {
        ReleaseWriteLock(&avc->lock);
@@ -742,7 +680,6 @@ afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw,
     didFakeOpen = 0;           /* keep track of open so we can do close */
     if (arw == UIO_WRITE) {
        /* do ulimit processing; shrink resid or fail */
-#if    defined(AFS_SUN56_ENV)
        if (auio->uio_loffset + auio->afsio_resid > auio->uio_llimit) {
            if (auio->uio_loffset >= auio->uio_llimit) {
                ReleaseWriteLock(&avc->lock);
@@ -758,25 +695,6 @@ afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw,
                extraResid -= auio->uio_resid;
            }
        }
-#else
-#ifdef AFS_SUN52_ENV
-       if (auio->afsio_offset + auio->afsio_resid > auio->uio_limit) {
-           if (auio->afsio_offset >= auio->uio_limit) {
-               ReleaseWriteLock(&avc->lock);
-               afs_BozonUnlock(&avc->pvnLock, avc);
-               return EFBIG;
-           } else {
-               /* track # of bytes we should write, but won't because of
-                * ulimit; we must add this into the final resid value
-                * so caller knows we punted some data.
-                */
-               extraResid = auio->uio_resid;
-               auio->uio_resid = auio->uio_limit - auio->afsio_offset;
-               extraResid -= auio->uio_resid;
-           }
-       }
-#endif
-#endif /* SUN56 */
        mode = S_WRITE;         /* segment map-in mode */
        afs_FakeOpen(avc);      /* do this for writes, so data gets put back
                                 * when we want it to be put back */
@@ -899,13 +817,8 @@ afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw,
        }
        ReleaseWriteLock(&avc->lock);   /* uiomove may page fault */
        AFS_GUNLOCK();
-#if    defined(AFS_SUN56_ENV)
        data = segmap_getmap(segkmap, AFSTOV(avc), (u_offset_t) pageBase);
        raddr = (caddr_t) (((uintptr_t) data + pageOffset) & PAGEMASK);
-#else
-       data = segmap_getmap(segkmap, AFSTOV(avc), pageBase);
-       raddr = (caddr_t) (((u_int) data + pageOffset) & PAGEMASK);
-#endif
        rsize =
            (((u_int) data + pageOffset + tsize + PAGEOFFSET) & PAGEMASK) -
            (u_int) raddr;
@@ -989,34 +902,26 @@ afs_nfsrdwr(register struct vcache *avc, struct uio *auio, enum uio_rw arw,
     ReleaseWriteLock(&avc->lock);
     afs_BozonUnlock(&avc->pvnLock, avc);
     if (!code) {
-#ifdef AFS_SUN53_ENV
        if ((ioflag & FSYNC) && (arw == UIO_WRITE)
            && !AFS_NFSXLATORREQ(acred))
            code = afs_fsync(avc, 0, acred);
-#else
-       if ((ioflag & IO_SYNC) && (arw == UIO_WRITE)
-           && !AFS_NFSXLATORREQ(acred))
-           code = afs_fsync(avc, acred);
-#endif
     }
-#ifdef AFS_SUN52_ENV
     /* 
      * If things worked, add in as remaining in request any bytes
      * we didn't write due to file size ulimit.
      */
     if (code == 0 && extraResid > 0)
        auio->uio_resid += extraResid;
-#endif
     return afs_CheckCode(code, &treq, 46);
 }
 
 int
-afs_map(struct vnode *vp, offset_t off, struct as *as, caddr_t *addr, u_int len, u_char prot, u_char maxprot, u_int flags, struct AFS_UCRED *cred)
+afs_map(struct vnode *vp, offset_t off, struct as *as, caddr_t *addr, u_int len, u_char prot, u_char maxprot, u_int flags, afs_ucred_t *cred)
 {
     struct segvn_crargs crargs;
-    register afs_int32 code;
+    afs_int32 code;
     struct vrequest treq;
-    register struct vcache *avc = VTOAFS(vp);
+    struct vcache *avc = VTOAFS(vp);
 
     AFS_STATCNT(afs_map);
 
@@ -1059,13 +964,7 @@ afs_map(struct vnode *vp, offset_t off, struct as *as, caddr_t *addr, u_int len,
     AFS_GUNLOCK();
     as_rangelock(as);
     if ((flags & MAP_FIXED) == 0) {
-#if    defined(AFS_SUN57_ENV)
        map_addr(addr, len, off, 1, flags);
-#elif  defined(AFS_SUN56_ENV)
-       map_addr(addr, len, off, 1);
-#else
-       map_addr(addr, len, (off_t) off, 1);
-#endif
        if (*addr == NULL) {
            as_rangeunlock(as);
            code = ENOMEM;
@@ -1102,8 +1001,13 @@ afs_map(struct vnode *vp, offset_t off, struct as *as, caddr_t *addr, u_int len,
  * at some point.
  */
 int
-afs_pathconf(struct vnode *vp, int cmd, u_long *outdatap, 
-            register struct AFS_UCRED *credp)
+#ifdef AFS_SUN511_ENV
+afs_pathconf(struct vnode *vp, int cmd, u_long *outdatap,
+            afs_ucred_t *credp, caller_context_t *ct)
+#else
+afs_pathconf(struct vnode *vp, int cmd, u_long *outdatap,
+            afs_ucred_t *credp)
+#endif /* AFS_SUN511_ENV */
 {
     AFS_STATCNT(afs_cntl);
     switch (cmd) {
@@ -1122,8 +1026,19 @@ afs_pathconf(struct vnode *vp, int cmd, u_long *outdatap,
     case _PC_NO_TRUNC:
        *outdatap = 1;
        break;
+    case _PC_FILESIZEBITS:
+#ifdef AFS_64BIT_CLIENT
+       *outdatap = 64;
+#else
+       *outdatap = 32;
+#endif
+       break;
     default:
-       return EINVAL;
+#ifdef AFS_SUN511_ENV
+       return fs_pathconf(vp, cmd, outdatap, credp, ct);
+#else
+       return fs_pathconf(vp, cmd, outdatap, credp);
+#endif /* AFS_SUN511_ENV */
     }
     return 0;
 }
@@ -1153,7 +1068,7 @@ afs_rwunlock(struct vnode *vnp, int wlock)
 int
 afs_seek(struct vnode *vnp, offset_t ooff, offset_t *noffp)
 {
-    register int code = 0;
+    int code = 0;
 
 #ifndef AFS_64BIT_CLIENT
 # define __MAXOFF_T MAXOFF_T
@@ -1169,16 +1084,13 @@ afs_seek(struct vnode *vnp, offset_t ooff, offset_t *noffp)
 int
 #ifdef AFS_SUN59_ENV
 afs_frlock(struct vnode *vnp, int cmd, struct flock64 *ap, int flag, 
-          offset_t off, struct flk_callback *flkcb, struct AFS_UCRED *credp)
-#elif defined(AFS_SUN56_ENV)
-afs_frlock(struct vnode *vnp, int cmd, struct flock64 *ap, int flag, 
-          offset_t off, struct AFS_UCRED *credp)
+          offset_t off, struct flk_callback *flkcb, afs_ucred_t *credp)
 #else
-afs_frlock(struct vnode *vnp, int cmd, struct flock *ap, int flag, 
-          offset_t off, struct AFS_UCRED *credp)
+afs_frlock(struct vnode *vnp, int cmd, struct flock64 *ap, int flag,
+          offset_t off, afs_ucred_t *credp)
 #endif
 {
-    register afs_int32 code = 0;
+    afs_int32 code = 0;
     /*
      * Implement based on afs_lockctl
      */
@@ -1189,20 +1101,11 @@ afs_frlock(struct vnode *vnp, int cmd, struct flock *ap, int flag,
 #endif
     if ((cmd == F_GETLK) || (cmd == F_O_GETLK) || (cmd == F_SETLK)
        || (cmd == F_SETLKW)) {
-#ifdef AFS_SUN53_ENV
        ap->l_pid = ttoproc(curthread)->p_pid;
        ap->l_sysid = 0;
-#else
-       ap->l_pid = ttoproc(curthread)->p_epid;
-       ap->l_sysid = ttoproc(curthread)->p_sysid;
-#endif
 
        AFS_GUNLOCK();
-#ifdef AFS_SUN56_ENV
        code = convoff(vnp, ap, 0, off);
-#else
-       code = convoff(vnp, ap, 0, (off_t) off);
-#endif
        if (code)
            return code;
        AFS_GLOCK();
@@ -1215,23 +1118,14 @@ afs_frlock(struct vnode *vnp, int cmd, struct flock *ap, int flag,
 
 
 int
-#if    defined(AFS_SUN56_ENV)
 afs_space(struct vnode *vnp, int cmd, struct flock64 *ap, int flag, 
-         offset_t off, struct AFS_UCRED *credp)
-#else
-afs_space(struct vnode *vnp, int cmd, struct flock *ap, int flag, 
-         offset_t off, struct AFS_UCRED *credp)
-#endif
+         offset_t off, afs_ucred_t *credp)
 {
-    register afs_int32 code = EINVAL;
+    afs_int32 code = EINVAL;
     struct vattr vattr;
 
     if ((cmd == F_FREESP)
-#ifdef AFS_SUN56_ENV
        && ((code = convoff(vnp, ap, 0, off)) == 0)) {
-#else
-       && ((code = convoff(vnp, ap, 0, (off_t) off)) == 0)) {
-#endif
        AFS_GLOCK();
        if (!ap->l_len) {
            vattr.va_mask = AT_SIZE;
@@ -1288,7 +1182,6 @@ afs_dumpctl(struct vnode *vp, int i)
     return EINVAL;
 }
 
-#ifdef AFS_SUN54_ENV
 #ifdef AFS_SUN511_ENV
 extern void
 afs_dispose(struct vnode *vp, struct page *p, int fl, int dn, struct cred *cr, struct caller_context_t *ct)
@@ -1327,59 +1220,58 @@ afs_getsecattr(struct vnode *vp, vsecattr_t *vsecattr, int flag, struct cred *cr
     return fs_fab_acl(vp, vsecattr, flag, creds);
 }
 #endif
-#endif
 
 #ifdef AFS_GLOBAL_SUNLOCK
-extern int gafs_open(register struct vcache **avcp, afs_int32 aflags, 
-                    struct AFS_UCRED *acred);
-extern int gafs_close(register struct vcache *avc, afs_int32 aflags, 
-                     int count, offset_t offset, struct AFS_UCRED *acred);
+extern int gafs_open(struct vcache **avcp, afs_int32 aflags, 
+                    afs_ucred_t *acred);
+extern int gafs_close(struct vcache *avc, afs_int32 aflags, 
+                     int count, offset_t offset, afs_ucred_t *acred);
 extern int afs_ioctl(struct vnode *vnp, int com, int arg, int flag, 
                     cred_t *credp, int *rvalp);
-extern int gafs_access(register struct vcache *avc, register afs_int32 amode,
-                      int flags, struct AFS_UCRED *acred);
-extern int gafs_getattr(register struct vcache *avc, 
-                       register struct vattr *attrs, int flags, 
-                       struct AFS_UCRED *acred);
-extern int gafs_setattr(register struct vcache *avc, 
-                       register struct vattr *attrs, int flags, 
-                       struct AFS_UCRED *acred);
-extern int gafs_lookup(register struct vcache *adp, char *aname, 
-                      register struct vcache **avcp, struct pathname *pnp,
-                      int flags, struct vnode *rdir, struct AFS_UCRED *acred);
-extern int gafs_remove(register struct vcache *adp, char *aname, 
-                      struct AFS_UCRED *acred);
-extern int gafs_link(register struct vcache *adp, register struct vcache *avc,
-                    char *aname, struct AFS_UCRED *acred);
-extern int gafs_rename(register struct vcache *aodp, char *aname1,
-                      register struct vcache *andp, char *aname2,
-                      struct AFS_UCRED *acred);
-extern int gafs_symlink(register struct vcache *adp, char *aname, 
-                       struct vattr *attrs, register char *atargetName, 
-                       struct AFS_UCRED *acred);
-extern int gafs_rmdir(register struct vcache *adp, char *aname, 
-                     struct vnode *cdirp, struct AFS_UCRED *acred);
-extern int gafs_mkdir(register struct vcache *adp, char *aname, 
-                     struct vattr *attrs, register struct vcache **avcp, 
-                     struct AFS_UCRED *acred);
-extern int
-#ifdef  AFS_SUN53_ENV
-gafs_fsync(register struct vcache *avc, int flag, struct AFS_UCRED *acred);
-#else
-gafs_fsync(register struct vcache *avc, struct AFS_UCRED *acred);
-#endif
-extern int gafs_readlink(register struct vcache *avc, struct uio *auio, 
-                        struct AFS_UCRED *acred);
-extern int gafs_readdir(register struct vcache *avc, struct uio *auio,
-                       struct AFS_UCRED *acred, int *eofp);
-extern void gafs_inactive(register struct vcache *avc, 
-                         struct AFS_UCRED *acred);
+extern int gafs_access(struct vcache *avc, afs_int32 amode,
+                      int flags, afs_ucred_t *acred);
+extern int gafs_getattr(struct vcache *avc, 
+                       struct vattr *attrs, int flags, 
+                       afs_ucred_t *acred);
+extern int gafs_setattr(struct vcache *avc, 
+                       struct vattr *attrs, int flags, 
+                       afs_ucred_t *acred);
+extern int gafs_lookup(struct vcache *adp, char *aname, 
+                      struct vcache **avcp, struct pathname *pnp,
+                      int flags, struct vnode *rdir, afs_ucred_t *acred);
+extern int gafs_remove(struct vcache *adp, char *aname, 
+                      afs_ucred_t *acred);
+extern int gafs_link(struct vcache *adp, struct vcache *avc,
+                    char *aname, afs_ucred_t *acred);
+extern int gafs_rename(struct vcache *aodp, char *aname1,
+                      struct vcache *andp, char *aname2,
+                      afs_ucred_t *acred);
+extern int gafs_symlink(struct vcache *adp, char *aname, 
+                       struct vattr *attrs, char *atargetName, 
+                       afs_ucred_t *acred);
+extern int gafs_rmdir(struct vcache *adp, char *aname, 
+                     struct vnode *cdirp, afs_ucred_t *acred);
+extern int gafs_mkdir(struct vcache *adp, char *aname, 
+                     struct vattr *attrs, struct vcache **avcp, 
+                     afs_ucred_t *acred);
+extern int gafs_fsync(struct vcache *avc, int flag, afs_ucred_t *acred);
+extern int gafs_readlink(struct vcache *avc, struct uio *auio, 
+                        afs_ucred_t *acred);
+extern int gafs_readdir(struct vcache *avc, struct uio *auio,
+                       afs_ucred_t *acred, int *eofp);
+extern void gafs_inactive(struct vcache *avc, 
+                         afs_ucred_t *acred);
 extern int gafs_fid(struct vcache *avc, struct fid **fidpp);
-extern int gafs_create(register struct vcache *adp, char *aname, 
+extern int gafs_create(struct vcache *adp, char *aname, 
                       struct vattr *attrs, enum vcexcl aexcl, int amode, 
-                      struct vcache **avcp, struct AFS_UCRED *acred);
+                      struct vcache **avcp, afs_ucred_t *acred);
+#ifdef AFS_SUN511_ENV
+extern int afs_pathconf(struct vnode *vp, int cmd, u_long *outdatap,
+                       afs_ucred_t *credp, caller_context_t *ct);
+#else
 extern int afs_pathconf(struct vnode *vp, int cmd, u_long *outdatap,
-                       register struct AFS_UCRED *credp);
+                       afs_ucred_t *credp);
+#endif /* AFS_SUN511_ENV */
 
 #if defined(AFS_SUN511_ENV)
 /* The following list must always be NULL-terminated */
@@ -1520,23 +1412,19 @@ struct vnodeops Afs_vnodeops = {
     afs_pathconf,
     afs_pageio,
     afs_dumpctl,
-#ifdef AFS_SUN54_ENV
     afs_dispose,
     afs_setsecattr,
     afs_getsecattr,
-#endif
-#if    defined(AFS_SUN56_ENV)
     fs_shrlock,
-#endif
 };
 struct vnodeops *afs_ops = &Afs_vnodeops;
 #endif
 
 int
-gafs_open(register struct vcache **avcp, afs_int32 aflags, 
-         struct AFS_UCRED *acred)
+gafs_open(struct vcache **avcp, afs_int32 aflags, 
+         afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_open(avcp, aflags, acred);
@@ -1545,10 +1433,10 @@ gafs_open(register struct vcache **avcp, afs_int32 aflags,
 }
 
 int
-gafs_close(register struct vcache *avc, afs_int32 aflags, int count, 
-          offset_t offset, struct AFS_UCRED *acred)
+gafs_close(struct vcache *avc, afs_int32 aflags, int count, 
+          offset_t offset, afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_close(avc, aflags, count, offset, acred);
@@ -1557,10 +1445,10 @@ gafs_close(register struct vcache *avc, afs_int32 aflags, int count,
 }
 
 int
-gafs_getattr(register struct vcache *avc, register struct vattr *attrs, 
-            int flags, struct AFS_UCRED *acred)
+gafs_getattr(struct vcache *avc, struct vattr *attrs, 
+            int flags, afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_getattr(avc, attrs, flags, acred);
@@ -1570,10 +1458,10 @@ gafs_getattr(register struct vcache *avc, register struct vattr *attrs,
 
 
 int
-gafs_setattr(register struct vcache *avc, register struct vattr *attrs, 
-            int flags, struct AFS_UCRED *acred)
+gafs_setattr(struct vcache *avc, struct vattr *attrs, 
+            int flags, afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_setattr(avc, attrs, flags, acred);
@@ -1583,10 +1471,10 @@ gafs_setattr(register struct vcache *avc, register struct vattr *attrs,
 
 
 int
-gafs_access(register struct vcache *avc, register afs_int32 amode, int flags, 
-           struct AFS_UCRED *acred)
+gafs_access(struct vcache *avc, afs_int32 amode, int flags, 
+           afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_access(avc, amode, flags, acred);
@@ -1596,11 +1484,11 @@ gafs_access(register struct vcache *avc, register afs_int32 amode, int flags,
 
 
 int
-gafs_lookup(register struct vcache *adp, char *aname, 
-           register struct vcache **avcp, struct pathname *pnp, int flags, 
-           struct vnode *rdir, struct AFS_UCRED *acred)
+gafs_lookup(struct vcache *adp, char *aname, 
+           struct vcache **avcp, struct pathname *pnp, int flags, 
+           struct vnode *rdir, afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_lookup(adp, aname, avcp, pnp, flags, rdir, acred);
@@ -1610,11 +1498,11 @@ gafs_lookup(register struct vcache *adp, char *aname,
 
 
 int
-gafs_create(register struct vcache *adp, char *aname, struct vattr *attrs, 
+gafs_create(struct vcache *adp, char *aname, struct vattr *attrs, 
            enum vcexcl aexcl, int amode, struct vcache **avcp, 
-           struct AFS_UCRED *acred)
+           afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_create(adp, aname, attrs, aexcl, amode, avcp, acred);
@@ -1623,9 +1511,9 @@ gafs_create(register struct vcache *adp, char *aname, struct vattr *attrs,
 }
 
 int
-gafs_remove(register struct vcache *adp, char *aname, struct AFS_UCRED *acred)
+gafs_remove(struct vcache *adp, char *aname, afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_remove(adp, aname, acred);
@@ -1634,10 +1522,10 @@ gafs_remove(register struct vcache *adp, char *aname, struct AFS_UCRED *acred)
 }
 
 int
-gafs_link(register struct vcache *adp, register struct vcache *avc, 
-         char *aname, struct AFS_UCRED *acred)
+gafs_link(struct vcache *adp, struct vcache *avc, 
+         char *aname, afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_link(adp, avc, aname, acred);
@@ -1646,11 +1534,11 @@ gafs_link(register struct vcache *adp, register struct vcache *avc,
 }
 
 int
-gafs_rename(register struct vcache *aodp, char *aname1, 
-           register struct vcache *andp, char *aname2, 
-           struct AFS_UCRED *acred)
+gafs_rename(struct vcache *aodp, char *aname1, 
+           struct vcache *andp, char *aname2, 
+           afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_rename(aodp, aname1, andp, aname2, acred);
@@ -1679,10 +1567,10 @@ gafs_rename(register struct vcache *aodp, char *aname1,
 }
 
 int
-gafs_mkdir(register struct vcache *adp, char *aname, struct vattr *attrs, 
-          register struct vcache **avcp, struct AFS_UCRED *acred)
+gafs_mkdir(struct vcache *adp, char *aname, struct vattr *attrs, 
+          struct vcache **avcp, afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_mkdir(adp, aname, attrs, avcp, acred);
@@ -1691,10 +1579,10 @@ gafs_mkdir(register struct vcache *adp, char *aname, struct vattr *attrs,
 }
 
 int
-gafs_rmdir(register struct vcache *adp, char *aname, struct vnode *cdirp, 
-          struct AFS_UCRED *acred)
+gafs_rmdir(struct vcache *adp, char *aname, struct vnode *cdirp, 
+          afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_rmdir(adp, aname, cdirp, acred);
@@ -1704,10 +1592,10 @@ gafs_rmdir(register struct vcache *adp, char *aname, struct vnode *cdirp,
 
 
 int
-gafs_readdir(register struct vcache *avc, struct uio *auio,
-            struct AFS_UCRED *acred, int *eofp)
+gafs_readdir(struct vcache *avc, struct uio *auio,
+            afs_ucred_t *acred, int *eofp)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_readdir(avc, auio, acred, eofp);
@@ -1716,10 +1604,10 @@ gafs_readdir(register struct vcache *avc, struct uio *auio,
 }
 
 int
-gafs_symlink(register struct vcache *adp, char *aname, struct vattr *attrs,
-            register char *atargetName, struct AFS_UCRED *acred)
+gafs_symlink(struct vcache *adp, char *aname, struct vattr *attrs,
+            char *atargetName, afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_symlink(adp, aname, attrs, atargetName, acred);
@@ -1729,9 +1617,9 @@ gafs_symlink(register struct vcache *adp, char *aname, struct vattr *attrs,
 
 
 int
-gafs_readlink(register struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred)
+gafs_readlink(struct vcache *avc, struct uio *auio, afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_readlink(avc, auio, acred);
@@ -1740,26 +1628,18 @@ gafs_readlink(register struct vcache *avc, struct uio *auio, struct AFS_UCRED *a
 }
 
 int
-#ifdef AFS_SUN53_ENV
-gafs_fsync(register struct vcache *avc, int flag, struct AFS_UCRED *acred)
-#else
-gafs_fsync(register struct vcache *avc, struct AFS_UCRED *acred)
-#endif
+gafs_fsync(struct vcache *avc, int flag, afs_ucred_t *acred)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
-#ifdef AFS_SUN53_ENV
     code = afs_fsync(avc, flag, acred);
-#else
-    code = afs_fsync(avc, acred);
-#endif
     AFS_GUNLOCK();
     return (code);
 }
 
 int
-afs_inactive(struct vcache *avc, struct AFS_UCRED *acred)
+afs_inactive(struct vcache *avc, afs_ucred_t *acred)
 {
     struct vnode *vp = AFSTOV(avc);
     if (afs_shuttingdown)
@@ -1795,11 +1675,18 @@ afs_inactive(struct vcache *avc, struct AFS_UCRED *acred)
        avc->opens = avc->execsOrWriters = 0;
 
     afs_InactiveVCache(avc, acred);
+
+    AFS_GUNLOCK();
+    /* VFS_RELE must be called outside of GLOCK, since it can potentially
+     * call afs_freevfs, which acquires GLOCK */
+    VFS_RELE(afs_globalVFS);
+    AFS_GLOCK();
+
     return 0;
 }
 
 void
-gafs_inactive(register struct vcache *avc, struct AFS_UCRED *acred)
+gafs_inactive(struct vcache *avc, afs_ucred_t *acred)
 {
     AFS_GLOCK();
     (void)afs_inactive(avc, acred);
@@ -1810,7 +1697,7 @@ gafs_inactive(register struct vcache *avc, struct AFS_UCRED *acred)
 int
 gafs_fid(struct vcache *avc, struct fid **fidpp)
 {
-    register int code;
+    int code;
 
     AFS_GLOCK();
     code = afs_fid(avc, fidpp);