]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
This commit was generated by cvs2svn to compensate for changes in r461,
authorSam Hartman <hartmans@debian.org>
Fri, 10 May 2002 23:46:45 +0000 (23:46 +0000)
committerSam Hartman <hartmans@debian.org>
Fri, 10 May 2002 23:46:45 +0000 (23:46 +0000)
which included commits to RCS files with non-trunk default branches.

60 files changed:
.cvsignore
acinclude.m4
configure-libafs.in
src/WINNT/afsd/cm_dcache.c
src/WINNT/afsd/cm_scache.c
src/WINNT/afsd/smb3.h
src/WINNT/afssvrmgr/cmdline.cpp
src/afs/AIX/osi_vfsops.c
src/afs/AIX/osi_vm.c
src/afs/AIX/osi_vnodeops.c
src/afs/DARWIN/osi_vfsops.c
src/afs/DARWIN/osi_vm.c
src/afs/DARWIN/osi_vnodeops.c
src/afs/DUX/osi_machdep.h
src/afs/DUX/osi_vfsops.c
src/afs/DUX/osi_vm.c
src/afs/DUX/osi_vnodeops.c
src/afs/FBSD/osi_vfsops.c
src/afs/FBSD/osi_vm.c
src/afs/HPUX/osi_machdep.h
src/afs/HPUX/osi_vfsops.c
src/afs/HPUX/osi_vm.c
src/afs/HPUX/osi_vnodeops.c
src/afs/IRIX/osi_machdep.h
src/afs/IRIX/osi_vfsops.c
src/afs/IRIX/osi_vm.c
src/afs/IRIX/osi_vnodeops.c
src/afs/LINUX/osi_alloc.c
src/afs/LINUX/osi_groups.c
src/afs/LINUX/osi_vfsops.c
src/afs/LINUX/osi_vm.c
src/afs/SOLARIS/osi_groups.c
src/afs/SOLARIS/osi_inode.c
src/afs/SOLARIS/osi_machdep.h
src/afs/SOLARIS/osi_vfsops.c
src/afs/SOLARIS/osi_vm.c
src/afs/SOLARIS/osi_vnodeops.c
src/afs/UKERNEL/afs_usrops.c
src/afs/UKERNEL/osi_machdep.h
src/afs/UKERNEL/osi_vfsops.c
src/afs/UKERNEL/osi_vnodeops.c
src/afs/VNOPS/afs_vnop_attrs.c
src/afs/VNOPS/afs_vnop_create.c
src/afs/VNOPS/afs_vnop_dirops.c
src/afs/VNOPS/afs_vnop_fid.c
src/afs/VNOPS/afs_vnop_flock.c
src/afs/VNOPS/afs_vnop_link.c
src/afs/VNOPS/afs_vnop_open.c
src/afs/VNOPS/afs_vnop_remove.c
src/afs/VNOPS/afs_vnop_rename.c
src/afs/VNOPS/afs_vnop_strategy.c
src/afs/VNOPS/afs_vnop_symlink.c
src/afs/VNOPS/afs_vnop_write.c
src/afs/afs_callback.c
src/afs/afs_dcache.c
src/afs/afs_nfsdisp.c
src/afs/afs_osi.c
src/afs/afs_server.c
src/afs/afs_vcache.c
src/afs/afs_volume.c

index 4360cc321d433cd9a2bcaec845fbf1964e5665fa..c2948c21e867f5d3444612764ae53d05eedceeae 100644 (file)
@@ -1,6 +1,7 @@
 Makefile
 aclocal.m4
 config.log
+config.cache
 config.status
 configure
 configure-libafs
@@ -13,3 +14,4 @@ lib
 sgi_65
 sun4x_56
 sun4x_57
+autom4te.cache
index 84dc1d612a881f409cfc5cfcf124c0f70d641708..e72a8885f8259ebe8407d12081ec97ee56da42e3 100644 (file)
@@ -47,6 +47,9 @@ AC_ARG_ENABLE(transarc-paths,
 AC_ARG_ENABLE(tivoli-tsm,
 [  --enable-tivoli-tsm                 Enable use of the Tivoli TSM API libraries for butc support],, enable_tivoli_tsm="no"
 )
+AC_ARG_ENABLE(debug-kernel,
+[  --enable-debug-kernel               enable compilation of the kernel module with debugging information (defaults to disabled)],, enable_debug_kernel="no"
+)
 
 dnl weird ass systems
 AC_AIX
@@ -70,6 +73,11 @@ AM_PROG_LEX
 
 OPENAFS_CHECK_BIGENDIAN
 
+KERN_DEBUG_OPT=
+if test "x$enable_debug_kernel" = "xyes"; then
+  KERN_DEBUG_OPT=-g
+fi
+
 AC_MSG_CHECKING(your OS)
 system=$host
 case $system in
@@ -120,6 +128,11 @@ case $system in
                fi
                AC_MSG_RESULT(linux)
                if test "x$enable_kernel_module" = "xyes"; then
+                OMIT_FRAME_POINTER=
+                if test "x$enable_debug_kernel" = "xno"; then
+                       OMIT_FRAME_POINTER=-fomit-frame-pointer
+                fi
+                AC_SUBST(OMIT_FRAME_POINTER)
                 ifdef([OPENAFS_CONFIGURE_LIBAFS],
                   [LINUX_BUILD_VNODE_FROM_INODE(config,afs)],
                   [LINUX_BUILD_VNODE_FROM_INODE(src/config,src/afs/LINUX)]
@@ -153,6 +166,7 @@ case $system in
                MKAFS_OSTYPE=SOLARIS
                 AC_MSG_RESULT(sun4)
                SOLARIS_UFSVFS_HAS_DQRWLOCK
+               SOLARIS_PROC_HAS_P_COREFILE
                 ;;
         *-hpux*)
                MKAFS_OSTYPE=HPUX
@@ -200,6 +214,7 @@ case $system in
                 AC_MSG_RESULT($system)
                 ;;
 esac
+AC_SUBST(KERN_DEBUG_OPT)
 
 if test "x$with_afs_sysname" != "x"; then
         AFS_SYSNAME="$with_afs_sysname"
@@ -230,6 +245,12 @@ else
                powerpc-apple-darwin5.2*)
                        AFS_SYSNAME="ppc_darwin_14"
                        ;;
+               powerpc-apple-darwin5.3*)
+                       AFS_SYSNAME="ppc_darwin_14"
+                       ;;
+               powerpc-apple-darwin5.4*)
+                       AFS_SYSNAME="ppc_darwin_14"
+                       ;;
                sparc-sun-solaris2.5*)
                        AFS_SYSNAME="sun4x_55"
                        ;;
@@ -442,6 +463,7 @@ AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
 
 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
+AC_CHECK_FUNCS(setprogname getprogname)
 
 dnl Directory PATH handling
 if test "x$enable_transarc_paths" = "xyes"  ; then 
index 94e17f275be82f477f1a29acf6a12fe2e5a77334..f64440e31572bed13136922bc71ed1ce16f45722 100644 (file)
@@ -1,5 +1,5 @@
 AC_INIT(Makefile.common)
-AM_INIT_AUTOMAKE(openafs-libafs,1.2.3)
+AM_INIT_AUTOMAKE(openafs-libafs,1.2.4)
 AC_CONFIG_HEADER(config/afsconfig.h)
 define(OPENAFS_CONFIGURE_LIBAFS)
 
index fb7b25181943adb7a6a98f89e4b4665ba8be255a..6a7a3ac96901c5c462c231f5a82a2e58050c894c 100644 (file)
@@ -1155,7 +1155,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *up,
                afsStatus.UnixModeBits = 0x1ff;
                afsStatus.ParentVnode = 0x1;
                afsStatus.ParentUnique = 0x1;
-               afsStatus.ResidencyMask = 0;
+               afsStatus.SegSize = 0;
                afsStatus.ClientModTime = 0x3b49f6e2;
                afsStatus.ServerModTime = 0x3b49f6e2;
                afsStatus.Group = 0;
index e8371b7d8e8a681667a9280fefa5adc435d18707..d3add600903837ee4ac09c6a08026df7084ccf17 100644 (file)
@@ -806,7 +806,7 @@ void cm_MergeStatus(cm_scache_t *scp, AFSFetchStatus *statusp, AFSVolSync *volp,
                statusp->UnixModeBits = 0x1ff;
                statusp->ParentVnode = 0x1;
                statusp->ParentUnique = 0x1;
-               statusp->ResidencyMask = 0;
+               statusp->SegSize = 0;
                statusp->ClientModTime = 0x3b49f6e2;
                statusp->ServerModTime = 0x3b49f6e2;
                statusp->Group = 0;
index 136ffab31e0828ef065b6213586b855789c2d9a4..72b945a3f7b96e9b24cd63d3904fe68ded2a2ac4 100644 (file)
@@ -41,6 +41,7 @@ typedef struct smb_tran2Dispatch {
 
 typedef struct smb_tran2QFSInfo {
        union {
+#pragma pack(push, 2)
                struct {
                        long FSID;                      /* file system ID */
                         long sectorsPerAllocUnit;
@@ -48,6 +49,7 @@ typedef struct smb_tran2QFSInfo {
                         long availAllocUnits;          /* free blocks */
                         unsigned short bytesPerSector; /* bytes per sector */
                 } allocInfo;
+#pragma pack(pop)
                 struct {
                        long vsn;       /* volume serial number */
                         char vnCount;  /* count of chars in label, incl null */
index 28bc8cb7a06f9dd48dcec9dbf0547361cc2ba2da..2293027682bf041ac62f7520dcbfa15a8892a6c4 100644 (file)
@@ -12,6 +12,8 @@ extern "C" {
 #include <afs/stds.h>
 }
 
+#include "../afsapplib/afsapplib.h"
+
 #include "svrmgr.h"
 #include "cmdline.h"
 #include "action.h"
@@ -32,6 +34,7 @@ typedef enum {
    swUSER,
    swPASSWORD,
    swLOOKUP,
+   swUSEEXISTING
 } SWITCH;
 
 static struct {
@@ -40,14 +43,15 @@ static struct {
    BOOL fPresent;
    TCHAR szValue[ cchRESOURCE ];
 } aSWITCHES[] = {
-   { TEXT("cell"),      TRUE  },
-   { TEXT("subset"),    TRUE  },
-   { TEXT("server"),    TRUE  },
-   { TEXT("reset"),     FALSE },
-   { TEXT("confirm"),   FALSE },
-   { TEXT("user"),      TRUE  },
-   { TEXT("password"),  TRUE  },
-   { TEXT("lookup"),    FALSE }
+   { TEXT("cell"),        TRUE  },
+   { TEXT("subset"),      TRUE  },
+   { TEXT("server"),      TRUE  },
+   { TEXT("reset"),       FALSE },
+   { TEXT("confirm"),     FALSE },
+   { TEXT("user"),        TRUE  },
+   { TEXT("password"),    TRUE  },
+   { TEXT("lookup"),      FALSE },
+   { TEXT("useexisting"), FALSE }
 };
 
 #define nSWITCHES (sizeof(aSWITCHES) / sizeof(aSWITCHES[0]))
@@ -251,6 +255,36 @@ CMDLINEOP ParseCommandLine (LPTSTR pszCmdLine)
       return opLOOKUPERRORCODE;
       }
 
+   if (aSWITCHES[ swUSEEXISTING ].fPresent)
+     {
+       ULONG ulStatus;
+       TCHAR szDefCell[ cchNAME ];
+       
+       if (aSWITCHES[ swCELL ].fPresent)
+        {
+          lstrcpy(szDefCell,aSWITCHES[ swCELL ].szValue);
+        }
+       else
+        {
+          AfsAppLib_GetLocalCell(szDefCell);
+        }
+       g.hCreds = AfsAppLib_GetCredentials(szDefCell,&ulStatus);
+       if (g.hCreds != NULL)
+        {
+          LPOPENCELL_PACKET lpocp = New (OPENCELL_PACKET);
+
+          memset(lpocp,0x00,sizeof(OPENCELL_PACKET));
+          lstrcpy(lpocp->szCell,szDefCell);
+          lpocp->fCloseAppOnFail = TRUE;
+          lpocp->hCreds = g.hCreds;
+          lpocp->sub = NULL;
+          StartTask(taskOPENCELL,NULL,lpocp);
+          return opNOCELLDIALOG;
+        }
+       else
+        return opCLOSEAPP;
+     }
+
    if (aSWITCHES[ swCELL ].fPresent)
       {
       LPOPENCELL_PACKET lpp = New (OPENCELL_PACKET);
index b7386af65bee10e5931986e0226238945fe3ee3d..7fc5b38c744a2d0f3d5a7f40325056ed94d5e3a3 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vfsops.c,v 1.1.1.4 2001/07/14 22:19:34 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vfsops.c,v 1.1.1.5 2002/05/10 23:43:33 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -121,14 +121,14 @@ static int afs_root_nolock (struct vfs *afsp, struct vnode **avpp)
        crfree(credp);
     }
     if (tvp) {
-       VN_HOLD((struct vnode *)tvp);
+       VN_HOLD(AFSTOV(tvp));
 
-       VN_LOCK((struct vnode *)tvp);
-       tvp->v.v_flag |= VROOT;     /* No-op on Ultrix 2.2 */
-       VN_UNLOCK((struct vnode *)tvp);
+       VN_LOCK(AFSTOV(tvp));
+       AFSTOV(tvp)->v_flag |= VROOT;       /* No-op on Ultrix 2.2 */
+       VN_UNLOCK(AFSTOV(tvp));
 
        afs_globalVFS = afsp;
-       *avpp = (struct vnode *) tvp;
+       *avpp = AFSTOV(tvp);
        afsp->vfs_mntd = *avpp;   
     }
 
index ff5c805a8e2ce146cc8e78192be9f900ac28fb16..46682c0a927f4f655706f016ba535388254d0907 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vm.c,v 1.1.1.4 2001/07/14 22:19:35 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vm.c,v 1.1.1.5 2002/05/10 23:43:33 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -59,7 +59,7 @@ osi_VM_FlushVCache(avc, slept)
     }
 
     /* Free the alloced gnode that was accompanying the vcache's vnode */
-    aix_gnode_rele((struct vnode *)avc);
+    aix_gnode_rele(AFSTOV(avc));
 
     return 0;
 }
@@ -107,7 +107,7 @@ osi_VM_StoreAllSegments(avc)
            avc->states &= ~CCore;
            avc->opens--;
            avc->execsOrWriters--;
-           AFS_RELE((struct vnode *)avc);      
+           AFS_RELE(AFSTOV(avc));      
            crfree((struct ucred *)avc->linkData);      
            avc->linkData = (char *)0;
        }
index f52e748cae5b28130fd621c2e586d08c914254d6..8ca0b0d4df84de0f9ad159a0994ab2df8f2b2743 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vnodeops.c,v 1.1.1.5 2001/09/11 14:24:53 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vnodeops.c,v 1.1.1.6 2002/05/10 23:43:34 hartmans Exp $");
 
 #include "../h/systm.h"
 #include "../h/types.h"
@@ -355,7 +355,7 @@ struct ucred        *cred;
 {
     int                error;
     struct vattr       va;
-    struct vcache *tvp = (struct vcache *)vp;
+    struct vcache *tvp = VTOAFS(vp);
     afs_int32 modes;
 
     AFS_STATCNT(afs_gn_open);
@@ -443,10 +443,10 @@ struct ucred      *cred;
      * we'd never flush the files out to the server! Gross but the simplest
      * solution we came out with */
     if (cred->cr_luid != RMTUSER_REQ) {
-       while ((flags & FNSHARE) && ((struct vcache *)*vpp)->opens) {
+       while ((flags & FNSHARE) && VTOAFS(*vpp)->opens) {
            if (!(flags & FDELAY))
                return ETXTBSY;
-           afs_osi_Sleep(&((struct vcache *)*vpp)->opens);
+           afs_osi_Sleep(&VTOAFS(*vpp)->opens);
        }
        /* Since in the standard copen() for bsd vnode kernels they do an
         * vop_open after the vop_create, we must do the open here since there
@@ -477,7 +477,7 @@ int
 afs_gn_rele(vp)
 struct vnode   *vp;
 {
-   struct vcache *vcp = (struct vcache *)vp;
+   struct vcache *vcp = VTOAFS(vp);
    int         error = 0;
 
     AFS_STATCNT(afs_gn_rele);
@@ -502,7 +502,7 @@ caddr_t             vinfo;          /* Ignored in AFS */
 struct ucred   *cred;
 {
     int                error;
-    struct vcache *tvp = (struct vcache *)vp;
+    struct vcache *tvp = VTOAFS(vp);
 
     AFS_STATCNT(afs_gn_close);
 
@@ -525,7 +525,7 @@ caddr_t             addr;
 u_int          len, off, flag;
 struct ucred   *cred;
 {
-    struct vcache *vcp = (struct vcache *)vp;
+    struct vcache *vcp = VTOAFS(vp);
     struct vrequest treq;
     afs_int32 error;
     AFS_STATCNT(afs_gn_map);
@@ -583,7 +583,7 @@ struct      vnode   *vp;
 int            flag;
 struct ucred   *cred;
 {
-    struct vcache *vcp = (struct vcache *)vp;
+    struct vcache *vcp = VTOAFS(vp);
     AFS_STATCNT(afs_gn_unmap);
     ObtainWriteLock(&vcp->lock, 402);
     if (flag & SHM_RDONLY) {
@@ -731,7 +731,7 @@ struct ucred        *cred;
     struct iovec iov;
     struct uio uio;
     static int fclear_init =0; 
-    register struct vcache *avc = (struct vcache *)vp;
+    register struct vcache *avc = VTOAFS(vp);
 
    AFS_STATCNT(afs_gn_fclear);
     if (!fclear_init) {
@@ -819,7 +819,7 @@ caddr_t             vinfo;      /* Ignored in AFS */
 struct vattr   *vattrp;
 struct ucred   *cred;
 {
-    register struct vcache *vcp = (struct vcache *)vp;   
+    register struct vcache *vcp = VTOAFS(vp);   
     struct vrequest treq;
     int error=0;
     int free_cred = 0;
@@ -928,7 +928,7 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp)
     register int i;
     afs_int32 blockSize, fileSize;
     afs_int32 xfrSize, xfrOffset;
-    register struct vcache *vcp = (struct vcache *)vp;
+    register struct vcache *vcp = VTOAFS(vp);
     struct dcache *tdc;
     register afs_int32 start_offset;
     int save_resid = uiop->afsio_resid;
index 069992e268e28085928a5f437cc4c9bd5469733d..6197f103d8386ab2660a3c075936d7fe7a469037 100644 (file)
@@ -1,7 +1,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vfsops.c,v 1.1.1.4 2001/09/11 14:24:55 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vfsops.c,v 1.1.1.5 2002/05/10 23:43:37 hartmans Exp $");
 
 #include <afs/sysincludes.h>            /* Standard vendor system headers */
 #include <afs/afsincludes.h>            /* Afs-based standard headers */
@@ -138,11 +138,11 @@ afs_root(struct mount *mp,
     if (tvp) {
         osi_vnhold(tvp,0);
     AFS_GUNLOCK();
-        vn_lock((struct vnode *)tvp, LK_EXCLUSIVE | LK_RETRY, p);
+        vn_lock(AFSTOV(tvp), LK_EXCLUSIVE | LK_RETRY, p);
     AFS_GLOCK();
        afs_globalVFS = mp;
-       *vpp = (struct vnode *) tvp;
-        tvp->v.v_flag |= VROOT;
+       *vpp = AFSTOV(tvp);
+        AFSTOV(tvp)->v_flag |= VROOT;
     }
 
     afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *vpp,
index 0a258bd345c97eb52f923f2668bb82439ffddf49..915b775e7d4cc5d0ff61e57a0b94832ec0c51da8 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vm.c,v 1.1.1.4 2002/01/22 19:48:05 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vm.c,v 1.1.1.5 2002/05/10 23:43:37 hartmans Exp $");
 
 #include "../afs/sysincludes.h" /* Standard vendor system headers */
 #include "../afs/afsincludes.h" /* Afs-based standard headers */
@@ -38,7 +38,7 @@ osi_VM_FlushVCache(avc, slept)
     struct vcache *avc;
     int *slept;
 {
-    struct vnode *vp=(struct vnode *)avc;
+    struct vnode *vp=AFSTOV(avc);
 #ifdef AFS_DARWIN14_ENV
     if (UBCINFOEXISTS(vp))
        return EBUSY;
@@ -80,7 +80,7 @@ void
 osi_VM_StoreAllSegments(avc)
     struct vcache *avc;
 {
-    struct vnode *vp=(struct vnode *)avc;
+    struct vnode *vp=AFSTOV(avc);
     ReleaseWriteLock(&avc->lock);
     AFS_GUNLOCK();
     if (UBCINFOEXISTS(vp)) {
@@ -105,7 +105,7 @@ osi_VM_TryToSmush(avc, acred, sync)
     struct AFS_UCRED *acred;
     int sync;
 {
-    struct vnode *vp=(struct vnode *)avc;
+    struct vnode *vp=AFSTOV(avc);
     void *object;
     kern_return_t kret;
     off_t size, lastpg;
@@ -134,7 +134,7 @@ osi_VM_FlushPages(avc, credp)
     struct vcache *avc;
     struct AFS_UCRED *credp;
 {
-    struct vnode *vp=(struct vnode *)avc;
+    struct vnode *vp=AFSTOV(avc);
     void *object;
     kern_return_t kret;
     off_t size;
@@ -161,7 +161,7 @@ osi_VM_Truncate(avc, alen, acred)
     int alen;
     struct AFS_UCRED *acred;
 {
-    struct vnode *vp=(struct vnode *)avc;
+    struct vnode *vp=AFSTOV(avc);
     if (UBCINFOEXISTS(vp))  {
        ubc_setsize(vp, alen);
     }
@@ -177,7 +177,7 @@ void osi_VM_TryReclaim(avc, slept)
      int *slept;
 {
     struct proc *p=current_proc();
-    struct vnode *vp=(struct vnode *)avc;
+    struct vnode *vp=AFSTOV(avc);
     void *obj;
 
     if (slept)
@@ -276,7 +276,7 @@ void osi_VM_TryReclaim(avc, slept)
 void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size) {
 
     void *object;
-    struct vcache *avc = (struct vcache *)vp;
+    struct vcache *avc = VTOAFS(vp);
 
 #ifdef AFS_DARWIN14_ENV
     offset=trunc_page(offset);
@@ -322,7 +322,7 @@ void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size) {
 }
 int osi_VM_Setup(struct vcache *avc) {
    int error;
-   struct vnode *vp=(struct vnode *)avc;
+   struct vnode *vp=AFSTOV(avc);
 
    if (UBCISVALID(vp) && (avc->states & CStatd)) {
       if (!UBCINFOEXISTS(vp) && !ISSET(vp->v_flag, VTERMINATE)) {
index 92ca7dc12039d45c60c79d5df92802d2e2789137..0da0a11157b85debf818452c37432bb6daf00d24 100644 (file)
@@ -1,7 +1,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.1.1.5 2002/01/22 19:48:06 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.1.1.6 2002/05/10 23:43:37 hartmans Exp $");
 
 #include <afs/sysincludes.h>            /* Standard vendor system headers */
 #include <afs/afsincludes.h>            /* Afs-based standard headers */
@@ -158,7 +158,7 @@ struct vop_lookup_args /* {
     if (flags & ISDOTDOT) 
        VOP_UNLOCK(dvp, 0, p);
     AFS_GLOCK();
-    error = afs_lookup((struct vcache *)dvp, name, &vcp, cnp->cn_cred);
+    error = afs_lookup(VTOAFS(dvp), name, &vcp, cnp->cn_cred);
     AFS_GUNLOCK();
     if (error) {
         if (flags & ISDOTDOT) 
@@ -172,7 +172,7 @@ struct vop_lookup_args /* {
        *ap->a_vpp = 0;
        return (error);
     }
-    vp = (struct vnode *)vcp;  /* always get a node if no error */
+    vp = AFSTOV(vcp);  /* always get a node if no error */
 
     /* The parent directory comes in locked.  We unlock it on return
        unless the caller wants it left locked.
@@ -224,7 +224,7 @@ afs_vop_create(ap)
 
     /* vnode layer handles excl/nonexcl */
     AFS_GLOCK();
-    error = afs_create((struct vcache *)dvp, name, ap->a_vap, NONEXCL,
+    error = afs_create(VTOAFS(dvp), name, ap->a_vap, NONEXCL,
                       ap->a_vap->va_mode, &vcp,
                       cnp->cn_cred);
     AFS_GUNLOCK();
@@ -236,11 +236,11 @@ afs_vop_create(ap)
     }
 
     if (vcp) {
-       *ap->a_vpp = (struct vnode *)vcp;
-       vn_lock((struct vnode *)vcp, LK_EXCLUSIVE| LK_RETRY, p);
-        if (UBCINFOMISSING((struct vnode *)vcp) ||
-            UBCINFORECLAIMED((struct vnode *)vcp))
-                ubc_info_init((struct vnode *)vcp);
+       *ap->a_vpp = AFSTOV(vcp);
+       vn_lock(*ap->a_vpp, LK_EXCLUSIVE| LK_RETRY, p);
+        if (UBCINFOMISSING(*ap->a_vpp) ||
+            UBCINFORECLAIMED(*ap->a_vpp))
+                ubc_info_init(*ap->a_vpp);
     }
     else *ap->a_vpp = 0;
 
@@ -275,11 +275,11 @@ afs_vop_open(ap)
        } */ *ap;
 {
     int error;
-    struct vcache *vc = (struct vcache *)ap->a_vp;
+    struct vcache *vc = VTOAFS(ap->a_vp);
     AFS_GLOCK();
     error = afs_open(&vc, ap->a_mode, ap->a_cred);
 #ifdef DIAGNOSTIC
-    if ((struct vnode *)vc != ap->a_vp)
+    if (AFSTOV(vc) != ap->a_vp)
        panic("AFS open changed vnode!");
 #endif
     afs_BozonLock(&vc->pvnLock, vc);
@@ -323,7 +323,7 @@ afs_vop_access(ap)
 {
     int code;
     AFS_GLOCK();
-    code=afs_access((struct vcache *)ap->a_vp, ap->a_mode, ap->a_cred);
+    code=afs_access(VTOAFS(ap->a_vp), ap->a_mode, ap->a_cred);
     AFS_GUNLOCK();
     return code;
 }
@@ -338,7 +338,7 @@ afs_vop_getattr(ap)
 {
     int code;
     AFS_GLOCK();
-    code=afs_getattr((struct vcache *)ap->a_vp, ap->a_vap, ap->a_cred);
+    code=afs_getattr(VTOAFS(ap->a_vp), ap->a_vap, ap->a_cred);
     AFS_GUNLOCK();
     return code;
 }
@@ -353,7 +353,7 @@ afs_vop_setattr(ap)
 {
     int code;
     AFS_GLOCK();
-    code=afs_setattr((struct vcache *)ap->a_vp, ap->a_vap, ap->a_cred);
+    code=afs_setattr(VTOAFS(ap->a_vp), ap->a_vap, ap->a_cred);
     AFS_GUNLOCK();
     return code;
 }
@@ -367,7 +367,7 @@ afs_vop_read(ap)
        } */ *ap;
 {
     int code;
-    struct vcache *avc=(struct vcache *)ap->a_vp;
+    struct vcache *avc=VTOAFS(ap->a_vp);
     AFS_GLOCK();
     afs_BozonLock(&avc->pvnLock, avc);
     osi_FlushPages(avc);        /* hold bozon lock, but not basic vnode lock */
@@ -402,7 +402,7 @@ afs_vop_pagein(ap)
     int nocommit = flags & UPL_NOCOMMIT;
 
     int code;
-    struct vcache *tvc=(struct vcache *)vp;
+    struct vcache *tvc=VTOAFS(vp);
 
     if (UBCINVALID(vp)) {
 #if DIAGNOSTIC
@@ -479,7 +479,7 @@ afs_vop_write(ap)
        } */ *ap;
 {
     int code;
-    struct vcache *avc=(struct vcache *)ap->a_vp;
+    struct vcache *avc=VTOAFS(ap->a_vp);
     void *object;
     AFS_GLOCK();
     afs_BozonLock(&avc->pvnLock, avc);
@@ -488,7 +488,7 @@ afs_vop_write(ap)
        ubc_clean(ap->a_vp, 1);
     if (UBCINFOEXISTS(ap->a_vp))
        osi_VM_NukePages(ap->a_vp, ap->a_uio->uio_offset, ap->a_uio->uio_resid);
-    code=afs_write((struct vcache *)ap->a_vp, ap->a_uio, ap->a_ioflag, ap->a_cred, 0);
+    code=afs_write(VTOAFS(ap->a_vp), ap->a_uio, ap->a_ioflag, ap->a_cred, 0);
     afs_BozonUnlock(&avc->pvnLock, avc);
     AFS_GUNLOCK();
     return code;
@@ -520,7 +520,7 @@ afs_vop_pageout(ap)
     int nocommit = flags & UPL_NOCOMMIT;
 
     int code;
-    struct vcache *tvc=(struct vcache *)vp;
+    struct vcache *tvc=VTOAFS(vp);
 
     if (UBCINVALID(vp)) {
 #if DIAGNOSTIC
@@ -647,7 +647,7 @@ afs_vop_ioctl(ap)
                struct proc *a_p;
        } */ *ap;
 {
-    struct vcache *tvc = (struct vcache *)ap->a_vp;
+    struct vcache *tvc = VTOAFS(ap->a_vp);
     struct afs_ioctl data;
     int error = 0;
   
@@ -717,9 +717,9 @@ afs_vop_fsync(ap)
     AFS_GLOCK();
     /*vflushbuf(vp, wait);*/
     if (ap->a_cred)
-      error=afs_fsync((struct vcache *)vp, ap->a_cred);
+      error=afs_fsync(VTOAFS(vp), ap->a_cred);
     else
-      error=afs_fsync((struct vcache *)vp, &afs_osi_cred);
+      error=afs_fsync(VTOAFS(vp), &afs_osi_cred);
     AFS_GUNLOCK();
     return error;
 }
@@ -752,7 +752,7 @@ afs_vop_remove(ap)
 
     GETNAME();
     AFS_GLOCK();
-    error =  afs_remove((struct vcache *)dvp, name, cnp->cn_cred);
+    error =  afs_remove(VTOAFS(dvp), name, cnp->cn_cred);
     AFS_GUNLOCK();
     cache_purge(vp);
     if (!error && UBCINFOEXISTS(vp)) {
@@ -809,7 +809,7 @@ afs_vop_link(ap)
        goto out;
     }
     AFS_GLOCK();
-    error = afs_link((struct vcache *)vp, (struct vcache *)dvp, name, cnp->cn_cred);
+    error = afs_link(VTOAFS(vp), VTOAFS(dvp), name, cnp->cn_cred);
     AFS_GUNLOCK();
     FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
     if (dvp != vp)
@@ -901,7 +901,7 @@ abortit:
 
     AFS_GLOCK();
     /* XXX use "from" or "to" creds? NFS uses "to" creds */
-    error = afs_rename((struct vcache *)fdvp, fname, (struct vcache *)tdvp, tname, tcnp->cn_cred);
+    error = afs_rename(VTOAFS(fdvp), fname, VTOAFS(tdvp), tname, tcnp->cn_cred);
     AFS_GUNLOCK();
 
     VOP_UNLOCK(fvp, 0, p);
@@ -942,7 +942,7 @@ afs_vop_mkdir(ap)
        panic("afs_vop_mkdir: no name");
 #endif
     AFS_GLOCK();
-    error = afs_mkdir((struct vcache *)dvp, name, vap, &vcp, cnp->cn_cred);
+    error = afs_mkdir(VTOAFS(dvp), name, vap, &vcp, cnp->cn_cred);
     AFS_GUNLOCK();
     if (error) {
        VOP_ABORTOP(dvp, cnp);
@@ -951,8 +951,8 @@ afs_vop_mkdir(ap)
        return(error);
     }
     if (vcp) {
-       *ap->a_vpp = (struct vnode *)vcp;
-       vn_lock((struct vnode *)vcp, LK_EXCLUSIVE|LK_RETRY, p);
+       *ap->a_vpp = AFSTOV(vcp);
+       vn_lock(*ap->a_vpp, LK_EXCLUSIVE|LK_RETRY, p);
     } else
        *ap->a_vpp = 0;
     DROPNAME();
@@ -983,7 +983,7 @@ afs_vop_rmdir(ap)
     }
 
     AFS_GLOCK();
-    error = afs_rmdir((struct vcache *)dvp, name, cnp->cn_cred);
+    error = afs_rmdir(VTOAFS(dvp), name, cnp->cn_cred);
     AFS_GUNLOCK();
     DROPNAME();
     vput(dvp);
@@ -1007,7 +1007,7 @@ afs_vop_symlink(ap)
 
     GETNAME();
     AFS_GLOCK();
-    error = afs_symlink((struct vcache *)dvp, name, ap->a_vap, ap->a_target,
+    error = afs_symlink(VTOAFS(dvp), name, ap->a_vap, ap->a_target,
                        cnp->cn_cred);
     AFS_GUNLOCK();
     DROPNAME();
@@ -1033,7 +1033,7 @@ afs_vop_readdir(ap)
           ap->a_ncookies); */
     off=ap->a_uio->uio_offset;
     AFS_GLOCK();
-    error= afs_readdir((struct vcache *)ap->a_vp, ap->a_uio, ap->a_cred,
+    error= afs_readdir(VTOAFS(ap->a_vp), ap->a_uio, ap->a_cred,
                       ap->a_eofflag);
     AFS_GUNLOCK();
     if (!error && ap->a_ncookies != NULL) {
@@ -1079,7 +1079,7 @@ afs_vop_readlink(ap)
     int error;
 /*    printf("readlink %x\n", ap->a_vp);*/
     AFS_GLOCK();
-    error= afs_readlink((struct vcache *)ap->a_vp, ap->a_uio, ap->a_cred);
+    error= afs_readlink(VTOAFS(ap->a_vp), ap->a_uio, ap->a_cred);
     AFS_GUNLOCK();
     return error;
 }
@@ -1099,7 +1099,7 @@ afs_vop_inactive(ap)
        vprint("afs_vop_inactive(): pushing active", vp);
 
     AFS_GLOCK();
-    afs_InactiveVCache((struct vcache *)vp, 0);   /* decrs ref counts */
+    afs_InactiveVCache(VTOAFS(vp), 0);   /* decrs ref counts */
     AFS_GUNLOCK();
     VOP_UNLOCK(vp, 0, ap->a_p);
     return 0;
@@ -1119,7 +1119,7 @@ afs_vop_reclaim(ap)
 
 #if 0 
     AFS_GLOCK();
-    error = afs_FlushVCache((struct vcache *)vp, &sl); /* tosses our stuff from vnode */
+    error = afs_FlushVCache(VTOAFS(vp), &sl); /* tosses our stuff from vnode */
     AFS_GUNLOCK();
     ubc_unlink(vp);
     if (!error && vp->v_data)
@@ -1144,7 +1144,7 @@ afs_vop_lock(ap)
        } */ *ap;
 {
        register struct vnode *vp = ap->a_vp;
-       register struct vcache *avc = (struct vcache *)vp;
+       register struct vcache *avc = VTOAFS(vp);
 
        if (vp->v_tag == VT_NON)
                return (ENOENT);
@@ -1159,7 +1159,7 @@ afs_vop_unlock(ap)
        } */ *ap;
 {
     struct vnode *vp = ap->a_vp;
-    struct vcache *avc = (struct vcache *)vp;
+    struct vcache *avc = VTOAFS(vp);
     return (lockmgr(&avc->rwlock, ap->a_flags | LK_RELEASE,
             &vp->v_interlock, ap->a_p));
 
@@ -1212,7 +1212,7 @@ afs_vop_print(ap)
        } */ *ap;
 {
     register struct vnode *vp = ap->a_vp;
-    register struct vcache *vc = (struct vcache *)ap->a_vp;
+    register struct vcache *vc = VTOAFS(ap->a_vp);
     int s = vc->states;
     char buf[20];
     printf("tag %d, fid: %ld.%x.%x.%x, opens %d, writers %d", vp->v_tag, vc->fid.Cell,
@@ -1239,7 +1239,7 @@ afs_vop_islocked(ap)
                struct vnode *a_vp;
        } */ *ap;
 {
-    struct vcache *vc = (struct vcache *)ap->a_vp;
+    struct vcache *vc = VTOAFS(ap->a_vp);
     return lockstatus(&vc->rwlock);
 }
 
@@ -1299,7 +1299,7 @@ afs_vop_advlock(ap)
     cr=*p->p_cred->pc_ucred;
     pcred_unlock(p);
     AFS_GLOCK();
-    error= afs_lockctl((struct vcache *)ap->a_vp, ap->a_fl, ap->a_op, &cr,
+    error= afs_lockctl(VTOAFS(ap->a_vp), ap->a_fl, ap->a_op, &cr,
                       (int) ap->a_id);
     AFS_GUNLOCK();
     return error;
index 4f76be22f5e22bdaebde4b07e4b9d9b729ba7a45..78b2630d066a9dff88dc1cfe8b437f2ea1d93ec8 100644 (file)
@@ -39,7 +39,7 @@ extern struct timeval time;
 #define afs_bufferpages bufpages
 
 #define osi_vnhold(avc,r)  do { \
-       if ((avc)->vrefCount) { VN_HOLD((struct vnode *)(avc)); } \
+       if ((avc)->vrefCount) { VN_HOLD(AFSTOV(avc)); } \
        else osi_Panic("refcnt==0");  } while(0)
 
 #define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
index 4cc1497fc0a0f9bb084cf3afd39ccc1211cf85d5..d076c2434db11147f0585a582bcbca7e6ea5382e 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vfsops.c,v 1.1.1.6 2001/09/11 14:24:57 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vfsops.c,v 1.1.1.7 2002/05/10 23:43:40 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -148,15 +148,16 @@ int mp_afs_root (struct mount *afsp, struct vnode **avpp)
        }
     }
     if (tvp) {
+       struct vnode *vp = AFSTOV(tvp);
        AFS_GUNLOCK();
-       VN_HOLD((struct vnode *)tvp);
-       VN_LOCK((struct vnode *)tvp);
-       tvp->v.v_flag |= VROOT;     /* No-op on Ultrix 2.2 */
-       VN_UNLOCK((struct vnode *)tvp);
+       VN_HOLD(vp);
+       VN_LOCK(vp);
+       vp->v_flag |= VROOT;        /* No-op on Ultrix 2.2 */
+       VN_UNLOCK(vp);
        AFS_GLOCK();
 
        afs_globalVFS = afsp;
-       *avpp = (struct vnode *) tvp;
+       *avpp = vp;
     }
 
     afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
@@ -273,7 +274,7 @@ int mp_afs_vptofh(struct vnode *avn, struct fid *fidp)
     long addr[2];
     register struct cell *tcell;
     int rootvp = 0;
-    struct vcache *avc = (struct vcache *)avn;
+    struct vcache *avc = VTOAFS(avn);
 
     AFS_GLOCK();
     AFS_STATCNT(afs_fid);
@@ -299,7 +300,7 @@ int mp_afs_vptofh(struct vnode *avn, struct fid *fidp)
        fidp->fid_reserved = AFS_XLATOR_MAGIC;
        addr[0] = (long)avc;
        AFS_GUNLOCK();
-       VN_HOLD((struct vnode *)avc);
+       VN_HOLD(AFSTOV(avc));
        AFS_GLOCK();
     }
 
index 0c5336200db0b8a870e6c39e41f441c0c4a044c0..4a635cac6dbc8802c98401526f35388fa228bcbb 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vm.c,v 1.1.1.4 2001/07/14 22:19:38 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vm.c,v 1.1.1.5 2002/05/10 23:43:40 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -50,7 +50,7 @@ osi_VM_FlushVCache(avc, slept)
        return EBUSY;
 
     AFS_GUNLOCK();
-    ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+    ubc_invalidate(AFSTOV(avc)->v_object, 0, 0, B_INVAL);
     AFS_GLOCK();
 
     return 0;
@@ -132,7 +132,7 @@ osi_VM_StoreAllSegments(avc)
 {
     ReleaseWriteLock(&avc->lock);
     AFS_GUNLOCK();
-    osi_ubc_flush_dirty_and_wait((struct vnode *)avc, 0);
+    osi_ubc_flush_dirty_and_wait(AFSTOV(avc), 0);
     AFS_GLOCK();
     ObtainWriteLock(&avc->lock,94);
 }
@@ -154,8 +154,8 @@ osi_VM_TryToSmush(avc, acred, sync)
 {
     ReleaseWriteLock(&avc->lock);
     AFS_GUNLOCK();
-    osi_ubc_flush_dirty_and_wait((struct vnode *)avc, 0);
-    ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+    osi_ubc_flush_dirty_and_wait(AFSTOV(avc), 0);
+    ubc_invalidate(AFSTOV(avc)->v_object, 0, 0, B_INVAL);
     AFS_GLOCK();
     ObtainWriteLock(&avc->lock,59);
 }
@@ -169,8 +169,8 @@ osi_VM_FlushPages(avc, credp)
     struct vcache *avc;
     struct AFS_UCRED *credp;
 {
-    ubc_flush_dirty(((struct vnode *)avc)->v_object, 0);
-    ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+    ubc_flush_dirty(AFSTOV(avc)->v_object, 0);
+    ubc_invalidate(AFSTOV(avc)->v_object, 0, 0, B_INVAL);
 }
 
 /* Purge pages beyond end-of-file, when truncating a file.
@@ -185,6 +185,6 @@ osi_VM_Truncate(avc, alen, acred)
     int alen;
     struct AFS_UCRED *acred;
 {
-    ubc_invalidate(((struct vnode *)avc)->v_object, alen,
+    ubc_invalidate(AFSTOV(avc)->v_object, alen,
                         MAXINT - alen, B_INVAL);
 }
index 962fdaa8d184d56d126487d50948efaa313c0e83..cc14fe5dfa4a9f025a9a218e547f26793b716815 100644 (file)
@@ -14,7 +14,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vnodeops.c,v 1.1.1.5 2001/07/14 22:19:37 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vnodeops.c,v 1.1.1.6 2002/05/10 23:43:41 hartmans Exp $");
 
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
@@ -516,10 +516,10 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred)
        ReleaseWriteLock(&avc->lock);
        AFS_GUNLOCK();
 #ifdef AFS_DUX50_ENV
-       code = ubc_lookup(((struct vnode *)avc)->v_object, pageBase,
+       code = ubc_lookup(AFSTOV(avc)->v_object, pageBase,
                          PAGE_SIZE, PAGE_SIZE, &page, &flags, NULL);
 #else
-       code = ubc_lookup(((struct vnode *)avc)->v_object, pageBase,
+       code = ubc_lookup(AFSTOV(avc)->v_object, pageBase,
                          PAGE_SIZE, PAGE_SIZE, &page, &flags);
 #endif
        AFS_GLOCK();
@@ -538,7 +538,7 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred)
             */
            if ((uio->uio_rw == UIO_WRITE) &&
                ((pageOffset == 0 && (size == PAGE_SIZE || fileBase >= avc->m.Length)))) {
-               struct vnode *vp = (struct vnode *)avc;
+               struct vnode *vp = AFSTOV(avc);
                /* we're doing a write operation past eof; no need to read it */
                newpage = 1;
                AFS_GUNLOCK();
@@ -553,7 +553,7 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred)
                bp = ubc_bufalloc(page, 1, PAGE_SIZE, 1, B_READ);
                AFS_GLOCK();
                bp->b_dev = 0;
-               bp->b_vp = (struct vnode *)avc;
+               bp->b_vp = AFSTOV(avc);
                bp->b_blkno = btodb(pageBase);
                ReleaseWriteLock(&avc->lock);
                code = afs_ustrategy(bp, cred); /* do the I/O */
@@ -595,12 +595,12 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred)
                    /* We released the page, so we can get a null page
                     * list if another thread calls the strategy routine.
                     */
-                   pl = ubc_dirty_kluster(((struct vnode *)avc)->v_object, 
+                   pl = ubc_dirty_kluster(AFSTOV(avc)->v_object, 
                           NULL, toffset, 0, B_WANTED, FALSE, &kpcnt);
                    if (pl) {
                        bp = ubc_bufalloc(pl, 1, PAGE_SIZE, 1, B_WRITE);
                        bp->b_dev = 0;
-                       bp->b_vp = (struct vnode *)avc;
+                       bp->b_vp = AFSTOV(avc);
                        bp->b_blkno = btodb(pageBase);
                        AFS_GLOCK();
                        code = afs_ustrategy(bp, cred); /* do the I/O */
@@ -642,7 +642,7 @@ mp_afs_ubcrdwr(avc, uio, ioflag, cred)
     afs_BozonUnlock(&avc->pvnLock, avc);
     if (DO_FLUSH || (!newpage && (cnt < 10))) {
        AFS_GUNLOCK();
-       ubc_flush_dirty(((struct vnode *)avc)->v_object, flags); 
+       ubc_flush_dirty(AFSTOV(avc)->v_object, flags); 
        AFS_GLOCK();
     }
 
@@ -702,7 +702,7 @@ mp_afs_mmap(avc, offset, map, addrp, len, prot, maxprot, flags, cred)
 {
     struct vp_mmap_args args;
     register struct vp_mmap_args *ap = &args;
-    struct vnode *vp = (struct vnode *)avc;
+    struct vnode *vp = AFSTOV(avc);
     int code;
     struct vrequest treq;
 #if    !defined(DYNEL)
@@ -767,7 +767,7 @@ int mp_afs_getpage(vop, offset, len, protp, pl, plsz,
     vm_page_t *pagep;
     vm_offset_t off;
 
-   struct vcache *avc =  (struct vcache *)vop->vu_vp;
+   struct vcache *avc =  VTOAFS(vop->vu_vp);
 
     /* first, obtain the proper lock for the VM system */
 
@@ -799,10 +799,10 @@ int mp_afs_getpage(vop, offset, len, protp, pl, plsz,
        ReleaseWriteLock(&avc->lock);
        AFS_GUNLOCK();
 #ifdef AFS_DUX50_ENV
-       code = ubc_lookup(((struct vnode *)avc)->v_object, off,
+       code = ubc_lookup(AFSTOV(avc)->v_object, off,
                        PAGE_SIZE, PAGE_SIZE, pagep, &flags, NULL);
 #else
-       code = ubc_lookup(((struct vnode *)avc)->v_object, off,
+       code = ubc_lookup(AFSTOV(avc)->v_object, off,
                        PAGE_SIZE, PAGE_SIZE, pagep, &flags);
 #endif
        AFS_GLOCK();
@@ -812,7 +812,7 @@ int mp_afs_getpage(vop, offset, len, protp, pl, plsz,
        }
        if(flags & B_NOCACHE) {         /* if (page) */
            if ((rw & B_WRITE) && (offset+len >= avc->m.Length)) {
-               struct vnode *vp = (struct vnode *)avc;
+               struct vnode *vp = AFSTOV(avc);
                /* we're doing a write operation past eof; no need to read it */
                AFS_GUNLOCK();
                ubc_page_zero(*pagep, 0, PAGE_SIZE);
@@ -826,7 +826,7 @@ int mp_afs_getpage(vop, offset, len, protp, pl, plsz,
                bp = ubc_bufalloc(*pagep, 1, PAGE_SIZE, 1, B_READ);
                AFS_GLOCK();
                bp->b_dev = 0;
-               bp->b_vp = (struct vnode *)avc;
+               bp->b_vp = AFSTOV(avc);
                bp->b_blkno = btodb(off);
                ReleaseWriteLock(&avc->lock);
                code = afs_ustrategy(bp, cred); /* do the I/O */
@@ -876,8 +876,8 @@ int mp_afs_putpage(vop, pl, pcnt, flags, cred)
     struct ucred *cred;
 {
     register afs_int32 code=0;
-    struct vcache *avc = (struct vcache *)vop->vu_vp;
-    struct vnode *vp = (struct vnode *)avc;
+    struct vnode *vp = vop->vu_vp;
+    struct vcache *avc = VTOAFS(vp);
     int i;
 
     AFS_GLOCK();
@@ -912,7 +912,7 @@ int mp_afs_putpage(vop, pl, pcnt, flags, cred)
        bp = ubc_bufalloc(page, 1, PAGE_SIZE, 1, B_WRITE);
        AFS_GLOCK();
        bp->b_dev = 0;
-       bp->b_vp = (struct vnode *)avc;
+       bp->b_vp = AFSTOV(avc);
        bp->b_blkno = btodb(page->pg_offset);
        ReleaseWriteLock(&avc->lock);
        code = afs_ustrategy(bp, cred); /* do the I/O */
@@ -996,7 +996,7 @@ mp_afs_bread(vp, lbn, bpp, cred)
        uio.afsio_offset = offset;
        uio.afsio_resid = fsbsize;
        *bpp = 0;
-       error = afs_read((struct vcache *)vp, &uio, cred, lbn, bpp, 0);
+       error = afs_read(VTOAFS(vp), &uio, cred, lbn, bpp, 0);
        if (error) {
                afs_bread_freebp = bp;
                AFS_GUNLOCK();
index 0684307dc5b50d0198d48a7ea0976097cb71a9d5..09563a03b66a2881f88f96e861a7ecc37dbf9ae7 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_vfsops.c,v 1.1.1.4 2001/09/11 14:24:58 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_vfsops.c,v 1.1.1.5 2002/05/10 23:43:46 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -150,13 +150,13 @@ int mp_afs_root (struct mount *afsp, struct vnode **avpp)
     if (tvp) {
        AFS_GUNLOCK();
        VN_HOLD((struct vnode *)tvp);
-       VN_LOCK((struct vnode *)tvp);
+       VN_LOCK(AFSTOV(tvp));
        tvp->v.v_flag |= VROOT;     /* No-op on Ultrix 2.2 */
        VN_UNLOCK((struct vnode *)tvp);
        AFS_GLOCK();
 
        afs_globalVFS = afsp;
-       *avpp = (struct vnode *) tvp;
+       *avpp = AFSTOV(tvp);
     }
 
     afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
index ebd5f82e6067d32c659b6ccf92ff3079663d959e..76402da1ca97bbddfaa256209d84434aa7a1cc48 100644 (file)
@@ -21,7 +21,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_vm.c,v 1.1.1.3 2001/07/14 22:20:05 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_vm.c,v 1.1.1.4 2002/05/10 23:43:47 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -173,8 +173,8 @@ osi_VM_TryToSmush(avc, acred, sync)
 #ifdef SECRETLY_OSF1
     ReleaseWriteLock(&avc->lock);
     AFS_GUNLOCK();
-    osi_ubc_flush_dirty_and_wait((struct vnode *)avc, 0);
-    ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+    osi_ubc_flush_dirty_and_wait(AFSTOV(avc), 0);
+    ubc_invalidate((AFSTOV(avc))->v_object, 0, 0, B_INVAL);
     AFS_GLOCK();
     ObtainWriteLock(&avc->lock,59);
 #endif /* SECRETLY_OSF1 */
@@ -190,8 +190,8 @@ osi_VM_FlushPages(avc, credp)
     struct AFS_UCRED *credp;
 {
 #ifdef SECRETLY_OSF1
-    ubc_flush_dirty(((struct vnode *)avc)->v_object, 0);
-    ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+    ubc_flush_dirty((AFSTOV(avc))->v_object, 0);
+    ubc_invalidate((AFSTOV(avc))->v_object, 0, 0, B_INVAL);
 #endif /* SECRETLY_OSF1 */
 }
 
@@ -208,7 +208,7 @@ osi_VM_Truncate(avc, alen, acred)
     struct AFS_UCRED *acred;
 {
 #ifdef SECRETLY_OSF1
-    ubc_invalidate(((struct vnode *)avc)->v_object, alen,
+    ubc_invalidate((AFSTOV(avc))->v_object, alen,
                         MAXINT - alen, B_INVAL);
 #endif /* SECRETLY_OSF1 */
 }
index 46a97a29a26937ba4edd4f19b29eb03e6e75f222..edc948d309eed05887dd5245fd8ccaec2d06005d 100644 (file)
@@ -32,7 +32,7 @@ extern struct timeval time;
 #define        AFS_UCRED       ucred
 #define        AFS_PROC        proc_t
 
-#define osi_vnhold(avc, r)  do { VN_HOLD((struct vnode *)(avc)); } while(0)
+#define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,aresid) \
   vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(aresid),0)
 
index 94d3366a88fc1224cd8a979db66a969fc0644d87..74504338a67a3e11dc74fd1601717325462b440f 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vfsops.c,v 1.1.1.4 2001/07/14 22:19:41 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vfsops.c,v 1.1.1.5 2002/05/10 23:43:50 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -90,11 +90,11 @@ int afs_root (struct vfs *afsp, struct vnode **avpp, char *unused1)
        }
     }
     if (tvp) {
-       VN_HOLD((struct vnode *)tvp);
-       SET_V_FLAG( ((struct vnode *)tvp), VROOT);
+       VN_HOLD(AFSTOV(tvp));
+       SET_V_FLAG(AFSTOV(tvp), VROOT);
 
        afs_globalVFS = afsp;
-       *avpp = (struct vnode *) tvp;
+       *avpp = AFSTOV(tvp);
     }
 
     afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
index cfefca8f70dc3cc38844d66323bc303ec6c36167..16d247c3699378d43b3e36180c216c9360b2b86d 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vm.c,v 1.1.1.4 2001/07/14 22:19:41 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vm.c,v 1.1.1.5 2002/05/10 23:43:52 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -68,7 +68,7 @@ osi_VM_TryToSmush(avc, acred, sync)
     struct AFS_UCRED *acred;
     int sync;
 {
-    struct vnode *vp = (struct vnode *)avc;
+    struct vnode *vp = AFSTOV(avc);
 
     /* Flush the delayed write blocks associated with this vnode
      * from the buffer cache
index cb2998a258f888c6af8142e6ee97683c8568b6a6..501693ed6d6c3f7ed95ae05ea6104250f761990d 100644 (file)
@@ -12,7 +12,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vnodeops.c,v 1.1.1.5 2001/09/11 14:25:01 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vnodeops.c,v 1.1.1.6 2002/05/10 23:43:53 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -222,7 +222,7 @@ afs_bread(vp, lbn, bpp)
        uio.uio_fpflags = 0;
        *bpp = 0;
 
-       error = afs_read((struct vcache *)vp, &uio, p_cred(u.u_procp),
+       error = afs_read(VTOAFS(vp), &uio, p_cred(u.u_procp),
                         lbn, bpp, 0);
        if (error) {
                afs_bread_freebp = bp;
@@ -270,7 +270,7 @@ afs_inactive(avc, acred)
     register struct vcache *avc;
     struct AFS_UCRED *acred;
 {
-    struct vnode *vp = (struct vnode *)avc;
+    struct vnode *vp = AFSTOV(avc);
     ulong_t context;
     lock_t *sv_lock;
     if (afs_shuttingdown) return ;
@@ -1982,7 +1982,7 @@ afs_ioctl(vp, com, data, flag, cred)
           afsioctl.out      = ai->out;
           afsioctl.in_size  = ai->in_size;
           afsioctl.out_size = ai->out_size;
-          error = HandleIoctl((struct vcache *)vp, com, &afsioctl);
+          error = HandleIoctl(VTOAFS(vp), com, &afsioctl);
           return(error);
        }
        return(ENOTTY);
@@ -2479,7 +2479,7 @@ afs_hp_strategy(bp)
               we can't read, and finally call iodone(bp).  File is
               in bp->b_vp. Credentials are from u area??
             */
-          code = afs_rdwr((struct vcache *)bp->b_vp,&tuio,UIO_READ,0,kt_cred(t));
+          code = afs_rdwr(VTOAFS(bp->b_vp),&tuio,UIO_READ,0,kt_cred(t));
           if (code == 0) 
              if (tuio.afsio_resid > 0) 
              {
@@ -2489,7 +2489,7 @@ afs_hp_strategy(bp)
 
              }
        } else 
-          code = afs_rdwr((struct vcache *)bp->b_vp,&tuio,UIO_WRITE,0,kt_cred(t));
+          code = afs_rdwr(VTOAFS(bp->b_vp),&tuio,UIO_WRITE,0,kt_cred(t));
 
     /* Remap back to the user's space */
     hdl_remap_bp(bp);
index 2966e906e044005215202314a4a70e4f0485235c..241f92515b8f5e88e4679cda674a3693139132b8 100644 (file)
@@ -28,7 +28,7 @@ extern time_t time;
 
 #define        AFS_UCRED       ucred
 
-#define osi_vnhold(avc, r)  do { VN_HOLD((struct vnode *)(avc)); } while(0)
+#define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
 
 #undef afs_osi_Alloc_NoSleep
 extern void *afs_osi_Alloc_NoSleep(size_t size);
@@ -379,7 +379,7 @@ extern long afs_global_owner;
 #undef OSI_VC_DECL
 #define OSI_VC_DECL(V)  bhv_desc_t *bhv_##V
 #undef OSI_VC_CONVERT
-#define OSI_VC_CONVERT(V) struct vcache * V = (struct vcache*)BHV_TO_VNODE(bhv_##V);
+#define OSI_VC_CONVERT(V) struct vcache * V = VTOAFS(BHV_TO_VNODE(bhv_##V));
 #undef OSI_VFS_ARG
 #define OSI_VFS_ARG(V) bhv_##V
 #undef OSI_VFS_DECL
index 66e75cd15daac57a749d7d56588a72e3f5bac046..0fec7f045ed85db668b6f5fa50004a36bf2dcaf9 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vfsops.c,v 1.1.1.5 2002/01/22 19:48:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vfsops.c,v 1.1.1.6 2002/05/10 23:43:59 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -242,7 +242,7 @@ cred_t *cr;
      * rootvp gets lots of ref counts
      */
     if (rootvp) {
-       tvc = (struct vcache *)rootvp;
+       tvc = VTOAFS(rootvp);
         if (tvc->opens || CheckLock(&tvc->lock) || LockWaiters(&tvc->lock)) {
            ReleaseWriteLock(&afs_xvcache);
            return EBUSY;
@@ -290,13 +290,13 @@ afs_root (OSI_VFS_ARG(afsp), avpp)
     }
     if (tvp) {
        int s;
-       VN_HOLD((struct vnode *)tvp);
-       s = VN_LOCK((struct vnode *)tvp);
-       tvp->v.v_flag |= VROOT; 
-       VN_UNLOCK((struct vnode *)tvp, s);
+       VN_HOLD(AFSTOV(tvp));
+       s = VN_LOCK(AFSTOV(tvp));
+       AFSTOV(tvp)->v_flag |= VROOT;   
+       VN_UNLOCK(AFSTOV(tvp), s);
 
        afs_globalVFS = afsp;
-       *avpp = (struct vnode *) tvp;
+       *avpp = AFSTOV(tvp);
     }
 
     afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
index ab40040aed3d681bff53a4a0c876d59b4eb6f7d9..cf447678c7a5deab04a75cd7953e63eb758f4900 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vm.c,v 1.1.1.4 2001/07/14 22:19:44 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vm.c,v 1.1.1.5 2002/05/10 23:44:01 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -156,7 +156,7 @@ osi_VM_TryToSmush(avc, acred, sync)
     osi_Assert(OSI_GET_LOCKID() != avc->vc_rwlockid);
     if (((vnode_t *)avc)->v_type == VREG && AFS_VN_MAPPED(((vnode_t *)avc)))
         remapf(((vnode_t *)avc), 0, 0);
-    PTOSSVP((struct vnode *)avc, (off_t)0, (off_t)MAXLONG);
+    PTOSSVP(AFSTOV(avc), (off_t)0, (off_t)MAXLONG);
     AFS_GLOCK();
     ObtainWriteLock(&avc->lock,62);
 }
@@ -195,10 +195,10 @@ osi_VM_StoreAllSegments(avc)
 
     /* Write out dirty pages list to avoid B_DELWRI buffers. */
     while (VN_GET_DPAGES((vnode_t*)avc)) {
-       pdflush((struct vnode*)avc, 0);
+       pdflush(AFSTOV(avc), 0);
     }
 
-    PFLUSHVP((struct vnode *)avc, (off_t)avc->m.Length, (off_t)0, error);
+    PFLUSHVP(AFSTOV(avc), (off_t)avc->m.Length, (off_t)0, error);
     AFS_GLOCK();
     if (error) {
        /*
index 9e670fdb38a4a183d8e91a44b8fcf4ee2d84c805..cbbcdc4071bf7ddf932edb754c61990df79339ee 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vnodeops.c,v 1.1.1.8 2002/01/22 19:48:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vnodeops.c,v 1.1.1.9 2002/05/10 23:44:01 hartmans Exp $");
 
 #ifdef AFS_SGI62_ENV
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
@@ -349,7 +349,7 @@ static int afsrwvp(register struct vcache *avc,
                   struct cred *cr)
 #endif
 {
-    register struct vnode *vp = (struct vnode *)avc;
+    register struct vnode *vp = AFSTOV(avc);
     struct buf *bp;
     daddr_t bn;
     size_t acnt, cnt;
@@ -887,7 +887,7 @@ static int afs_addmap(OSI_VC_ARG(avc), off, prp, addr, len, prot, maxprot,
         struct cred *cr;
 {
     OSI_VC_CONVERT(avc)
-    struct vnode *vp = (struct vnode*)avc;
+    struct vnode *vp = AFSTOV(avc);
 
     if (vp->v_flag & VNOMAP)
        return ENOSYS;
@@ -919,7 +919,7 @@ static int afs_delmap(OSI_VC_ARG(avc), off, prp, addr, len, prot, maxprot,
         struct cred *acred;
 {
     OSI_VC_CONVERT(avc)
-    struct vnode *vp = (struct vnode*)avc;
+    struct vnode *vp = AFSTOV(avc);
     register struct brequest *tb;
     struct vrequest treq;
     afs_int32 code;
@@ -1013,7 +1013,7 @@ static int afs_map(OSI_VC_ARG(avc), off, prp, addrp, len, prot, maxprot,
 #endif
 {
     OSI_VC_CONVERT(avc)
-    struct vnode *vp = (struct vnode*)avc;
+    struct vnode *vp = AFSTOV(avc);
     struct vrequest treq;
     int error;
 
@@ -1209,7 +1209,7 @@ afs_reclaim(OSI_VC_DECL(avc), int flag)
 void afs_rwlock(OSI_VN_DECL(vp), AFS_RWLOCK_T flag)
 {
     OSI_VN_CONVERT(vp)
-    struct vcache *avc = (struct vcache *)vp;
+    struct vcache *avc = VTOAFS(vp);
 
     if (OSI_GET_LOCKID() == avc->vc_rwlockid) {
        avc->vc_locktrips++;
@@ -1224,7 +1224,7 @@ void afs_rwlock(OSI_VN_DECL(vp), AFS_RWLOCK_T flag)
 void afs_rwunlock(OSI_VN_DECL(vp), AFS_RWLOCK_T flag)
 {
     OSI_VN_CONVERT(vp)
-    struct vcache *avc = (struct vcache *)vp;
+    struct vcache *avc = VTOAFS(vp);
 
     AFS_ASSERT_GLOCK();
     osi_Assert(OSI_GET_LOCKID() == avc->vc_rwlockid);
@@ -1244,7 +1244,7 @@ void afs_rwunlock(OSI_VN_DECL(vp), AFS_RWLOCK_T flag)
  */
 int afs_rwlock_nowait(vnode_t *vp, AFS_RWLOCK_T flag)
 {
-    struct vcache *avc = (struct vcache *)vp;
+    struct vcache *avc = VTOAFS(vp);
 
     AFS_ASSERT_GLOCK();
     if (OSI_GET_LOCKID() == avc->vc_rwlockid) {
index ac2b23d71a71db3f86c68b83e33925121fbd4587..7e79a07f5c571db8193d78212d05116ac311b384 100644 (file)
@@ -14,7 +14,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_alloc.c,v 1.1.1.9 2002/01/22 19:48:11 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_alloc.c,v 1.1.1.10 2002/05/10 23:44:02 hartmans Exp $");
 
 #include "../afs/sysincludes.h"
 #include "../afs/afsincludes.h"
@@ -187,9 +187,15 @@ hash_verify(size_t index, unsigned key, void *data)
     int memtype;
 
     memtype = MEMTYPE(lmp->chunk);
+#ifdef AFS_SPARC64_LINUX24_ENV
+    if ((memtype == KM_TYPE) && (!VALID_PAGE(virt_to_page(lmp->chunk)))) {
+       printf("osi_linux_verify_alloced_memory: address 0x%x outside range, index=%d, key=%d\n", lmp->chunk, index, key);
+    }
+#else
     if ((memtype == KM_TYPE) && (AFS_LINUX_MAP_NR(lmp->chunk) > max_mapnr)) {
        printf("osi_linux_verify_alloced_memory: address 0x%x outside range, index=%d, key=%d\n", lmp->chunk, index, key);
     }
+#endif
     
     if (memtype != KM_TYPE && memtype != VM_TYPE) {
        printf("osi_linux_verify_alloced_memory: unknown type %d at 0x%x, index=%d\n",    memtype, lmp->chunk, index);
@@ -290,7 +296,9 @@ void *osi_linux_alloc(unsigned int asize)
        allocator_init = 1; /* initialization complete */
     }
 
+    up(&afs_linux_alloc_sem);
     new = linux_alloc(asize); /* get a chunk of memory of size asize */
+    down(&afs_linux_alloc_sem);
     if (!new) {
        printf("afs_osi_Alloc: Can't vmalloc %d bytes.\n", asize);
        goto error;
@@ -320,8 +328,11 @@ void *osi_linux_alloc(unsigned int asize)
     return MEMADDR(new);
 
   free_error:
-    if (new)
-        linux_free(new);
+    if (new) {
+       up(&afs_linux_alloc_sem);
+       linux_free(new);
+       down(&afs_linux_alloc_sem);
+    }
     new = NULL;
     goto error;
 
index b260406559dcf229469a39b15d77b07e75d066f2..a1f6eb856a16c02bf55fc530e9771a30c3664775 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_groups.c,v 1.1.1.8 2001/09/11 14:25:04 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_groups.c,v 1.1.1.9 2002/05/10 23:44:03 hartmans Exp $");
 
 #include "../afs/sysincludes.h"
 #include "../afs/afsincludes.h"
@@ -162,39 +162,68 @@ asmlinkage int afs_xsetgroups32(int gidsetsize, gid_t *grouplist)
     return code;
 }
 #endif
+
 #if defined(AFS_SPARC64_LINUX20_ENV)
+/* Intercept the uid16 system call as used by 32bit programs. */
+extern int (*sys32_setgroupsp)(int gidsetsize, __kernel_gid_t32 *grouplist);
 asmlinkage int afs32_xsetgroups(int gidsetsize, __kernel_gid_t32 *grouplist)
 {
-    gid_t gl[NGROUPS];
-    int ret, i;
-    mm_segment_t old_fs = get_fs ();
-
-    if ((unsigned) gidsetsize > NGROUPS)
-       return -EINVAL;
-    for (i = 0; i < gidsetsize; i++, grouplist++)
-       if (__get_user (gl[i], grouplist))
-           return -EFAULT;
-    set_fs (KERNEL_DS);
-    ret = afs_xsetgroups(gidsetsize, gl);
-    set_fs (old_fs);
-    return ret;
+    int code;
+    cred_t *cr = crref();
+    afs_uint32 junk;
+    int old_pag;
+
+    lock_kernel();
+    old_pag = PagInCred(cr);
+    crfree(cr);
+    unlock_kernel();
+
+    code = (*sys32_setgroupsp)(gidsetsize, grouplist);
+    if (code) {
+       return code;
+    }
+
+    lock_kernel();
+    cr = crref();
+    if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
+       /* re-install old pag if there's room. */
+       code = setpag(&cr, old_pag, &junk, 0);
+    }
+    crfree(cr);
+    unlock_kernel();
+
+    return code;
 }
 #ifdef AFS_LINUX24_ENV
+/* Intercept the uid32 system call as used by 32bit programs. */
+extern int (*sys32_setgroups32p)(int gidsetsize, __kernel_gid_t32 *grouplist);
 asmlinkage int afs32_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist)
 {
-    gid_t gl[NGROUPS];
-    int ret, i;
-    mm_segment_t old_fs = get_fs ();
-
-    if ((unsigned) gidsetsize > NGROUPS)
-       return -EINVAL;
-    for (i = 0; i < gidsetsize; i++, grouplist++)
-       if (__get_user (gl[i], grouplist))
-           return -EFAULT;
-    set_fs (KERNEL_DS);
-    ret = afs_xsetgroups32(gidsetsize, gl);
-    set_fs (old_fs);
-    return ret;
+    int code;
+    cred_t *cr = crref();
+    afs_uint32 junk;
+    int old_pag;
+
+    lock_kernel();
+    old_pag = PagInCred(cr);
+    crfree(cr);
+    unlock_kernel();
+
+    code = (*sys32_setgroups32p)(gidsetsize, grouplist);
+    if (code) {
+       return code;
+    }
+
+    lock_kernel();
+    cr = crref();
+    if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
+       /* re-install old pag if there's room. */
+       code = setpag(&cr, old_pag, &junk, 0);
+    }
+    crfree(cr);
+    unlock_kernel();
+
+    return code;
 }
 #endif
 #endif
index 6363d37ca89d7c6f17e59d856ba4290cf2e7d96d..69dda6464e46c2ac01341e4fd96821d6adc5c989 100644 (file)
@@ -15,7 +15,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vfsops.c,v 1.1.1.11 2002/01/30 14:01:28 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vfsops.c,v 1.1.1.12 2002/05/10 23:44:09 hartmans Exp $");
 
 #include "../afs/sysincludes.h"
 #include "../afs/afsincludes.h"
@@ -134,17 +134,17 @@ static int afs_root(struct super_block *afsp)
 #endif
                
                /* "/afs" is a directory, reset inode ops accordingly. */
-               tvp->v.v_op = &afs_dir_iops;
+               AFSTOV(tvp)->v_op = &afs_dir_iops;
 #if defined(AFS_LINUX24_ENV)
-               tvp->v.v_fop = &afs_dir_fops;
+               AFSTOV(tvp)->v_fop = &afs_dir_fops;
 #endif
 
                /* setup super_block and mount point inode. */
                afs_globalVp = tvp;
 #if defined(AFS_LINUX24_ENV)
-               afsp->s_root = d_alloc_root((struct inode*)&tvp->v);
+               afsp->s_root = d_alloc_root(AFSTOI(tvp));
 #else
-               afsp->s_root = d_alloc_root((struct inode*)tvp, NULL);
+               afsp->s_root = d_alloc_root(AFSTOI(tvp), NULL);
 #endif
                afsp->s_root->d_op = &afs_dentry_operations;
            } else
@@ -188,8 +188,8 @@ int afs_notify_change(struct dentry *dp, struct iattr* iattrp)
     VATTR_NULL(&vattr);
     iattr2vattr(&vattr, iattrp); /* Convert for AFS vnodeops call. */
     update_inode_cache(ip, &vattr);
-    code = afs_setattr((struct vcache*)ip, &vattr, credp);
-    afs_CopyOutAttrs((struct vcache*)ip, &vattr);
+    code = afs_setattr(ITOAFS(ip), &vattr, credp);
+    afs_CopyOutAttrs(ITOAFS(ip), &vattr);
     /* Note that the inode may still not have all the correct info. But at
      * least we've got the newest version of what was supposed to be set.
      */
@@ -242,7 +242,7 @@ void afs_write_inode(struct inode *ip)
 
 void afs_delete_inode(struct inode *ip)
 {
-    struct vcache *vc = (struct vcache*)ip;
+    struct vcache *vc = ITOAFS(ip);
 
     AFS_GLOCK();
     osi_clear_inode(ip);
index c3e9b22db50ab86e2384423c2f5927879ff6b9a3..fb859018b3e5e80ada3976c3951efc5b8158b326 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vm.c,v 1.1.1.8 2002/01/30 14:01:29 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vm.c,v 1.1.1.9 2002/05/10 23:44:09 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -41,7 +41,7 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vm.c,v 1.1.1.8 2002/01/30
  */
 int osi_VM_FlushVCache(struct vcache *avc, int *slept)
 {
-    struct inode *ip = (struct inode*)avc;
+    struct inode *ip = AFSTOI(avc);
 
     if (VREFCOUNT(avc) != 0)
        return EBUSY;
@@ -70,7 +70,7 @@ int osi_VM_FlushVCache(struct vcache *avc, int *slept)
  */
 void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync)
 {
-    invalidate_inode_pages((struct inode *)avc);
+    invalidate_inode_pages(AFSTOI(avc));
 }
 
 /* Flush and invalidate pages, for fsync() with INVAL flag
@@ -89,7 +89,7 @@ void osi_VM_FSyncInval(struct vcache *avc)
  */
 void osi_VM_StoreAllSegments(struct vcache *avc)
 {
-    struct inode *ip = (struct inode *) avc;
+    struct inode *ip = AFSTOI(avc);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,5)
     /* filemap_fdatasync() only exported in 2.4.5 and above */
@@ -109,15 +109,15 @@ void osi_VM_StoreAllSegments(struct vcache *avc)
 void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-    struct inode *ip = (struct inode*)avc;
+    struct inode *ip = AFSTOI(avc);
 
     truncate_inode_pages(&ip->i_data, 0);
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
-    struct inode *ip = (struct inode*)avc;
+    struct inode *ip = AFSTOI(avc);
 
     truncate_inode_pages(ip, 0);
 #else
-    invalidate_inode_pages((struct inode*)avc);
+    invalidate_inode_pages(AFSTOI(avc));
 #endif
 }
 
@@ -130,14 +130,14 @@ void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
 void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-    struct inode *ip = (struct inode*)avc;
+    struct inode *ip = AFSTOI(avc);
 
     truncate_inode_pages(&ip->i_data, alen);
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
-    struct inode *ip = (struct inode*)avc;
+    struct inode *ip = AFSTOI(avc);
 
     truncate_inode_pages(ip, alen);
 #else
-    invalidate_inode_pages((struct inode*)avc);
+    invalidate_inode_pages(AFSTOI(avc));
 #endif
 }
index 1bd77d661db2508777f7b97a075d08a9d862ffa0..0dff3c4e445f39d4c913ee519b89a49d4346156a 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_groups.c,v 1.1.1.4 2001/07/14 22:19:48 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_groups.c,v 1.1.1.5 2002/05/10 23:44:11 hartmans Exp $");
 
 #include "../afs/sysincludes.h"
 #include "../afs/afsincludes.h"
@@ -91,6 +91,8 @@ setpag(cred, pagvalue, newpag, change_parent)
     AFS_STATCNT(setpag);
 
     gidset = (gid_t *) osi_AllocSmallSpace(AFS_SMALLOCSIZ);
+
+    mutex_enter(&curproc->p_crlock);
     ngroups = afs_getgroups(*cred, gidset);
 
     if (afs_get_pag_from_groups(gidset[0], gidset[1]) == NOPAG) {
@@ -106,6 +108,7 @@ setpag(cred, pagvalue, newpag, change_parent)
     }
     *newpag = (pagvalue == -1 ? genpag(): pagvalue);
     afs_get_groups_from_pag(*newpag, &gidset[0], &gidset[1]);
+    /* afs_setgroups will release curproc->p_crlock */
     if (code = afs_setgroups(cred, ngroups, gidset, change_parent)) {
        osi_FreeSmallSpace((char *)gidset);
        return (code);
@@ -148,17 +151,18 @@ afs_setgroups(
 
     AFS_STATCNT(afs_setgroups);
 
-    if (ngroups > ngroups_max)
+    if (ngroups > ngroups_max) {
+       mutex_exit(&curproc->p_crlock);
        return EINVAL;
+    }
     if (!change_parent)
        *cred = (struct cred *)crcopy(*cred);
     (*cred)->cr_ngroups = ngroups;
     gp = (*cred)->cr_groups;
     while (ngroups--)
        *gp++ = *gidset++;
-    if (!change_parent) {
-       struct proc *proc = ttoproc(curthread);
-       crset(proc, *cred); /* broadcast to all threads */
-    }
+    mutex_exit(&curproc->p_crlock);
+    if (!change_parent)
+       crset(curproc, *cred); /* broadcast to all threads */
     return (0);
 }
index cd565120db7f4116ea8bd7f897c29c7c6cb9f8d8..98fd765a302777b19c3e7cb6fa14bde41555fa1e 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_inode.c,v 1.1.1.7 2001/07/14 22:19:50 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_inode.c,v 1.1.1.8 2002/05/10 23:44:12 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -106,7 +106,6 @@ igetinode(vfsp, dev, inode, ipp, credp,perror)
     
     if (ip->i_mode == 0) {
        /* Not an allocated inode */
-       AFS_ITIMES(ip);
        rw_exit(&ip->i_contents);
        VN_RELE(ITOV(ip));
        return (ENOENT);
index 934a1388faa0312add4c848b827730781dbcce4f..ef27ae5169e33d7357e3518ec2683983cb4ccf78 100644 (file)
@@ -44,7 +44,7 @@
 #undef afs_osi_Alloc_NoSleep
 extern void *afs_osi_Alloc_NoSleep(size_t size);
 
-#define osi_vnhold(avc, r)  do { VN_HOLD((struct vnode *)(avc)); } while(0)
+#define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
 #define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
   vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
 
index c370c8f1ce32e2583703bf6c88efbf4839fcc439..feb99490271bbaae6ea15a65970452b49c912da1 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vfsops.c,v 1.1.1.9 2001/10/14 17:59:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vfsops.c,v 1.1.1.10 2002/05/10 23:44:13 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -41,11 +41,14 @@ int afs_mount(struct vfs *afsp, struct vnode *amvp, struct mounta *uap,
 
     AFS_STATCNT(afs_mount);
 
-    if (!suser(credp))
+    if (!suser(credp)) {
+       AFS_GUNLOCK();
        return EPERM;
+    }
     afsp->vfs_fstype = afsfstype;
 
     if (afs_globalVFS) { /* Don't allow remounts. */
+       AFS_GUNLOCK();
        return EBUSY;
     }
 
@@ -68,8 +71,10 @@ int afs_unmount (struct vfs *afsp, struct AFS_UCRED *credp)
     AFS_GLOCK();
     AFS_STATCNT(afs_unmount);
 
-    if (!suser(credp))
+    if (!suser(credp)) {
+       AFS_GUNLOCK();
        return EPERM;
+    }
     afs_globalVFS = 0;
     afs_shutdown();
 
@@ -117,13 +122,13 @@ int afs_root (struct vfs *afsp, struct vnode **avpp)
        }
     }
     if (tvp) {
-       VN_HOLD((struct vnode *)tvp);
-       mutex_enter(&(((struct vnode*)tvp)->v_lock));
-       tvp->v.v_flag |= VROOT;
-       mutex_exit(&(((struct vnode*)tvp)->v_lock));
+       VN_HOLD(AFSTOV(tvp));
+       mutex_enter(&AFSTOV(tvp)->v_lock);
+       AFSTOV(tvp)->v_flag |= VROOT;
+       mutex_exit(&AFSTOV(tvp)->v_lock);
 
        afs_globalVFS = afsp;
-       *avpp = (struct vnode *) tvp;
+       *avpp = AFSTOV(tvp);
     }
 
     afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
@@ -241,6 +246,9 @@ void (*ufs_iupdatp)();
 int (*ufs_igetp)();
 void (*ufs_itimes_nolockp)();
 
+int (*afs_orig_ioctl)(), (*afs_orig_ioctl32)();
+int (*afs_orig_setgroups)(), (*afs_orig_setgroups32)();
+
 struct streamtab *udp_infop = 0;
 struct ill_s *ill_g_headp = 0;
 
@@ -259,15 +267,19 @@ extern Afs_syscall();
 
 afsinit(struct vfssw *vfsswp, int fstype)
 {
-    extern int afs_xioctl(), afs_xflock();
+    extern int afs_xioctl();
     extern int afs_xsetgroups();
 
     AFS_STATCNT(afsinit);
 
+    afs_orig_setgroups = sysent[SYS_setgroups].sy_callc;
+    afs_orig_ioctl = sysent[SYS_ioctl].sy_call;
     sysent[SYS_setgroups].sy_callc = afs_xsetgroups;
     sysent[SYS_ioctl].sy_call = afs_xioctl;
 
 #if defined(AFS_SUN57_64BIT_ENV)
+    afs_orig_setgroups32 = sysent32[SYS_setgroups].sy_callc;
+    afs_orig_ioctl32 = sysent32[SYS_ioctl].sy_call;
     sysent32[SYS_setgroups].sy_callc = afs_xsetgroups;
     sysent32[SYS_ioctl].sy_call = afs_xioctl;
 #endif
@@ -400,6 +412,9 @@ _init()
     extern struct bind *sb_hashtab[];
     struct modctl *mp = 0;
 
+    if (afs_sinited)
+       return EBUSY;
+
     if ((!(mp = mod_find_by_filename("fs", "ufs")) && 
        !(mp = mod_find_by_filename(NULL, "/kernel/fs/ufs")) &&
        !(mp = mod_find_by_filename(NULL, "sys/ufs"))) ||
@@ -481,8 +496,17 @@ _fini()
 {
     int code;
 
-    if (afs_sinited)
-       return (EBUSY);
+    if (afs_globalVFS)
+       return EBUSY;
+
+    if (afs_sinited) {
+       sysent[SYS_setgroups].sy_callc = afs_orig_setgroups;
+       sysent[SYS_ioctl].sy_call = afs_orig_ioctl;
+#if defined(AFS_SUN57_64BIT_ENV)
+       sysent32[SYS_setgroups].sy_callc = afs_orig_setgroups32;
+       sysent32[SYS_ioctl].sy_call = afs_orig_ioctl32;
+#endif
+    }
     code = mod_remove(&afs_modlinkage);
     return code;
 }
index c1a138f38fd9689fe497f9f2747b4bf6d3ec6196..4817ab43f6def6b48988c5e2da5f76512db0d24c 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vm.c,v 1.1.1.4 2001/07/14 22:19:50 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vm.c,v 1.1.1.5 2002/05/10 23:44:14 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -50,7 +50,7 @@ osi_VM_GetDownD(avc, adc)
     int code;
 
     AFS_GUNLOCK();
-    code = afs_putpage((struct vnode *)avc,
+    code = afs_putpage(AFSTOV(avc),
                       (offset_t) AFS_CHUNKTOBASE(adc->f.chunk),
                       AFS_CHUNKTOSIZE(adc->f.chunk),
                       B_INVAL, CRED());
@@ -91,11 +91,11 @@ osi_VM_FlushVCache(avc, slept)
        return EBUSY;
 
     AFS_GUNLOCK();
-    pvn_vplist_dirty((struct vnode *)avc, 0, NULL, B_TRUNC|B_INVAL, CRED());
+    pvn_vplist_dirty(AFSTOV(avc), 0, NULL, B_TRUNC|B_INVAL, CRED());
     AFS_GLOCK();
 
     /* Might as well make the obvious check */
-    if (((struct vnode *)avc)->v_pages)
+    if (AFSTOV(avc)->v_pages)
        return EBUSY;   /* should be all gone still */
 
     rw_destroy(&avc->rwlock);
@@ -119,10 +119,10 @@ osi_VM_StoreAllSegments(avc)
 {
     AFS_GUNLOCK();
 #if    defined(AFS_SUN56_ENV)
-    (void) pvn_vplist_dirty((struct vnode *)avc, (u_offset_t)0, afs_putapage,
+    (void) pvn_vplist_dirty(AFSTOV(avc), (u_offset_t)0, afs_putapage,
                            0, CRED());
 #else
-    (void) pvn_vplist_dirty((struct vnode *)avc, 0, afs_putapage, 0, CRED());
+    (void) pvn_vplist_dirty(AFSTOV(avc), 0, afs_putapage, 0, CRED());
 #endif
     AFS_GLOCK();
 }
@@ -141,10 +141,10 @@ osi_VM_TryToSmush(avc, acred, sync)
 {
     AFS_GUNLOCK();
 #if    defined(AFS_SUN56_ENV)
-    (void) pvn_vplist_dirty((struct vnode *)avc, (u_offset_t)0, afs_putapage,
+    (void) pvn_vplist_dirty(AFSTOV(avc), (u_offset_t)0, afs_putapage,
                            (sync ? B_INVAL : B_FREE), acred);
 #else
-    (void) pvn_vplist_dirty((struct vnode *)avc, 0, afs_putapage,
+    (void) pvn_vplist_dirty(AFSTOV(avc), 0, afs_putapage,
                            (sync ? B_INVAL : B_FREE), acred);
 #endif
     AFS_GLOCK();
@@ -162,7 +162,7 @@ osi_VM_FlushPages(avc, credp)
     extern int afs_pvn_vptrunc;
 
     afs_pvn_vptrunc++;
-    (void) afs_putpage((struct vnode *)avc, (offset_t)0, 0,
+    (void) afs_putpage(AFSTOV(avc), (offset_t)0, 0,
                        B_TRUNC|B_INVAL, credp);
 }
 
@@ -189,7 +189,7 @@ osi_VM_PreTruncate(avc, alen, acred)
 
     ReleaseWriteLock(&avc->lock);
     AFS_GUNLOCK();
-    pp = page_lookup((struct vnode *)avc, alen - pageOffset, SE_EXCL);
+    pp = page_lookup(AFSTOV(avc), alen - pageOffset, SE_EXCL);
     if (pp) {
        pagezero(pp, pageOffset, PAGESIZE - pageOffset);
        page_unlock(pp);
@@ -213,7 +213,7 @@ osi_VM_Truncate(avc, alen, acred)
      * It's OK to specify afs_putapage here, even though we aren't holding
      * the vcache entry lock, because it isn't going to get called.
      */
-    pvn_vplist_dirty((struct vnode *)avc, alen, afs_putapage, B_TRUNC|B_INVAL,
+    pvn_vplist_dirty(AFSTOV(avc), alen, afs_putapage, B_TRUNC|B_INVAL,
                     acred);
 }
 
index 74a2e151633cd80a2efb9b98146665a74355d0fc..0d07e4ea116744c51f1e3ccbaf8dbd0daede335d 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.1.1.8 2001/10/14 17:59:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.1.1.9 2002/05/10 23:44:14 hartmans Exp $");
 
 #if    defined(AFS_SUN_ENV) || defined(AFS_SUN5_ENV)
 /*
@@ -125,10 +125,10 @@ int afs_vmread(avp, auio, ioflag, acred)
 {
     register int code;
 
-    if (!RW_READ_HELD(&((struct vcache *)avp)->rwlock))
+    if (!RW_READ_HELD(&(VTOAFS(avp))->rwlock))
        osi_Panic("afs_vmread: !rwlock");
     AFS_GLOCK();
-    code = afs_nfsrdwr((struct vcache *)avp, auio, UIO_READ, ioflag, acred);
+    code = afs_nfsrdwr(VTOAFS(avp), auio, UIO_READ, ioflag, acred);
     AFS_GUNLOCK();
     return code;
 }
@@ -142,10 +142,10 @@ int afs_vmwrite(avp, auio, ioflag, acred)
 {
     register int code;
 
-    if (!RW_WRITE_HELD(&((struct vcache *)avp)->rwlock))
+    if (!RW_WRITE_HELD(&(VTOAFS(avp))->rwlock))
        osi_Panic("afs_vmwrite: !rwlock");
     AFS_GLOCK();
-    code = afs_nfsrdwr((struct vcache *)avp, auio, UIO_WRITE, ioflag, acred);
+    code = afs_nfsrdwr(VTOAFS(avp), auio, UIO_WRITE, ioflag, acred);
     AFS_GUNLOCK();
     return code;
 }
@@ -184,7 +184,7 @@ struct AFS_UCRED *acred;
 
 #if    defined(AFS_SUN56_ENV)
     if (len <= PAGESIZE)
-       code = afs_GetOnePage((struct vnode *) vp, toff, len, protp, pl, plsz,
+       code = afs_GetOnePage(vp, toff, len, protp, pl, plsz,
                              seg, addr, rw, acred);
 #else
 #ifdef AFS_SUN5_ENV
@@ -198,7 +198,7 @@ struct AFS_UCRED *acred;
 #endif
 #endif
     else {
-       struct vcache *vcp = (struct vcache *)vp;
+       struct vcache *vcp = VTOAFS(vp);
 #ifdef AFS_SUN5_ENV
        ObtainWriteLock(&vcp->vlock, 548);
        vcp->multiPage++;
@@ -206,10 +206,10 @@ struct AFS_UCRED *acred;
 #endif
        afs_BozonLock(&vcp->pvnLock, vcp);
 #if    defined(AFS_SUN56_ENV)
-       code = pvn_getpages(afs_GetOnePage, (struct vnode *) vp, toff, 
+       code = pvn_getpages(afs_GetOnePage, vp, toff, 
                            len, protp, pl, plsz, seg, addr, rw, acred);
 #else
-       code = pvn_getpages(afs_GetOnePage, (struct vnode *) vp, (u_int)off, 
+       code = pvn_getpages(afs_GetOnePage, vp, (u_int)off, 
                            len, protp, pl, plsz, seg, addr, rw, acred);
 #endif
        afs_BozonUnlock(&vcp->pvnLock, vcp);
@@ -272,7 +272,7 @@ struct AFS_UCRED *acred;
        acred = u.u_cred;               /* better than nothing */
 #endif
 
-    avc = (struct vcache *) vp;        /* cast to afs vnode */
+    avc = VTOAFS(vp);  /* cast to afs vnode */
 
 #ifdef AFS_SUN5_ENV
     if (avc->credp /*&& AFS_NFSXLATORREQ(acred)*/ && AFS_NFSXLATORREQ(avc->credp)) {
@@ -588,7 +588,7 @@ int afs_putpage(vp, off, len, flags, cred)
     afs_Trace4(afs_iclSetp, CM_TRACE_PAGEOUT, ICL_TYPE_POINTER, (afs_int32) vp,
               ICL_TYPE_LONG, (afs_int32) off, ICL_TYPE_LONG, (afs_int32) len,
               ICL_TYPE_LONG, (int) flags);
-    avc = (struct vcache *) vp;
+    avc = VTOAFS(vp);
     afs_BozonLock(&avc->pvnLock, avc);
     ObtainWriteLock(&avc->lock,247);
 
@@ -652,7 +652,7 @@ int afs_putapage(struct vnode *vp, struct page *pages,
                  int flags, struct AFS_UCRED *credp)
 {
     struct buf *tbuf;
-    struct vcache *avc = (struct vcache *)vp;
+    struct vcache *avc = VTOAFS(vp);
     afs_int32 code = 0;
     u_int toff, tlen = PAGESIZE, off = (pages->p_offset/PAGESIZE)*PAGESIZE;
     u_int poff = pages->p_offset;
@@ -720,7 +720,7 @@ struct AFS_UCRED *cred;
     AFS_STATCNT(afs_putpage);
     wholeEnchilada = (off == 0 && len == 0 && (flags & (B_INVAL|B_ASYNC)) == B_INVAL);
 
-    avc = (struct vcache *) vp;
+    avc = VTOAFS(vp);
     afs_BozonLock(&avc->pvnLock, avc);
     ObtainWriteLock(&avc->lock,248);
 
@@ -1065,9 +1065,9 @@ struct AFS_UCRED *acred;
        ReleaseWriteLock(&avc->lock);   /* uiomove may page fault */
        AFS_GUNLOCK();
 #if    defined(AFS_SUN56_ENV)
-       data = segmap_getmap(segkmap,(struct vnode *)avc,(u_offset_t)pageBase);
+       data = segmap_getmap(segkmap,AFSTOV(avc),(u_offset_t)pageBase);
 #else
-       data = segmap_getmap(segkmap, (struct vnode *) avc, pageBase);
+       data = segmap_getmap(segkmap, AFSTOV(avc), pageBase);
 #endif
 #ifndef        AFS_SUN5_ENV
        code = as_fault(&kas, data+pageOffset, tsize, F_SOFTLOCK, mode);
@@ -1219,7 +1219,7 @@ struct AFS_UCRED *cred;
        struct segvn_crargs crargs;
        register afs_int32 code;
        struct vrequest treq;
-       register struct vcache *avc = (struct vcache *) vp;
+       register struct vcache *avc = VTOAFS(vp);
 
        AFS_STATCNT(afs_map);
 
@@ -1280,7 +1280,7 @@ struct AFS_UCRED *cred;
        } else
            (void) as_unmap(as, *addr, len);    /* unmap old address space use */
        /* setup the create parameter block for the call */
-       crargs.vp = (struct vnode *) avc;
+       crargs.vp = AFSTOV(avc);
        crargs.offset = (u_int)off;
        crargs.cred = cred;
        crargs.type = flags&MAP_TYPE;
@@ -1394,7 +1394,7 @@ void afs_rwlock(vnp, wlock)
     struct vnode *vnp;
     int wlock;
 {
-    rw_enter(&((struct vcache *)vnp)->rwlock, (wlock ? RW_WRITER : RW_READER));
+    rw_enter(&(VTOAFS(vnp))->rwlock, (wlock ? RW_WRITER : RW_READER));
 }
 
 
@@ -1402,7 +1402,7 @@ void afs_rwunlock(vnp, wlock)
     struct vnode *vnp;
     int wlock;
 {
-    rw_exit(&((struct vcache *)vnp)->rwlock);
+    rw_exit(&(VTOAFS(vnp))->rwlock);
 }
 
 
@@ -1466,7 +1466,7 @@ int afs_frlock(vnp, cmd, ap, flag, off,
        AFS_GLOCK();
     }
 
-    code = afs_lockctl((struct vcache *)vnp, ap, cmd, credp);
+    code = afs_lockctl(VTOAFS(vnp), ap, cmd, credp);
     AFS_GUNLOCK();
     return code;
 }
@@ -1497,7 +1497,7 @@ int afs_space(vnp, cmd, ap, flag, off, credp)
        if (!ap->l_len) {
            vattr.va_mask = AT_SIZE;
            vattr.va_size = ap->l_start;
-           code = afs_setattr((struct vcache *)vnp, &vattr, 0, credp);
+           code = afs_setattr(VTOAFS(vnp), &vattr, 0, credp);
        } 
        AFS_GUNLOCK();
     }
@@ -1896,7 +1896,7 @@ gafs_fsync(avc, acred)
 
 void afs_inactive(struct vcache *avc, struct AFS_UCRED *acred)
 {
-    struct vnode *vp = (struct vnode *)avc;
+    struct vnode *vp = AFSTOV(avc);
     if (afs_shuttingdown) return ;
 
     /*
index 8230a549f5a945503f24e10062a393d9be8135c2..42db954f3bd33d208f6245111d66ce14de218590 100644 (file)
@@ -14,7 +14,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.1.1.7 2001/09/11 14:25:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.1.1.8 2002/05/10 23:44:15 hartmans Exp $");
 
 
 #ifdef UKERNEL
@@ -4274,7 +4274,7 @@ int uafs_statmountpoint_r(char *path)
      return -1;
     }
 
-    avc = (struct vcache *) vp;
+    avc = VTOAFS(vp);
 
     r = avc->mvstat;
     VN_RELE(vp);
index b0276713e2bca3d0cc1a103d269374d3907b1e6e..e6d95950dce67d418a1538313324fa8d25216131 100644 (file)
@@ -36,7 +36,7 @@
 #define        afs_hz      HZ
 #define osi_Time() (time(NULL))
 
-#define osi_vnhold(avc, r)  do { VN_HOLD((struct vnode *)(avc)); } while(0)
+#define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
 #define        afs_suser           suser
 
 /*
index 63ff6ce46afae17cb3dfba1a3d43653b641a2af5..dcc39bd07789ccce7ba61fae78c2d1d0b2de131e 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/osi_vfsops.c,v 1.1.1.5 2001/07/14 22:19:53 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/osi_vfsops.c,v 1.1.1.6 2002/05/10 23:44:18 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -90,11 +90,11 @@ afs_root (OSI_VFS_ARG(afsp), avpp)
        }
     }
     if (tvp) {
-       VN_HOLD((struct vnode *)tvp);
+       VN_HOLD(AFSTOV(tvp));
 
-       tvp->v.v_flag |= VROOT;     /* No-op on Ultrix 2.2 */
+       AFSTOV(tvp)->v_flag |= VROOT;       /* No-op on Ultrix 2.2 */
        afs_globalVFS = afsp;
-       *avpp = (struct vnode *) tvp;
+       *avpp = AFSTOV(tvp);
     }
 
     afs_Trace3(afs_iclSetp, CM_TRACE_GOPEN, ICL_TYPE_POINTER, *avpp,
index 341c4fc47d1b1c3d710250d607709e798fac8079..fc0a1e537d24a3749e9321bf46469bcc2524a032 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/osi_vnodeops.c,v 1.1.1.4 2001/07/14 22:19:51 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/osi_vnodeops.c,v 1.1.1.5 2002/05/10 23:44:19 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -58,7 +58,7 @@ int afs_vrdwr(
 
 int afs_inactive(struct vcache *avc, struct AFS_UCRED *acred)
 {
-    struct vnode *vp = (struct vnode *)avc;
+    struct vnode *vp = AFSTOV(avc);
     if (afs_shuttingdown) return ;
 
     usr_assert(avc->vrefCount == 0);
index 75c24c832f6d7b88752f91dec8f308c166537d4f..cc4b9af22438399610659b2882b818a21d2458c9 100644 (file)
@@ -21,7 +21,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.1.1.7 2001/07/14 22:19:53 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.1.1.8 2002/05/10 23:44:19 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -164,7 +164,7 @@ afs_CopyOutAttrs(avc, attrs)
 
 #ifdef AFS_LINUX22_ENV
     /* And linux has it's own stash as well. */
-    vattr2inode((struct inode*)avc, attrs);
+    vattr2inode(AFSTOV(avc), attrs);
 #endif
     return 0;
 }
@@ -268,8 +268,8 @@ afs_getattr(OSI_VC_ARG(avc), attrs, acred)
                    attrs->va_nodeid = ip->i_ino;
                }
 #else
-               if (avc->v.v_flag & VROOT) {
-                   struct vnode *vp = (struct vnode *)avc;
+               if (AFSTOV(avc)->v_flag & VROOT) {
+                   struct vnode *vp = AFSTOV(avc);
 
                    vp = vp->v_vfsp->vfs_vnodecovered;
                    if (vp) {   /* Ignore weird failures */
index 001270d5ffb47b1489fa797c33b6b219d78571f5..54202d3c94f129e69e44eb3ba63a4cc3d96dedb4 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.1.1.6 2001/07/14 22:19:54 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.1.1.7 2002/05/10 23:44:20 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -36,7 +36,7 @@ extern afs_rwlock_t afs_xcbhash;
 afs_create(ndp, attrs)
     struct nameidata *ndp;
     struct vattr *attrs; {
-    register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+    register struct vcache *adp = VTOAFS(ndp->ni_dvp);
     char *aname = ndp->ni_dent.d_name;
     enum vcexcl aexcl = NONEXCL; /* XXX - create called properly */
     int amode = 0; /* XXX - checked in higher level */
@@ -77,7 +77,9 @@ afs_create(OSI_VC_ARG(adp), aname, attrs, aexcl, amode, avcp, acred)
 
 
     AFS_STATCNT(afs_create);
-    if (code = afs_InitReq(&treq, acred)) return code;
+    if (code = afs_InitReq(&treq, acred)) 
+       goto done2;
+
     afs_Trace3(afs_iclSetp, CM_TRACE_CREATE, ICL_TYPE_POINTER, adp,
               ICL_TYPE_STRING, aname, ICL_TYPE_INT32, amode);
 
@@ -87,11 +89,16 @@ afs_create(OSI_VC_ARG(adp), aname, attrs, aexcl, amode, avcp, acred)
      * the reference count on it.
      */
     if (*avcp) {
-       AFS_RELE((struct vnode*)(*avcp));
+       AFS_RELE(AFSTOV(*avcp));
        *avcp = NULL;
     }
 #endif
 
+    if (strlen(aname) > AFSNAMEMAX) {
+       code = ENAMETOOLONG;
+       goto done;
+    }
+
     if (!afs_ENameOK(aname)) {
        code = EINVAL;
        goto done;
@@ -445,10 +452,15 @@ done:
 #ifdef AFS_OSF_ENV
     if (!code && !strcmp(aname, "core"))
        tvc->states |= CCore1;
+#endif
+
+    code = afs_CheckCode(code, &treq, 20);
+
+done2:
+#ifdef AFS_OSF_ENV
     afs_PutVCache(adp, 0);
 #endif /* AFS_OSF_ENV */
 
-    code = afs_CheckCode(code, &treq, 20);
     return code;
 }
 
index de9a3036e7b9353ec0aa24501f85ca489a584391..334d450e1b3b002eb275a1f11efb35af68eb8504 100644 (file)
@@ -20,7 +20,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_dirops.c,v 1.1.1.4 2001/07/14 22:19:55 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_dirops.c,v 1.1.1.5 2002/05/10 23:44:20 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -38,7 +38,7 @@ extern afs_rwlock_t afs_xcbhash;
 afs_mkdir(ndp, attrs)
     struct nameidata *ndp;
     struct vattr *attrs; {
-    register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+    register struct vcache *adp = VTOAFS(ndp->ni_dvp);
     char *aname = ndp->ni_dent.d_name;
     register struct vcache **avcp = (struct vcache **)&(ndp->ni_vp);
     struct ucred *acred = ndp->ni_cred;
@@ -69,7 +69,13 @@ afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred)
     afs_Trace2(afs_iclSetp, CM_TRACE_MKDIR, ICL_TYPE_POINTER, adp,
               ICL_TYPE_STRING, aname);
 
-    if (code = afs_InitReq(&treq, acred)) return code;
+    if (code = afs_InitReq(&treq, acred)) 
+       goto done2;
+
+    if (strlen(aname) > AFSNAMEMAX) {
+       code = ENAMETOOLONG;
+       goto done;
+    }
 
     if (!afs_ENameOK(aname)) {
        code = EINVAL;
@@ -151,10 +157,11 @@ afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred)
     }
     else code = ENOENT;
 done:
+    code = afs_CheckCode(code, &treq, 26);
+done2:
 #ifdef AFS_OSF_ENV
     AFS_RELE(ndp->ni_dvp);
 #endif /* AFS_OSF_ENV */
-    code = afs_CheckCode(code, &treq, 26);
     return code;
 }
 
@@ -162,7 +169,7 @@ done:
 #ifdef AFS_OSF_ENV
 afs_rmdir(ndp)
     struct nameidata *ndp; {
-    register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+    register struct vcache *adp = VTOAFS(ndp->ni_dvp);
     char *aname = ndp->ni_dent.d_name;
     struct ucred *acred = ndp->ni_cred;
 #else  /* AFS_OSF_ENV */
@@ -193,7 +200,14 @@ afs_rmdir(adp, aname, acred)
     afs_Trace2(afs_iclSetp, CM_TRACE_RMDIR, ICL_TYPE_POINTER, adp, 
               ICL_TYPE_STRING, aname);
 
-    if (code = afs_InitReq(&treq, acred)) return code;
+    if (code = afs_InitReq(&treq, acred)) 
+       goto done2;
+
+    if (strlen(aname) > AFSNAMEMAX) {
+       code = ENAMETOOLONG;
+       goto done;
+    }
+
     code = afs_VerifyVCache(adp, &treq);
     if (code) goto done;
 
@@ -292,10 +306,11 @@ afs_rmdir(adp, aname, acred)
     code = 0;
 
 done:
+    code = afs_CheckCode(code, &treq, 27); 
+done2:
 #ifdef AFS_OSF_ENV
     afs_PutVCache(adp, 0);
     afs_PutVCache(ndp->ni_vp, 0);
 #endif /* AFS_OSF_ENV */
-    code = afs_CheckCode(code, &treq, 27); 
     return code;
 }
index 85aadce611f5603c8d50fdcee77fd6bb40a44d78..e35af21fac92405eb6f9085017e5c36dfb534028 100644 (file)
@@ -17,7 +17,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_fid.c,v 1.1.1.6 2001/09/11 14:25:12 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_fid.c,v 1.1.1.7 2002/05/10 23:44:21 hartmans Exp $");
 
 #if !defined(AFS_DUX40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
@@ -117,7 +117,7 @@ struct fid **fidpp;
        addr[0] = (long)avc;
 #ifndef AFS_AIX41_ENV
        /* No post processing, so don't hold ref count. */
-       VN_HOLD((struct vnode *)avc);
+       VN_HOLD(AFSTOV(avc));
 #endif
     }
 #if    defined(AFS_AIX_ENV) || defined(AFS_SUN54_ENV)
index 377036e26585604590c1ed56352fd2839770a27a..e3f40f04ddbc25ad19b6737f449b017e30ac6e84 100644 (file)
@@ -15,7 +15,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.1.1.8 2001/10/14 17:59:12 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.1.1.9 2002/05/10 23:44:21 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -878,14 +878,14 @@ afs_xflock () {
     /* first determine whether this is any sort of vnode */
     if (fd->f_type == DTYPE_VNODE) {
        /* good, this is a vnode; next see if it is an AFS vnode */
-       tvc = (struct vcache *) fd->f_data;     /* valid, given a vnode */
-       if (IsAfsVnode((struct vnode *)tvc)) {
+       tvc = VTOAFS(fd->f_data);       /* valid, given a vnode */
+       if (IsAfsVnode(AFSTOV(tvc))) {
            /* This is an AFS vnode, so do the work */
 #ifdef AFS_DEC_ENV
            /* find real vcache entry; shouldn't be null if gnode ref count
             * is greater than 0.
             */
-           tvc = (struct vcache *) afs_gntovn(tvc);
+           tvc = VTOAFS(afs_gntovn)(tvc);
            if (!tvc) {
                u.u_error = ENOENT;
                return;
index 41c960c52d2a7c119cabfe1581c9873f5b229818..1ba9f19b1bee5dfdef243e5e04b8f9628bf40804 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_link.c,v 1.1.1.4 2001/07/14 22:19:55 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_link.c,v 1.1.1.5 2002/05/10 23:44:21 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -34,7 +34,7 @@ extern afs_rwlock_t afs_xcbhash;
 afs_link(avc, ndp)
     register struct vcache *avc;
     struct nameidata *ndp; {
-    register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+    register struct vcache *adp = VTOAFS(ndp->ni_dvp);
     char *aname = ndp->ni_dent.d_name;
     struct ucred *acred = ndp->ni_cred;
 #else  /* AFS_OSF_ENV */
@@ -63,11 +63,17 @@ afs_link(avc, OSI_VC_ARG(adp), aname, acred)
     afs_Trace3(afs_iclSetp, CM_TRACE_LINK, ICL_TYPE_POINTER, adp,
               ICL_TYPE_POINTER, avc, ICL_TYPE_STRING, aname);
     /* create a hard link; new entry is aname in dir adp */
-    if (code = afs_InitReq(&treq, acred)) return code;
+    if (code = afs_InitReq(&treq, acred)) 
+       goto done2;
+
     if (avc->fid.Cell != adp->fid.Cell || avc->fid.Fid.Volume != adp->fid.Fid.Volume) {
        code = EXDEV;
        goto done;
     }
+    if (strlen(aname) > AFSNAMEMAX) {
+       code = ENAMETOOLONG;
+       goto done;
+    }
     code = afs_VerifyVCache(adp, &treq);
     if (code) goto done;
 
@@ -144,9 +150,11 @@ afs_link(avc, OSI_VC_ARG(adp), aname, acred)
     ReleaseWriteLock(&avc->lock);
     code = 0;
 done:
+    code = afs_CheckCode(code, &treq, 24);
+done2:
 #ifdef AFS_OSF_ENV
     afs_PutVCache(adp, WRITE_LOCK);
 #endif /* AFS_OSF_ENV */
-    return afs_CheckCode(code, &treq);
+    return code;
 }
 
index 85b32e4a7b0a749f023350268c227d7e0a30075a..f349443727d74ea72c635c52482e2f806f93c44c 100644 (file)
@@ -17,7 +17,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_open.c,v 1.1.1.4 2001/07/14 22:19:56 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_open.c,v 1.1.1.5 2002/05/10 23:44:23 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -51,7 +51,7 @@ afs_open(avcp, aflags, acred)
     if (code = afs_InitReq(&treq, acred)) return code;
 #ifdef AFS_SGI64_ENV
     /* avcpp can be, but is not necesarily, bhp's vnode. */
-    tvc = (struct vcache *)BHV_TO_VNODE(bhv);
+    tvc = VTOAFS(BHV_TO_VNODE(bhv));
 #else
     tvc = *avcp;
 #endif
index 00c1978fb3967069f1324b2d6d7e535126701d5b..29ad5b26764856eceb3d29324cd08321fbec3216 100644 (file)
@@ -22,7 +22,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.1.1.6 2002/01/22 19:48:17 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.1.1.7 2002/05/10 23:44:24 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -209,7 +209,7 @@ char *Tnam1;
 #ifdef AFS_OSF_ENV
 afs_remove(ndp)
     struct nameidata *ndp; {
-    register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+    register struct vcache *adp = VTOAFS(ndp->ni_dvp);
     char *aname = ndp->ni_dent.d_name;
     struct ucred *acred = ndp->ni_cred;
 #else  /* AFS_OSF_ENV */
@@ -233,16 +233,37 @@ afs_remove(OSI_VC_ARG(adp), aname, acred)
     afs_Trace2(afs_iclSetp, CM_TRACE_REMOVE, ICL_TYPE_POINTER, adp,
               ICL_TYPE_STRING, aname);
 
+#ifdef AFS_OSF_ENV
+    tvc = (struct vcache *)ndp->ni_vp;  /* should never be null */
+#endif
+
     /* Check if this is dynroot */
-    if (afs_IsDynroot(adp))
+    if (afs_IsDynroot(adp)) {
+#ifdef  AFS_OSF_ENV
+        afs_PutVCache(adp, 0);
+        afs_PutVCache(tvc, 0);
+#endif
        return afs_DynrootVOPRemove(adp, acred, aname);
+    }
 
-    if (code = afs_InitReq(&treq, acred))
+    if (code = afs_InitReq(&treq, acred)) {
+#ifdef  AFS_OSF_ENV
+        afs_PutVCache(adp, 0);
+        afs_PutVCache(tvc, 0);
+#endif
       return code;
+    }
+    if (strlen(aname) > AFSNAMEMAX) {
+#ifdef  AFS_OSF_ENV
+       afs_PutVCache(adp, 0);
+       afs_PutVCache(tvc, 0);
+#endif
+       return ENAMETOOLONG;
+    }
 tagain:
     code = afs_VerifyVCache(adp, &treq);
 #ifdef AFS_OSF_ENV
-    tvc = (struct vcache *)ndp->ni_vp;  /* should never be null */
+    tvc = VTOAFS(ndp->ni_vp);  /* should never be null */
     if (code) {
        afs_PutVCache(adp, 0);
        afs_PutVCache(tvc, 0);
@@ -260,6 +281,10 @@ tagain:
       * fileserver
       */
     if ( adp->states & CRO ) {
+#ifdef  AFS_OSF_ENV
+        afs_PutVCache(adp, 0);
+        afs_PutVCache(tvc, 0);
+#endif
         code = EROFS;
        return code;
     }
@@ -390,6 +415,17 @@ afs_remunlink(avc, doit)
            cred = avc->uncred;
            avc->uncred = NULL;
 
+#ifdef AFS_DARWIN_ENV
+           /* this is called by vrele (via VOP_INACTIVE) when the refcount
+              is 0. we can't just call VN_HOLD since vref will panic.
+              we can't just call osi_vnhold because a later AFS_RELE will call
+              vrele again, which will try to call VOP_INACTIVE again after
+              vn_locking the vnode. which would be fine except that our vrele
+              caller also locked the vnode... So instead, we just gimmick the
+              refcounts and hope nobody else can touch the file now */
+           osi_Assert(VREFCOUNT(avc) == 0);
+           VREFCOUNT_SET(avc, 1);
+#endif
            VN_HOLD(&avc->v);
 
            /* We'll only try this once. If it fails, just release the vnode.
@@ -419,6 +455,10 @@ afs_remunlink(avc, doit)
            }
            osi_FreeSmallSpace(unlname);
            crfree(cred);
+#ifdef AFS_DARWIN_ENV
+           osi_Assert(VREFCOUNT(avc) == 1);
+           VREFCOUNT_SET(avc, 0);
+#endif
         }
     }
     else {
index cc7fc5645aad4f7401fd64b399f40dd5201766ec..47a678f394de1d4a757255625f3436025313fde3 100644 (file)
@@ -17,7 +17,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_rename.c,v 1.1.1.4 2001/07/14 22:19:57 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_rename.c,v 1.1.1.5 2002/05/10 23:44:25 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -55,6 +55,11 @@ afsrename(aodp, aname1, andp, aname2, acred)
 
     if (code = afs_InitReq(&treq, acred)) return code;
 
+    if (strlen(aname1) > AFSNAMEMAX || strlen(aname2) > AFSNAMEMAX) {
+       code = ENAMETOOLONG;
+       goto done;
+    }
+
     /* verify the latest versions of the stat cache entries */
 tagain:
     code = afs_VerifyVCache(aodp, &treq);
@@ -329,9 +334,9 @@ done:
 #ifdef AFS_OSF_ENV
 afs_rename(fndp, tndp)
     struct nameidata *fndp, *tndp; {
-    register struct vcache *aodp = (struct vcache *)fndp->ni_dvp;
+    register struct vcache *aodp = VTOAFS(fndp->ni_dvp);
     char *aname1 = fndp->ni_dent.d_name;
-    register struct vcache *andp = (struct vcache *)tndp->ni_dvp;
+    register struct vcache *andp = VTOAFS(tndp->ni_dvp);
     char *aname2 = tndp->ni_dent.d_name;
     struct ucred *acred = tndp->ni_cred;
 #else  /* AFS_OSF_ENV */
index b0f60a85eca6168224d79b656aad79a130bf655b..3b1a57609b815a925859bb0ad92698c866c5e186 100644 (file)
@@ -15,7 +15,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.1.1.7 2001/10/14 17:59:13 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.1.1.8 2002/05/10 23:44:25 hartmans Exp $");
 
 #if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
 
@@ -38,7 +38,7 @@ afs_ustrategy(abp)
     register struct buf *abp; {
     register afs_int32 code;
     struct uio tuio;
-    register struct vcache *tvc = (struct vcache *) abp->b_vp;
+    register struct vcache *tvc = VTOAFS(abp->b_vp);
     register afs_int32 len = abp->b_bcount;
 #if    !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
 #ifdef AFS_AIX41_ENV
@@ -97,9 +97,9 @@ afs_ustrategy(abp)
        /* are user's credentials valid here?  probably, but this
             sure seems like the wrong things to do. */
 #if    defined(AFS_SUN5_ENV)
-       code = afs_nlrdwr((struct vcache *) abp->b_vp, &tuio, UIO_READ, 0, credp);
+       code = afs_nlrdwr(VTOAFS(abp->b_vp), &tuio, UIO_READ, 0, credp);
 #else
-       code = afs_rdwr((struct vcache *) abp->b_vp, &tuio, UIO_READ, 0, credp);
+       code = afs_rdwr(VTOAFS(abp->b_vp), &tuio, UIO_READ, 0, credp);
 #endif
        if (code == 0) {
            if (tuio.afsio_resid > 0)
@@ -153,7 +153,7 @@ afs_ustrategy(abp)
        len = MIN(len, tvc->m.Length - dbtob(abp->b_blkno));
 #endif
 #ifdef AFS_ALPHA_ENV
-       len = MIN(abp->b_bcount, ((struct vcache *)abp->b_vp)->m.Length - dbtob(abp->b_blkno));
+       len = MIN(abp->b_bcount, (VTOAFS(abp->b_vp))->m.Length - dbtob(abp->b_blkno));
 #endif /* AFS_ALPHA_ENV */
        tuio.afsio_resid = len;
 #if defined(AFS_FBSD_ENV)
@@ -165,9 +165,9 @@ afs_ustrategy(abp)
        /* are user's credentials valid here?  probably, but this
             sure seems like the wrong things to do. */
 #if    defined(AFS_SUN5_ENV)
-       code = afs_nlrdwr((struct vcache *) abp->b_vp, &tuio, UIO_WRITE, 0, credp);
+       code = afs_nlrdwr(VTOAFS(abp->b_vp), &tuio, UIO_WRITE, 0, credp);
 #else
-       code = afs_rdwr((struct vcache *) abp->b_vp, &tuio, UIO_WRITE, 0, credp);
+       code = afs_rdwr(VTOAFS(abp->b_vp), &tuio, UIO_WRITE, 0, credp);
 #endif
     }
 #if    !defined(AFS_AIX32_ENV) && !defined(AFS_SUN5_ENV)
@@ -180,7 +180,7 @@ afs_ustrategy(abp)
     if (code && !(abp->b_flags & B_READ)) {
        /* prevent ubc from retrying writes */
        AFS_GUNLOCK();
-       ubc_invalidate(((struct vnode *)tvc)->v_object,
+       ubc_invalidate(AFSTOV(tvc)->v_object,
                       (vm_offset_t)dbtob(abp->b_blkno),
                       PAGE_SIZE, B_INVAL);
        AFS_GLOCK();
index 00657dcfedea34871d64267d18f5c78dcfc8ef8a..242aab9e6df3fb168d29a6e612db921ea514fda4 100644 (file)
@@ -21,7 +21,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_symlink.c,v 1.1.1.5 2002/01/22 19:48:17 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_symlink.c,v 1.1.1.6 2002/05/10 23:44:25 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -46,7 +46,7 @@ afs_symlink
     struct nameidata *ndp;
     struct vattr *attrs;
     register char *atargetName; {
-    register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+    register struct vcache *adp = VTOAFS(ndp->ni_dvp);
     char *aname = ndp->ni_dent.d_name;
     struct ucred *acred = ndp->ni_cred;
 #else  /* AFS_OSF_ENV */
@@ -78,16 +78,23 @@ afs_symlink
     afs_Trace2(afs_iclSetp, CM_TRACE_SYMLINK, ICL_TYPE_POINTER, adp,
                 ICL_TYPE_STRING, aname);
 
-    if (afs_IsDynroot(adp))
-       return afs_DynrootVOPSymlink(adp, acred, aname, atargetName);
+    if (strlen(aname) > AFSNAMEMAX || strlen(atargetName) > AFSPATHMAX) {
+       code = ENAMETOOLONG;
+       goto done2;
+    }
+
+    if (afs_IsDynroot(adp)) {
+       code = afs_DynrootVOPSymlink(adp, acred, aname, atargetName);
+       goto done2;
+    }
 
     if (code = afs_InitReq(&treq, acred))
-       return code;
+       goto done2;
 
     code = afs_VerifyVCache(adp, &treq);
     if (code) { 
       code = afs_CheckCode(code, &treq, 30);
-      return code;
+      goto done2;
     }
 
     /** If the volume is read-only, return error without making an RPC to the
@@ -95,7 +102,7 @@ afs_symlink
       */
     if ( adp->states & CRO ) {
         code = EROFS;
-       return code;
+       goto done2;
     }
 
     InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE;
@@ -210,12 +217,13 @@ afs_symlink
     afs_PutVCache(tvc, WRITE_LOCK);
     code = 0;
 done:
-#ifdef  AFS_OSF_ENV
-    AFS_RELE(ndp->ni_dvp);
-#endif  /* AFS_OSF_ENV */
     if ( volp ) 
        afs_PutVolume(volp, READ_LOCK);
     code = afs_CheckCode(code, &treq, 31);
+done2:
+#ifdef  AFS_OSF_ENV
+    AFS_RELE(ndp->ni_dvp);
+#endif  /* AFS_OSF_ENV */
     return code;
 }
 
@@ -224,7 +232,7 @@ afs_MemHandleLink(avc, areq)
      struct vrequest *areq;
   {
       register struct dcache *tdc;
-      register char *tp;
+      register char *tp, *rbuf;
       afs_int32 offset, len, alen;
       register afs_int32 code;
 
@@ -245,10 +253,14 @@ afs_MemHandleLink(avc, areq)
          }
          if (avc->m.Mode       & 0111) alen = len+1;   /* regular link */
          else alen = len;                      /* mt point */
-          tp = afs_osi_Alloc(alen); /* make room for terminating null */
+         rbuf = (char *) osi_AllocLargeSpace(AFS_LRALLOCSIZ);
           addr = afs_MemCacheOpen(tdc->f.inode);
-          code = afs_MemReadBlk(addr, 0, tp, len);
-         tp[alen-1] = 0;
+          code = afs_MemReadBlk(addr, 0, rbuf, len);
+         rbuf[alen-1] = '\0';
+         alen = strlen(rbuf) + 1;
+          tp = afs_osi_Alloc(alen); /* make room for terminating null */
+         memcpy(tp, rbuf, alen);
+         osi_FreeLargeSpace(rbuf);
          afs_PutDCache(tdc);
          if (code != len) {
              afs_osi_Free(tp, alen);
@@ -263,7 +275,7 @@ afs_UFSHandleLink(avc, areq)
     register struct vcache *avc;
     struct vrequest *areq; {
     register struct dcache *tdc;
-    register char *tp;
+    register char *tp, *rbuf;
     char *tfile;
     afs_int32 offset, len, alen;
     register afs_int32 code;
@@ -285,11 +297,15 @@ afs_UFSHandleLink(avc, areq)
        tfile = osi_UFSOpen (tdc->f.inode);
        if (avc->m.Mode & 0111) alen = len+1;   /* regular link */
        else alen = len;                        /* mt point */
-       tp = afs_osi_Alloc(alen);                       /* make room for terminating null */
-       code = afs_osi_Read(tfile, -1, tp, len);
-       tp[alen-1] = 0;
+       rbuf = (char *) osi_AllocLargeSpace(AFS_LRALLOCSIZ);
+       code = afs_osi_Read(tfile, -1, rbuf, len);
+       rbuf[alen-1] = '\0';
        osi_UFSClose(tfile);
        afs_PutDCache(tdc);
+       alen = strlen(rbuf) + 1;
+       tp = afs_osi_Alloc(alen);       /* make room for terminating null */
+       memcpy(tp, rbuf, alen);
+       osi_FreeLargeSpace(rbuf);
        if (code != len) {
            afs_osi_Free(tp, alen);
            return EIO;
index 37fa7e7b97d2526f804df8350c06ca5fe13d92b2..8ecb2cbdf17e97dac65c5896da1f5f2e93c606a2 100644 (file)
@@ -20,7 +20,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.1.1.9 2001/10/14 17:59:14 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.1.1.10 2002/05/10 23:44:26 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -59,7 +59,7 @@ register struct vrequest *treq;
         * top level code.  */
        avc->opens--;
        avc->execsOrWriters--;
-       AFS_RELE((struct vnode *)avc); /* VN_HOLD at set CCore(afs_FakeClose)*/
+       AFS_RELE(AFSTOV(avc)); /* VN_HOLD at set CCore(afs_FakeClose)*/
        crfree((struct AFS_UCRED *)avc->linkData);      /* "crheld" in afs_FakeClose */
        avc->linkData = (char *)0;
     }
@@ -256,9 +256,12 @@ afs_MemWrite(avc, auio, aio, acred, noLock)
 
        code = afs_MemWriteUIO(tdc->f.inode, &tuio);
        if (code) {
+           void *mep; /* XXX in prototype world is struct memCacheEntry * */
            error = code;
            ZapDCE(tdc);                /* bad data */
-           afs_MemCacheTruncate(tdc->f.inode, 0);
+           mep = afs_MemCacheOpen(tdc->f.inode);
+           afs_MemCacheTruncate(mep, 0);
+           afs_MemCacheClose(mep);
            afs_stats_cmperf.cacheCurrDirtyChunks--;
            afs_indexFlags[tdc->index] &= ~IFDataMod;    /* so it does disappear */
            afs_PutDCache(tdc);
@@ -678,7 +681,7 @@ struct vrequest *areq; {
 afs_closex(afd)
     register struct file *afd; {
     struct vrequest treq;
-    register struct vcache *tvc;
+    struct vcache *tvc;
     afs_int32 flags;
     int closeDone;
     afs_int32 code = 0;
@@ -692,9 +695,9 @@ afs_closex(afd)
      * close the file and release the lock when done.  Otherwise, just
      * let the regular close code work.      */
     if (afd->f_type == DTYPE_VNODE) {
-       tvc = (struct vcache *) afd->f_data;
-       if (IsAfsVnode((struct vnode *)tvc)) {
-           VN_HOLD((struct vnode *) tvc);
+       tvc = VTOAFS(afd->f_data);
+       if (IsAfsVnode(AFSTOV(tvc))) {
+           VN_HOLD(AFSTOV(tvc));
            flags = afd->f_flag & (FSHLOCK | FEXLOCK);
            afd->f_flag &= ~(FSHLOCK | FEXLOCK);
            code = vno_close(afd);
@@ -708,7 +711,7 @@ afs_closex(afd)
 #ifdef AFS_DEC_ENV
            grele((struct gnode *) tvc);
 #else
-           AFS_RELE((struct vnode *) tvc);
+           AFS_RELE(AFSTOV(tvc));
 #endif
            closeDone = 1;
        }
index 74e4a9f56e89153c48d525b7b6c3506113d9850e..f33062b8f4841f87677b181fe8cf015cb3d7077a 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_callback.c,v 1.1.1.7 2001/10/14 17:58:53 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_callback.c,v 1.1.1.8 2002/05/10 23:43:09 hartmans Exp $");
 
 #include "../afs/sysincludes.h" /*Standard vendor system headers*/
 #include "../afs/afsincludes.h" /*AFS-based standard headers*/
@@ -239,9 +239,15 @@ int SRXAFSCB_GetLock (a_call, a_index, a_result)
        a_result->lock.exclLocked = ((struct afs_lock *)(tl->addr))->excl_locked;
        a_result->lock.readersReading = ((struct afs_lock *)(tl->addr))->readers_reading;
        a_result->lock.numWaiting = ((struct afs_lock *)(tl->addr))->num_waiting;
+#ifdef INSTRUMENT_LOCKS
        a_result->lock.pid_last_reader = ((struct afs_lock *)(tl->addr))->pid_last_reader;
        a_result->lock.pid_writer = ((struct afs_lock *)(tl->addr))->pid_writer;
        a_result->lock.src_indicator = ((struct afs_lock *)(tl->addr))->src_indicator;
+#else
+       a_result->lock.pid_last_reader = 0;
+       a_result->lock.pid_writer = 0;
+       a_result->lock.src_indicator = 0;
+#endif
        code = 0;
     }
 
@@ -1135,23 +1141,23 @@ int SRXAFSCB_GetCellServDB(
 
     /* search the list for the cell with this index */
     ObtainReadLock(&afs_xcell);
-    for (i=0, cq = CellLRU.next; cq != &CellLRU && i<= a_index; cq = tq, i++) {
-        tq = QNext(cq);
-       if (i == a_index) {
-           tcell = QTOC(cq);
-           p_name = tcell->cellName;
-           for (j = 0 ; j < AFSMAXCELLHOSTS && tcell->cellHosts[j] ; j++) {
-               a_hosts[j] = ntohl(tcell->cellHosts[j]->addr->sa_ip);
-           }
-       }
+
+    tcell = afs_GetCellByIndex(a_index, READ_LOCK, 0);
+
+    if (!tcell) {
+      i = 0;
+    } else {
+      p_name = tcell->cellName;
+      for (j = 0 ; j < AFSMAXCELLHOSTS && tcell->cellHosts[j] ; j++) {
+       a_hosts[j] = ntohl(tcell->cellHosts[j]->addr->sa_ip);
+      }
+      i = strlen(p_name);
+      afs_PutCell(tcell, READ_LOCK);
     }
 
-    if (p_name)
-       i = strlen(p_name);
-    else
-       i = 0;
     t_name = (char *)rxi_Alloc(i+1);
     if (t_name == NULL) {
+        ReleaseReadLock(&afs_xcell);
 #ifdef RX_ENABLE_LOCKS
        AFS_GUNLOCK();
 #endif /* RX_ENABLE_LOCKS */
@@ -1211,6 +1217,7 @@ int SRXAFSCB_GetLocalCell(
      * the primary cell is when no other cell is explicitly marked as
      * the primary cell.  */
     ObtainReadLock(&afs_xcell);
+
     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
         tq = QNext(cq);
        tcell = QTOC(cq);
@@ -1229,6 +1236,7 @@ int SRXAFSCB_GetLocalCell(
        plen = 0;
     t_name = (char *)rxi_Alloc(plen+1);
     if (t_name == NULL) {
+        ReleaseReadLock(&afs_xcell);
 #ifdef RX_ENABLE_LOCKS
        AFS_GUNLOCK();
 #endif /* RX_ENABLE_LOCKS */
index b251a7f3345ebfe97e7e484ccfa87deab618d03c..94fa47325c116eddcf112d48b228c38e81ab9440 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_dcache.c,v 1.1.1.7 2001/10/14 17:58:55 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_dcache.c,v 1.1.1.8 2002/05/10 23:43:12 hartmans Exp $");
 
 #include "../afs/sysincludes.h" /*Standard vendor system headers*/
 #include "../afs/afsincludes.h" /*AFS-based standard headers*/
@@ -1895,7 +1895,7 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags)
            if (size > dynrootLen)
                size = dynrootLen;
            if (size < 0) size = 0;
-           code = afs_osi_Write(file, -1, dynrootDir, size);
+           code = afs_CFileWrite(file, 0, dynrootDir, size);
            afs_PutDynroot();
 
            if (code == size)
index 1117b04dd1f5326ed16a1f011ea39075bd3eac98..d25d3538eea2c6c1a4b1e4589c0a7fedc22db4d8 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_nfsdisp.c,v 1.1.1.2 2002/01/22 19:47:58 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_nfsdisp.c,v 1.1.1.3 2002/05/10 23:43:16 hartmans Exp $");
 
 #include "../afs/stds.h"
 #include "../afs/sysincludes.h" /* Standard vendor system headers */
@@ -19,7 +19,9 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_nfsdisp.c,v 1.1.1.2 2002/01/22
 #include "../rpc/auth.h"
 #include "../rpc/auth_unix.h"
 #include "../rpc/auth_des.h"
+#if !defined(AFS_SUN58_ENV)
 #include "../rpc/auth_kerb.h"
+#endif
 #include "../sys/tiuser.h"
 #include "../rpc/xdr.h"
 #include "../rpc/svc.h"
@@ -48,7 +50,7 @@ struct afs_nfs_disp_tbl {
 };
 
 struct afs_nfs2_resp {
-    nfsstat status;
+    enum nfsstat status;
 };
 
 #ifndef ACL2_NPROC
@@ -296,7 +298,7 @@ afs_nfs2_smallfidder(struct nfsdiropres *dr)
 #endif
 
     AFS_GLOCK();
-    vcp = (struct vcache *)addr[0];
+    vcp = VTOAFS((struct vnode*)addr[0]);
 
     /* See also afs_osi_vget */
     if (addr[1] == AFS_XLATOR_MAGIC)
@@ -318,7 +320,7 @@ afs_nfs2_smallfidder(struct nfsdiropres *dr)
 
        /* If we have a ref, release it */
        if (vcp->vrefCount >= 1) 
-           AFS_RELE((struct vnode *) vcp);
+           AFS_RELE(AFSTOV(vcp));
     } 
     AFS_GUNLOCK();
 }
@@ -326,7 +328,7 @@ afs_nfs2_smallfidder(struct nfsdiropres *dr)
 void
 afs_nfs2_noaccess(struct afs_nfs2_resp *resp)
 {
-    r->status = NFSERR_ACCES;
+    resp->status = NFSERR_ACCES;
 }
 
 void afs_nfs2_null(char *args, char *xp, char *exp, char *rp, char *crp)
@@ -359,18 +361,18 @@ void FUNCNAME(char *args, char *xp, char *exp, char *rp, char *crp) { \
 NFS_V2_REQ(afs_nfs2_getattr, RFS_GETATTR, 0) 
 NFS_V2_REQ(afs_nfs2_setattr, RFS_SETATTR, 0)
 NFS_V2_REQ(afs_nfs2_lookup, RFS_LOOKUP, 1)
-NFS_V2_REQ(afs_nfs2_readlink, RFS_READLINK, 0);
-NFS_V2_REQ(afs_nfs2_read, RFS_READ, 0);
-NFS_V2_REQ(afs_nfs2_write, RFS_WRITE, 0);
-NFS_V2_REQ(afs_nfs2_create, RFS_CREATE, 1);
-NFS_V2_REQ(afs_nfs2_remove, RFS_REMOVE, 0);
-NFS_V2_REQ(afs_nfs2_rename, RFS_RENAME, 0);
-NFS_V2_REQ(afs_nfs2_link, RFS_LINK, 0);
-NFS_V2_REQ(afs_nfs2_symlink, RFS_SYMLINK, 0);
-NFS_V2_REQ(afs_nfs2_mkdir, RFS_MKDIR, 1);
-NFS_V2_REQ(afs_nfs2_rmdir, RFS_RMDIR, 0);
-NFS_V2_REQ(afs_nfs2_readdir, RFS_READDIR, 0);
-NFS_V2_REQ(afs_nfs2_statfs, RFS_STATFS, 0);
+NFS_V2_REQ(afs_nfs2_readlink, RFS_READLINK, 0)
+NFS_V2_REQ(afs_nfs2_read, RFS_READ, 0)
+NFS_V2_REQ(afs_nfs2_write, RFS_WRITE, 0)
+NFS_V2_REQ(afs_nfs2_create, RFS_CREATE, 1)
+NFS_V2_REQ(afs_nfs2_remove, RFS_REMOVE, 0)
+NFS_V2_REQ(afs_nfs2_rename, RFS_RENAME, 0)
+NFS_V2_REQ(afs_nfs2_link, RFS_LINK, 0)
+NFS_V2_REQ(afs_nfs2_symlink, RFS_SYMLINK, 0)
+NFS_V2_REQ(afs_nfs2_mkdir, RFS_MKDIR, 1)
+NFS_V2_REQ(afs_nfs2_rmdir, RFS_RMDIR, 0)
+NFS_V2_REQ(afs_nfs2_readdir, RFS_READDIR, 0)
+NFS_V2_REQ(afs_nfs2_statfs, RFS_STATFS, 0)
 
 struct afs_nfs_disp_tbl afs_rfs_disp_tbl[RFS_NPROC] = {
     { afs_nfs2_null },
@@ -453,6 +455,7 @@ struct afs_nfs3_resp {
     nfsstat3 status;
     bool_t flags; 
 };
+typedef struct afs_nfs3_resp afs_nfs3_resp;
 
 static int 
 is_afs_fh3(nfs_fh3 *fhp) {
@@ -627,7 +630,7 @@ nfs3_to_afs_call(int which, caddr_t *args, nfs_fh3 **fhpp, nfs_fh3 **fh2pp)
 }
 
 afs_int32 
-acl2_to_afs_call(int which, caddr_t *args, nfs_fh3 **fhpp)
+acl3_to_afs_call(int which, caddr_t *args, nfs_fh3 **fhpp)
 {
     nfs_fh3 *fhp;
 
@@ -693,7 +696,7 @@ afs_nfs3_dispatcher(int type, afs_int32 which, char *argp,
        static int once = 0;
        struct SmallFid Sfid;
 
-       memcpy((char *)&Sfid, fh->fh_data, SIZEOF_SMALLFID);
+       memcpy((char *)&Sfid, fh->fh3_data, SIZEOF_SMALLFID);
 
        /* We ran */
        call = 1;
@@ -717,7 +720,7 @@ afs_nfs3_dispatcher(int type, afs_int32 which, char *argp,
 }
 
 void 
-afs_nfs3_smallfidder(struct nfs_fh3 *fhp int status)
+afs_nfs3_smallfidder(struct nfs_fh3 *fhp, int status)
 {
     afs_int32 addr[2];
     struct vcache *vcp;
@@ -731,7 +734,7 @@ afs_nfs3_smallfidder(struct nfs_fh3 *fhp int status)
 #endif
 
     AFS_GLOCK();
-    vcp = (struct vcache *)addr[0];
+    vcp = VTOAFS((struct vnode*)addr[0]);
 
     /* See also afs_osi_vget */
     if (addr[1] == AFS_XLATOR_MAGIC)
@@ -753,7 +756,7 @@ afs_nfs3_smallfidder(struct nfs_fh3 *fhp int status)
 
        /* If we have a ref, release it */
        if (vcp->vrefCount >= 1) 
-           AFS_RELE((struct vnode *) vcp);
+           AFS_RELE(AFSTOV(vcp));
     } 
     AFS_GUNLOCK();
 }
@@ -761,6 +764,7 @@ afs_nfs3_smallfidder(struct nfs_fh3 *fhp int status)
 #define NFS_V3_REQ(FUNCNAME, NFSOP, POST, RESP, RESPP) \
 void FUNCNAME(char *args, char *xp, char *exp, char *rp, char *crp) { \
     u_int call; \
+    afs_nfs3_resp dummy; \
     struct cred *svcred = curthread->t_cred; \
     curthread->t_cred = (struct cred*)crp; \
     call=afs_nfs3_dispatcher(0, NFSOP, (char *)args, &exp, rp, crp); \
@@ -768,34 +772,34 @@ void FUNCNAME(char *args, char *xp, char *exp, char *rp, char *crp) { \
     else { (*afs_rfs3_disp_tbl[NFSOP].orig_proc)(args, xp, exp, rp, crp); \
     if (POST && afs_NFSRootOnly && call) { \
     RESP *resp = ( RESP *)xp; \
-    afs_nfs3_smallfidder( RESPP , resp->status); } \
+    afs_nfs3_smallfidder( RESPP , resp->status); } \
     curthread->t_cred = svcred; \
     return; \
 }
 
-NFS_V3_REQ(afs_nfs3_getattr, NFSPROC3_GETATTR, 0, x, x
-NFS_V3_REQ(afs_nfs3_setattr, NFSPROC3_SETATTR, 0, x, x)
+NFS_V3_REQ(afs_nfs3_getattr, NFSPROC3_GETATTR, 0, afs_nfs3_resp, &dummy
+NFS_V3_REQ(afs_nfs3_setattr, NFSPROC3_SETATTR, 0, afs_nfs3_resp, &dummy)
 NFS_V3_REQ(afs_nfs3_lookup, NFSPROC3_LOOKUP, 1, LOOKUP3res, &resp->resok.object)
-NFS_V3_REQ(afs_nfs3_access, NFSPROC3_ACCESS, 0, x, x);
-NFS_V3_REQ(afs_nfs3_readlink, NFSPROC3_READLINK, 0, x, x);
-NFS_V3_REQ(afs_nfs3_read, NFSPROC3_READ, 0, x, x);
-NFS_V3_REQ(afs_nfs3_write, NFSPROC3_WRITE, 0, x, x);
-NFS_V3_REQ(afs_nfs3_create, NFSPROC3_CREATE, 1, CREATE3res, &resp->resok.obj.handle);
-NFS_V3_REQ(afs_nfs3_mkdir, NFSPROC3_MKDIR, 1, MKDIR3res, &resp->resok.obj.handle);
-NFS_V3_REQ(afs_nfs3_symlink, NFSPROC3_SYMLINK, 0, x, x);
-NFS_V3_REQ(afs_nfs3_mknod, NFSPROC3_MKNOD, 0, x, x);
-NFS_V3_REQ(afs_nfs3_remove, NFSPROC3_REMOVE, 0, x, x);
-NFS_V3_REQ(afs_nfs3_rmdir, NFSPROC3_RMDIR, 0, x, x);
-NFS_V3_REQ(afs_nfs3_rename, NFSPROC3_RENAME, 0, x, x);
-NFS_V3_REQ(afs_nfs3_link, NFSPROC3_LINK, 0, x, x);
-NFS_V3_REQ(afs_nfs3_readdir, NFSPROC3_READDIR, 0, x, x);
-NFS_V3_REQ(afs_nfs3_readdirplus, NFSPROC3_READDIRPLUS, 0, x, x);
-NFS_V3_REQ(afs_nfs3_fsstat, NFSPROC3_FSSTAT, 0, x, x);
-NFS_V3_REQ(afs_nfs3_fsinfo, NFSPROC3_FSINFO, 0, x, x);
-NFS_V3_REQ(afs_nfs3_pathconf, NFSPROC3_PATHCONF, 0, x, x);
-NFS_V3_REQ(afs_nfs3_commit, NFSPROC3_COMMIT, 0, x, x);
-
-struct afs_nfs_disp_tbl afs_rfs3_disp_tbl[RFS_NPROC] = {
+NFS_V3_REQ(afs_nfs3_access, NFSPROC3_ACCESS, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_readlink, NFSPROC3_READLINK, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_read, NFSPROC3_READ, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_write, NFSPROC3_WRITE, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_create, NFSPROC3_CREATE, 1, CREATE3res, &resp->resok.obj.handle)
+NFS_V3_REQ(afs_nfs3_mkdir, NFSPROC3_MKDIR, 1, MKDIR3res, &resp->resok.obj.handle)
+NFS_V3_REQ(afs_nfs3_symlink, NFSPROC3_SYMLINK, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_mknod, NFSPROC3_MKNOD, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_remove, NFSPROC3_REMOVE, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_rmdir, NFSPROC3_RMDIR, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_rename, NFSPROC3_RENAME, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_link, NFSPROC3_LINK, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_readdir, NFSPROC3_READDIR, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_readdirplus, NFSPROC3_READDIRPLUS, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_fsstat, NFSPROC3_FSSTAT, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_fsinfo, NFSPROC3_FSINFO, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_pathconf, NFSPROC3_PATHCONF, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_commit, NFSPROC3_COMMIT, 0, afs_nfs3_resp, &dummy)
+
+struct afs_nfs_disp_tbl afs_rfs3_disp_tbl[RFS3_NPROC] = {
     { afs_nfs2_null },
     { afs_nfs3_getattr },
     { afs_nfs3_setattr },
@@ -860,4 +864,4 @@ afs_xlatorinit_v3(struct rfs_disp_tbl *_rfs_tbl,
         _acl_tbl[i].dis_proc = afs_acl3_disp_tbl[i].afs_proc;
     }
 }
-#endif /* !defined(AFS_NONFSTRANS)
+#endif /* !defined(AFS_NONFSTRANS) */
index 079dd4a6fe89325bf406592c3780029622f88e35..6377e582b8b118f44274d5e399238fad5aec899d 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi.c,v 1.1.1.9 2002/01/28 00:24:06 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi.c,v 1.1.1.10 2002/05/10 23:43:17 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -91,10 +91,10 @@ register struct vcache *avc; {
     if (avc->opens > 0 || ((avc->v.v_flag & VTEXT) && !inode_uncache_try(avc))) return 1;
 #else
 #if defined(AFS_SGI_ENV)
-    if ((avc->opens > 0) || AFS_VN_MAPPED((struct vnode *)avc))
+    if ((avc->opens > 0) || AFS_VN_MAPPED(AFSTOV(avc)))
         return 1;
 #else
-    if (avc->opens > 0 || (avc->v.v_flag & VTEXT)) return(1);
+    if (avc->opens > 0 || (AFSTOV(avc)->v_flag & VTEXT)) return(1);
 #endif
 #endif /* AFS_MACH_ENV */
 #endif
index fe9cf2eff4f78ea15e9b8fec2fb982a805024eb2..51fdb27fbbdd772eeacd0543ddf61970a85b82c3 100644 (file)
@@ -32,7 +32,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_server.c,v 1.1.1.11 2002/01/22 19:48:01 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_server.c,v 1.1.1.12 2002/05/10 23:43:22 hartmans Exp $");
 
 #include "../afs/stds.h"
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
@@ -304,7 +304,7 @@ static void CheckVLServer(sa, areq)
 #ifdef RX_ENABLE_LOCKS
     AFS_GLOCK();
 #endif /* RX_ENABLE_LOCKS */
-    rx_SetConnDeadTime(tc->id, 50);
+    rx_SetConnDeadTime(tc->id, AFS_RXDEADTIME);
     afs_PutConn(tc, SHARED_LOCK);
     /*
      * If probe worked, or probe call not yet defined (for compatibility
@@ -565,7 +565,7 @@ void afs_CheckServers(adown, acellp)
            continue;  /* have just been added by setsprefs */ 
 
        /* get a connection, even if host is down; bumps conn ref count */
-       tu = afs_GetUser(treq.uid, ts->cell, SHARED_LOCK);
+       tu = afs_GetUser(treq.uid, ts->cell->cell, SHARED_LOCK);
        tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cell, tu,
                          1/*force*/, 1/*create*/, SHARED_LOCK);
        afs_PutUser(tu, SHARED_LOCK);
@@ -639,7 +639,7 @@ void afs_CheckServers(adown, acellp)
                afs_setTimeHost = tc->srvr->server;
            }
            if (setTimer)
-               rx_SetConnDeadTime(tc->id, 50);
+               rx_SetConnDeadTime(tc->id, AFS_RXDEADTIME);
            if (code >= 0 && (sa->sa_flags & SRVADDR_ISDOWN) && (tc->srvr == sa)) {
                /* server back up */
                print_internet_address("afs: file server ", sa, " is back up", 2);
index 1ced2e0bc6ba604551a4530fd54e51124382658e..850af164994f20f32188cb910e7ca78482f8374e 100644 (file)
@@ -38,7 +38,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_vcache.c,v 1.1.1.11 2002/01/28 00:24:08 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_vcache.c,v 1.1.1.12 2002/05/10 23:43:26 hartmans Exp $");
 
 #include "../afs/sysincludes.h" /*Standard vendor system headers*/
 #include "../afs/afsincludes.h" /*AFS-based standard headers*/
@@ -132,7 +132,7 @@ int afs_FlushVCache(struct vcache *avc, int *slept)
               ICL_TYPE_INT32, avc->states);
 #ifdef  AFS_OSF_ENV
     AFS_GUNLOCK();
-    VN_LOCK((struct vnode *)avc);
+    VN_LOCK(AFSTOV(avc));
     AFS_GLOCK();
 #endif
 
@@ -214,15 +214,15 @@ int afs_FlushVCache(struct vcache *avc, int *slept)
     afs_vcount--;
     vSetType(avc, VREG);
     if (VREFCOUNT(avc) > 0) {
-        VN_UNLOCK((struct vnode *)avc);
-        AFS_RELE((struct vnode *)avc);
+        VN_UNLOCK(AFSTOV(avc));
+        AFS_RELE(AFSTOV(avc));
     } else {
        if (afs_norefpanic) {
          printf ("flush vc refcnt < 1");
          afs_norefpanic++;
          (void) vgone(avc, VX_NOSLEEP, (struct vnodeops *) 0);
          AFS_GLOCK();
-         VN_UNLOCK((struct vnode *)avc);
+         VN_UNLOCK(AFSTOV(avc));
        }
        else osi_Panic ("flush vc refcnt < 1");
     }
@@ -232,7 +232,7 @@ int afs_FlushVCache(struct vcache *avc, int *slept)
 
 bad:
 #ifdef AFS_OSF_ENV
-    VN_UNLOCK((struct vnode *)avc);
+    VN_UNLOCK(AFSTOV(avc));
 #endif
     return code;
 
@@ -466,6 +466,83 @@ static afs_int32 afs_QueueVCB(struct vcache *avc)
     return 0;
 }
 
+#ifdef AFS_LINUX22_ENV
+/* afs_TryFlushDcacheChildren -- Shakes loose vcache references held by
+ *                               children of the dentry
+ *
+ * LOCKS -- Called with afs_xvcache write locked. Drops and reaquires
+ *          AFS_GLOCK, so it can call dput, which may call iput, but
+ *          keeps afs_xvcache exclusively.
+ *
+ * Tree traversal algorithm from fs/dcache.c: select_parent()
+ */
+static void afs_TryFlushDcacheChildren(struct vcache *tvc)
+{
+    struct inode *ip = AFSTOI(tvc);
+    struct dentry *this_parent;
+    struct list_head *next;
+    struct list_head *cur;
+    struct list_head *head = &ip->i_dentry;
+    struct dentry *dentry;
+    
+restart:
+    DLOCK();
+    cur = head;
+    while ((cur = cur->next) != head) {
+       dentry = list_entry(cur, struct dentry, d_alias);
+       if (DCOUNT(dentry)) {
+           this_parent = dentry;
+       repeat:
+           next = this_parent->d_subdirs.next;
+       resume:
+           while (next != &this_parent->d_subdirs) {
+               struct list_head *tmp = next;
+               struct dentry *dchld = list_entry(tmp, struct dentry, d_child);
+               
+               next = tmp->next;
+               if (!DCOUNT(dchld) && !dchld->d_inode) {
+                   DGET(dchld);
+                   AFS_GUNLOCK();
+                   DUNLOCK();
+                   d_drop(dchld);
+                   dput(dchld);
+                   AFS_GLOCK();
+                   DLOCK();
+                   goto repeat;
+               }
+               /*
+                * Descend a level if the d_subdirs list is non-empty.
+                */
+               if (!list_empty(&dchld->d_subdirs)) {
+                   this_parent = dchld;
+                   goto repeat;
+               }
+           }
+           
+           /*
+            * All done at this level ... ascend and resume the search.
+            */
+           if (this_parent != dentry) {
+               next = this_parent->d_child.next;
+               this_parent = this_parent->d_parent;
+               goto resume;
+           }
+       }
+
+       if (!DCOUNT(dentry)) {
+           AFS_GUNLOCK();
+           DGET(dentry);
+           DUNLOCK();
+           d_drop(dentry);
+           dput(dentry);
+           AFS_GLOCK();
+           goto restart;
+       }
+    }
+    DUNLOCK();
+
+}
+#endif /* AFS_LINUX22_ENV */
 
 /*
  * afs_RemoveVCB
@@ -559,63 +636,6 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp,
     int code, fv_slept;
 
     AFS_STATCNT(afs_NewVCache);
-#ifdef AFS_LINUX22_ENV
-    if (!freeVCList) {
-       /* Free some if possible. */
-        struct afs_q *tq, *uq;
-        int i; char *panicstr;
-        int vmax = 2 * afs_cacheStats;
-        int vn = VCACHE_FREE;
-       
-        i = 0;
-        for(tq = VLRU.prev; tq != &VLRU && vn > 0; tq = uq) {
-           tvc = QTOV(tq);
-           uq = QPrev(tq);
-           if (tvc->states & CVFlushed) 
-                refpanic ("CVFlushed on VLRU");
-           else if (i++ > vmax)
-                refpanic ("Exceeded pool of AFS vnodes(VLRU cycle?)");
-           else if (QNext(uq) != tq)
-                refpanic ("VLRU inconsistent");
-           
-           if (tvc == afs_globalVp)
-               continue;
-           
-           if ( VREFCOUNT(tvc) && tvc->opens == 0 ) {
-               struct inode *ip = (struct inode*)tvc;
-               if (list_empty(&ip->i_dentry)) {
-                   vn --;
-               }
-               else {
-                   struct list_head *cur;
-                   struct list_head *head = &ip->i_dentry;
-                   int all = 1;
-               restart:
-                   DLOCK();
-                   cur = head;
-                   while ((cur = cur->next) != head) {
-                       struct dentry *dentry = list_entry(cur, struct dentry, d_alias);
-                       if (!DCOUNT(dentry)) {
-                           AFS_GUNLOCK();
-                           DGET(dentry);
-                           DUNLOCK();
-                           d_drop(dentry);
-                           dput(dentry);
-                           AFS_GLOCK();
-                           goto restart;
-                       }
-                       else {
-                           all = 0;
-                       }
-                   }
-                   DUNLOCK();
-                   if (all) vn --;
-               }
-           }
-           if (tq == uq) break;
-        }
-    }
-#endif /* AFS_LINUX22_ENV */
 #ifdef AFS_OSF_ENV
 #ifdef AFS_OSF30_ENV
     if (afs_vcount >= afs_maxvcount) 
@@ -707,6 +727,11 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp,
                }
             }
 #endif
+#if defined(AFS_LINUX22_ENV)
+           if (tvc != afs_globalVp && VREFCOUNT(tvc) && tvc->opens == 0)
+               afs_TryFlushDcacheChildren(tvc);
+#endif
+
           if (VREFCOUNT(tvc) == 0 && tvc->opens == 0
               && (tvc->states & CUnlinkedDel) == 0) {
                code = afs_FlushVCache(tvc, &fv_slept);
@@ -800,7 +825,7 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp,
     hzero(tvc->m.DataVersion);         /* in case we copy it into flushDV */
 #ifdef AFS_OSF_ENV
     /* Hold it for the LRU (should make count 2) */
-    VN_HOLD((struct vnode *)tvc);
+    VN_HOLD(AFSTOV(tvc));
 #else  /* AFS_OSF_ENV */
     VREFCOUNT_SET(tvc, 1);     /* us */
 #endif /* AFS_OSF_ENV */
@@ -869,12 +894,12 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp,
     AFS_VN_INIT_BUF_LOCK(&(tvc->v));
 #endif
 #else
-    SetAfsVnode((struct vnode *)tvc);
+    SetAfsVnode(AFSTOV(tvc));
 #endif /* AFS_SGI64_ENV */
 #ifdef AFS_DARWIN_ENV
     tvc->v.v_ubcinfo = UBC_INFO_NULL;
     lockinit(&tvc->rwlock, PINOD, "vcache rwlock", 0, 0);
-    cache_purge((struct vnode *)tvc); 
+    cache_purge(AFSTOV(tvc)); 
     tvc->v.v_data=tvc;
     tvc->v.v_tag=VT_AFS;
     /* VLISTNONE(&tvc->v); */
@@ -932,7 +957,7 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp,
 #endif /* AFS_SGI_ENV */
 #if defined(AFS_LINUX22_ENV)
     {
-       struct inode *ip = (struct inode*)tvc;
+       struct inode *ip = AFSTOI(tvc);
        sema_init(&ip->i_sem, 1);
 #if defined(AFS_LINUX24_ENV)
        sema_init(&ip->i_zombie, 1);
@@ -1134,7 +1159,7 @@ afs_FlushActiveVcaches(doflocks)
 #ifdef AFS_GFS_ENV
                    VREFCOUNT_DEC(tvc);
 #else
-                   AFS_RELE((struct vnode *)tvc);
+                   AFS_RELE(AFSTOV(tvc));
 #endif
                    /* Matches write code setting CCore flag */
                    crfree(cred);
@@ -1917,7 +1942,7 @@ struct vcache *afs_GetRootVCache(struct VenusFid *afid,
             * can be safely implemented */
            int vg;
            AFS_GUNLOCK();
-            vg = vget((struct vnode *)tvc);   /* this bumps ref count */
+            vg = vget(AFSTOV(tvc));   /* this bumps ref count */
            AFS_GLOCK();
            if (vg)
                 continue;
@@ -2368,7 +2393,7 @@ struct vcache *afs_FindVCache(struct VenusFid *afid, afs_int32 lockit,
             /* Grab this vnode, possibly reactivating from the free list */
            int vg;
            AFS_GUNLOCK();
-            vg = vget((struct vnode *)tvc);
+            vg = vget(AFSTOV(tvc));
            AFS_GLOCK();
            if (vg)
                 continue;
@@ -2490,7 +2515,7 @@ afs_int32 afs_NFSFindVCache(avcp, afid, lockit)
             /* Grab this vnode, possibly reactivating from the free list */
            int vg;
            AFS_GUNLOCK();
-            vg = vget((struct vnode *)tvc);
+            vg = vget(AFSTOV(tvc));
            AFS_GLOCK();
            if (vg) {
                /* This vnode no longer exists. */
@@ -2502,8 +2527,8 @@ afs_int32 afs_NFSFindVCache(avcp, afid, lockit)
                /* Duplicates */
 #ifdef AFS_OSF_ENV
                /* Drop our reference counts. */
-               vrele((struct vnode *)tvc);
-               vrele((struct vnode *)found_tvc);
+               vrele(AFSTOV(tvc));
+               vrele(AFSTOV(found_tvc));
 #endif
                afs_duplicate_nfs_fids++;
                ReleaseSharedLock(&afs_xvcache);
@@ -2672,7 +2697,7 @@ void shutdown_vcache(void)
                tvc->mvid = (struct VenusFid*)0;
            }
 #ifdef AFS_AIX_ENV
-           aix_gnode_rele((struct vnode *)tvc);
+           aix_gnode_rele(AFSTOV(tvc));
 #endif
            if (tvc->linkData) {
                afs_osi_Free(tvc->linkData, strlen(tvc->linkData)+1);
index ebd3cb9c62a3cc02aeed23572d13efacfa8ebd9c..3c7f1f4406b240ca6d053531a13c5f55eaf8297d 100644 (file)
@@ -18,7 +18,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_volume.c,v 1.1.1.9 2002/01/22 19:48:02 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_volume.c,v 1.1.1.10 2002/05/10 23:43:27 hartmans Exp $");
 
 #include "../afs/stds.h"
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
@@ -673,7 +673,7 @@ static struct volume *afs_NewVolumeByName(char *aname, afs_int32 acell, int agoo
        } else
            code = -1;
     } while
-      (afs_Analyze(tconn, code, (struct VenusFid *) 0, areq,
+      (afs_Analyze(tconn, code, (struct VenusFid *) 0, &treq,
                   -1, /* no op code for this */
                   SHARED_LOCK, tcell));