2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 /* nilist.c - List the "inode" information for one or all volumes on
14 #include <afs/param.h>
15 #include <afsconfig.h>
25 #include <afs/afsint.h>
30 #include "viceinode.h"
35 printf("nilist is only useful for namei AFS file server"
36 " implementations.\n");
43 printf("Usage: nilist partition [volume]\n");
44 printf("List all \"inodes\" for the volume group containing the volume\n");
45 printf("or for the entire partition.\n");
49 /* This judge function can be a dummy since I know how nt_ListAFSFiles works */
50 int Judge(struct ViceInodeInfo *info, int vid)
55 int PrintInodeInfo(FILE *fp, struct ViceInodeInfo *info, char *dir, char *name)
57 static int lastVID = -1;
61 rwVID = info->u.param[1] == -1 ? info->u.special.parentId :
62 info->u.vnode.volumeId;
64 if (rwVID != lastVID) {
68 /* This munging of the name remove a "\R". */
69 (void) strcpy(dname, dir);
70 dname[strlen(dname)-2] = '\0';
71 printf("Parent Volume %d, Directory %s\n", rwVID, dname);
72 printf("%19s %8s %5s %10s %10s %10s %10s %s\n", "Inode", "Size",
73 "Nlink", "P1", "P2", "P3", "P4", "Name");
76 printf("%19I64d %8d %5d %10d %10d %10d %10d %s\n", info->inodeNumber,
77 info->byteCount, info->linkCount, info->u.param[0],
78 info->u.param[1], info->u.param[2], info->u.param[3], name);
80 printf("%19lld %8d %5d %10d %10d %10d %10d %s\n", info->inodeNumber,
81 info->byteCount, info->linkCount, info->u.param[0],
82 info->u.param[1], info->u.param[2], info->u.param[3], name);
88 main(int ac, char **av)
90 int singleVolumeNumber = 0;
94 if (ac < 2 || ac > 3) Usage();
98 singleVolumeNumber = atoi(av[2]);
101 ninodes = nt_ListAFSFiles(part, PrintInodeInfo, stdout,
102 Judge, singleVolumeNumber);
104 ninodes = namei_ListAFSFiles(part, PrintInodeInfo, stdout,
105 Judge, singleVolumeNumber);
110 #endif /* AFS_NAMEI_ENV */