Remove support for Solaris pre-8
[openafs.git] / src / afs / SOLARIS / osi_file.c
index 5b18303..8f92cc8 100644 (file)
@@ -43,11 +43,7 @@ afs_InitDualFSCacheOps(struct vnode *vp)
     int code;
     static int inited = 0;
     struct vfs *vfsp;
-#ifdef AFS_SUN56_ENV
     struct statvfs64 vfst;
-#else /* AFS_SUN56_ENV */
-    struct statvfs vfst;
-#endif /* AFS_SUN56_ENV */
 
     if (inited)
        return;
@@ -145,7 +141,7 @@ void *
 osi_VxfsOpen(afs_dcache_id_t *ainode)
 {
     struct vnode *vp;
-    register struct osi_file *afile = NULL;
+    struct osi_file *afile = NULL;
     afs_int32 code = 0;
     int dummy;
     afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
@@ -172,10 +168,9 @@ osi_UfsOpen(afs_dcache_id_t *ainode)
 #else
     struct inode *ip;
 #endif
-    register struct osi_file *afile = NULL;
+    struct osi_file *afile = NULL;
     afs_int32 code = 0;
     int dummy;
-    char fname[1024];
 #ifdef AFS_CACHE_VNODE_PATH
     char namebuf[1024];
     struct pathname lookpn;
@@ -186,38 +181,23 @@ osi_UfsOpen(afs_dcache_id_t *ainode)
 
 /*
  * AFS_CACHE_VNODE_PATH can be used with any file system, including ZFS or tmpfs.
- * The ainode is not an inode number but a signed index used to generate file names. 
+ * The ainode is not an inode number but a path.
  */
 #ifdef AFS_CACHE_VNODE_PATH
-       switch (ainode->ufs) {
-       case AFS_CACHE_CELLS_INODE:
-           snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CellItems");
-           break;
-       case AFS_CACHE_ITEMS_INODE:
-           snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CacheItems");
-           break;
-       case AFS_CACHE_VOLUME_INODE:
-           snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "VolumeItems");
-           break;
-       default:
-           dummy = ainode->ufs / afs_numfilesperdir;
-           snprintf(fname, 1024, "%s/D%d/V%d", afs_cachebasedir, dummy, ainode->ufs);
-    }
-               
        /* Can not use vn_open or lookupname, they use user's CRED() 
-     * We need to run as root So must use low level lookuppnvp 
-     * assume fname starts with /
+        * We need to run as root So must use low level lookuppnvp
+        * assume fname starts with /
         */
 
-       code = pn_get_buf(fname, AFS_UIOSYS, &lookpn, namebuf, sizeof(namebuf));
+       code = pn_get_buf(ainode->ufs, AFS_UIOSYS, &lookpn, namebuf, sizeof(namebuf));
     if (code != 0) 
-        osi_Panic("UfsOpen: pn_get_buf failed %ld %s %ld", code, fname, ainode->ufs);
+        osi_Panic("UfsOpen: pn_get_buf failed %ld %s", code, ainode->ufs);
  
        VN_HOLD(rootdir); /* released in loopuppnvp */
        code = lookuppnvp(&lookpn, NULL, FOLLOW, NULL, &vp, 
            rootdir, rootdir, &afs_osi_cred); 
     if (code != 0)  
-        osi_Panic("UfsOpen: lookuppnvp failed %ld %s %ld", code, fname, ainode->ufs);
+        osi_Panic("UfsOpen: lookuppnvp failed %ld %s", code, ainode->ufs);
        
 #ifdef AFS_SUN511_ENV
     code = VOP_OPEN(&vp, FREAD|FWRITE, &afs_osi_cred, NULL);
@@ -226,7 +206,7 @@ osi_UfsOpen(afs_dcache_id_t *ainode)
 #endif
 
     if (code != 0)
-        osi_Panic("UfsOpen: VOP_OPEN failed %ld %s %ld", code, fname, ainode->ufs);
+        osi_Panic("UfsOpen: VOP_OPEN failed %ld %s", code, ainode->ufs);
 
 #else
     code =
@@ -236,12 +216,12 @@ osi_UfsOpen(afs_dcache_id_t *ainode)
     AFS_GLOCK();
     if (code) {
        osi_FreeSmallSpace(afile);
-       osi_Panic("UfsOpen: igetinode failed %ld %s %ld", code, fname, ainode->ufs);
+       osi_Panic("UfsOpen: igetinode failed %ld %s", code, ainode->ufs);
     }
 #ifdef AFS_CACHE_VNODE_PATH
-       afile->vnode = vp;
-       code = afs_osi_Stat(afile, &tstat);
-       afile->size = tstat.size;
+    afile->vnode = vp;
+    code = afs_osi_Stat(afile, &tstat);
+    afile->size = tstat.size;
 #else
     afile->vnode = ITOV(ip);
     afile->size = VTOI(afile->vnode)->i_size;
@@ -276,9 +256,9 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
 }
 
 int
-afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
+afs_osi_Stat(struct osi_file *afile, struct osi_stat *astat)
 {
-    register afs_int32 code;
+    afs_int32 code;
     struct vattr tvattr;
     AFS_STATCNT(osi_Stat);
     ObtainWriteLock(&afs_xosi, 320);
@@ -301,7 +281,7 @@ afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
 }
 
 int
-osi_UFSClose(register struct osi_file *afile)
+osi_UFSClose(struct osi_file *afile)
 {
     AFS_STATCNT(osi_Close);
     if (afile->vnode) {
@@ -313,11 +293,11 @@ osi_UFSClose(register struct osi_file *afile)
 }
 
 int
-osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
+osi_UFSTruncate(struct osi_file *afile, afs_int32 asize)
 {
     afs_ucred_t *oldCred;
     struct vattr tvattr;
-    register afs_int32 code;
+    afs_int32 code;
     struct osi_stat tstat;
     AFS_STATCNT(osi_Truncate);
 
@@ -367,17 +347,13 @@ osi_DisableAtimes(struct vnode *avp)
 
 /* Generic read interface */
 int
-afs_osi_Read(register struct osi_file *afile, int offset, void *aptr,
+afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
             afs_int32 asize)
 {
     afs_ucred_t *oldCred;
-#if defined(AFS_SUN57_ENV)
     ssize_t resid;
-#else
-    int resid;
-#endif
-    register afs_int32 code;
-    register afs_int32 cnt1 = 0;
+    afs_int32 code;
+    afs_int32 cnt1 = 0;
     AFS_STATCNT(osi_Read);
 
     /**
@@ -412,16 +388,12 @@ afs_osi_Read(register struct osi_file *afile, int offset, void *aptr,
 
 /* Generic write interface */
 int
-afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr,
+afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
              afs_int32 asize)
 {
     afs_ucred_t *oldCred;
-#if defined(AFS_SUN57_ENV)
     ssize_t resid;
-#else
-    int resid;
-#endif
-    register afs_int32 code;
+    afs_int32 code;
     AFS_STATCNT(osi_Write);
     if (!afile)
        osi_Panic("afs_osi_Write called with null param");
@@ -450,7 +422,7 @@ afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr,
     This routine written from the RT NFS port strategy routine.
     It has been generalized a bit, but should still be pretty clear. */
 int
-afs_osi_MapStrategy(int (*aproc) (), register struct buf *bp)
+afs_osi_MapStrategy(int (*aproc) (), struct buf *bp)
 {
     afs_int32 returnCode;