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 <afsconfig.h>
15 #include <afs/param.h>
24 #include <afs/afsint.h>
29 #include "viceinode.h"
34 printf("nilist is only useful for namei AFS file server"
35 " implementations.\n");
43 printf("Usage: nilist partition [volume]\n");
45 ("List all \"inodes\" for the volume group containing the volume\n");
46 printf("or for the entire partition.\n");
50 /* This judge function can be a dummy since I know how nt_ListAFSFiles works */
52 Judge(struct ViceInodeInfo
*info
, int vid
)
58 PrintInodeInfo(FILE * fp
, struct ViceInodeInfo
*info
, char *dir
, char *name
)
60 static int lastVID
= -1;
66 -1 ? info
->u
.special
.parentId
: info
->u
.vnode
.volumeId
;
68 if (rwVID
!= lastVID
) {
72 /* This munging of the name remove a "\R". */
73 (void)strcpy(dname
, dir
);
74 dname
[strlen(dname
) - 2] = '\0';
75 printf("Parent Volume %d, Directory %s\n", rwVID
, dname
);
76 printf("%19s %8s %5s %10s %10s %10s %10s %s\n", "Inode", "Size",
77 "Nlink", "P1", "P2", "P3", "P4", "Name");
80 printf("%19I64d %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
);
84 printf("%19lld %8d %5d %10d %10d %10d %10d %s\n", info
->inodeNumber
,
85 info
->byteCount
, info
->linkCount
, info
->u
.param
[0],
86 info
->u
.param
[1], info
->u
.param
[2], info
->u
.param
[3], name
);
92 main(int ac
, char **av
)
94 int singleVolumeNumber
= 0;
103 singleVolumeNumber
= atoi(av
[2]);
107 nt_ListAFSFiles(part
, PrintInodeInfo
, stdout
, Judge
,
111 namei_ListAFSFiles(part
, PrintInodeInfo
, stdout
, Judge
,
117 #endif /* AFS_NAMEI_ENV */