Below you find a patch against vol/vol-info.c
It introduces a new option ("-filenames") to the volinfo tool in the
AFS_NAMEI_ENV environment.
This option lists the filenames, which are used to store the files and
directories of a volume on the /vicep?? partition at the fileserver.
It may be useful for debugging purposes.

Thomas.

-- 
----------------------------------------------------------
Thomas Mller, TU Chemnitz, URZ, D-09107 Chemnitz, Germany
----------------------------------------------------------
diff -Naurw src.orig/vol/vol-info.c src/vol/vol-info.c
--- src.orig/vol/vol-info.c     Thu Mar 29 14:06:29 2001
+++ src/vol/vol-info.c  Thu Mar 29 14:34:54 2001
@@ -58,6 +58,9 @@
 int DumpInodeNumber = 0;       /* Dump inode numbers with vnodes */
 int DumpDate = 0;              /* Dump vnode date (server modify date) with vnode */
 int InodeTimes = 0;            /* Dump some of the dates associated with inodes */
+#if defined(AFS_NAMEI_ENV)
+int PrintFileNames = 0;
+#endif
 int online = 0;
 int dheader=0;
 int dsizeOnly = 0, totvolsize=0, Vauxsize = 0, Vdiskused = 0, Vvnodesize = 0;
@@ -74,8 +77,13 @@
 struct DiskPartition *FindCurrentPartition(void);
 Volume *AttachVolume(struct DiskPartition *dp, char *volname,
                     register struct VolumeHeader *header);
+#if defined(AFS_NAMEI_ENV)
+void PrintVnode(int offset, VnodeDiskObject *vnode, int vnodeNumber,
+               Inode ino, Volume* vp);
+#else
 void PrintVnode(int offset, VnodeDiskObject *vnode, int vnodeNumber,
                Inode ino);
+#endif
 void PrintVnodes(Volume *vp, VnodeClass class);
 
 char *date(time_t date)
@@ -256,6 +264,12 @@
        orphaned = 1;
        DumpVnodes = 1;
     } else    
+#if defined(AFS_NAMEI_ENV)
+    if (as->parms[12].items) {
+       PrintFileNames = 1;
+       DumpVnodes = 1;
+    } else    
+#endif
        orphaned = 0;    
 
     DInit(10);
@@ -593,6 +607,9 @@
     cmd_AddParm(ts, "-fixheader", CMD_FLAG, CMD_OPTIONAL, "Try to fix header");    
     cmd_AddParm(ts, "-saveinodes", CMD_FLAG, CMD_OPTIONAL, "Try to save all inodes"); 
   
     cmd_AddParm(ts, "-orphaned", CMD_FLAG, CMD_OPTIONAL, "List all dir/files without 
a parent");    
+#if defined(AFS_NAMEI_ENV)
+    cmd_AddParm(ts, "-filenames", CMD_FLAG, CMD_OPTIONAL, "Print filenames");    
+#endif
     code = cmd_Dispatch(argc, argv);
     return code;
 }
@@ -769,16 +786,29 @@
                       ino, nfile, total);
            }
        } else {
+#if defined(AFS_NAMEI_ENV)
+           PrintVnode(offset, vnode,
+                      bitNumberToVnodeNumber(vnodeIndex, class), ino, vp);
+#else
            PrintVnode(offset, vnode,
                       bitNumberToVnodeNumber(vnodeIndex, class), ino);
+#endif
        }
     }
     STREAM_CLOSE(file);
     FDH_CLOSE(fdP);
 }
 
+#if defined(AFS_NAMEI_ENV)
+void PrintVnode(int offset, VnodeDiskObject *vnode, int vnodeNumber, Inode ino, 
+Volume *vp)
+#else
 void PrintVnode(int offset, VnodeDiskObject *vnode, int vnodeNumber, Inode ino)
+#endif
 {
+#if defined(AFS_NAMEI_ENV)
+    IHandle_t *ihtmpp;
+    namei_t filename;
+#endif
     Vvnodesize += vnode->length;
     if (dsizeOnly) return;
     if (orphaned && (vnode->length ==0 || vnode->parent || !offset)) return;
@@ -788,5 +818,12 @@
        printf(" inode: %s", PrintInode(NULL, ino));
     if (DumpDate)
        printf(" ServerModTime: %s", date(vnode->serverModifyTime));
+#if defined(AFS_NAMEI_ENV)
+    if(PrintFileNames) {
+           IH_INIT(ihtmpp, V_device(vp), V_parentId(vp), ino);
+           namei_HandleToName(&filename, ihtmpp);
+           printf(" UFS-Filename: %s",filename.n_path);
+    }
+#endif
     printf("\n");
 }

Reply via email to