When combined with the B<-vnode> flag, displays a change, modification,
and access timestamp for each of the large vnode and small vnode tables.
-=item B<-part> <I<partition name>>+
+=item B<-part> <I<partition name or id>>+
Specifies the partition that houses each volume for which to produce
-output. Use the format F</vicepI<xx>>, where I<xx> is one or two lowercase
+output. Use the format F</vicepI<xx>> or I<xx>, where I<xx> is one or two lowercase
letters. This argument can be omitted if the current working directory is
the mount location for an AFS server partition; it is not the mount
location for an AFS server partition, the command produces output for
}
/**
+ * Convert the partition device number into a partition name.
+ *
+ * @param[in] partId partition number, 0 to 254
+ * @param[out] partName buffer to hold partition name (e.g. /vicepa)
+ * @param[in] partNameSize size of partName buffer
+ *
+ * @return status
+ * @retval 0 success
+ * @retval -1 error, partId is out of range
+ * @retval -2 error, partition name exceeds partNameSize
+ */
+static int
+GetPartitionName(afs_uint32 partId, char *partName, afs_size_t partNameSize)
+{
+ const int OLD_NUM_DEVICES = 26; /* a..z */
+
+ if (partId < OLD_NUM_DEVICES) {
+ if (partNameSize < 8) {
+ return -2;
+ }
+ strlcpy(partName, "/vicep", partNameSize);
+ partName[6] = partId + 'a';
+ partName[7] = '\0';
+ return 0;
+ }
+ if (partId < VOLMAXPARTS) {
+ if (partNameSize < 9) {
+ return -2;
+ }
+ strlcpy(partName, "/vicep", partNameSize);
+ partId -= OLD_NUM_DEVICES;
+ partName[6] = 'a' + (partId / OLD_NUM_DEVICES);
+ partName[7] = 'a' + (partId % OLD_NUM_DEVICES);
+ partName[8] = '\0';
+ return 0;
+ }
+ return -1;
+}
+
+/**
* Process command line options and start scanning
*
* @param[in] as command syntax object
struct cmd_item *ti;
int err = 0;
afs_uint32 volumeId = 0;
- char *partName = 0;
+ char *partNameOrId = 0;
+ char partName[64] = "";
struct DiskPartition64 *partP = NULL;
InodeTimes = 1;
}
if ((ti = as->parms[5].items)) { /* -part */
- partName = ti->data;
+ partNameOrId = ti->data;
}
if ((ti = as->parms[6].items)) { /* -volumeid */
volumeId = strtoul(ti->data, NULL, 10);
DumpVnodes = 1; /* implied */
}
+ /* Allow user to specify partition by name or id. */
+ if (partNameOrId) {
+ afs_uint32 partId = volutil_GetPartitionID(partNameOrId);
+ if (partId == -1) {
+ fprintf(stderr, "%s: Could not parse '%s' as a partition name.\n",
+ progname, partNameOrId);
+ return 1;
+ }
+ if (GetPartitionName(partId, partName, sizeof(partName))) {
+ fprintf(stderr,
+ "%s: Could not format '%s' as a partition name.\n",
+ progname, partNameOrId);
+ return 1;
+ }
+ }
+
DInit(10);
err = VAttachPartitions();
progname, err);
}
- if (partName) {
+ if (partName[0]) {
partP = VGetPartition(partName, 0);
if (!partP) {
fprintf(stderr,
cmd_AddParm(ts, "-itime", CMD_FLAG, CMD_OPTIONAL,
"Dump special inode's mod times");
cmd_AddParm(ts, "-part", CMD_LIST, CMD_OPTIONAL,
- "AFS partition name (default current partition)");
+ "AFS partition name or id (default current partition)");
cmd_AddParm(ts, "-volumeid", CMD_LIST, CMD_OPTIONAL, "Volume id");
cmd_AddParm(ts, "-header", CMD_FLAG, CMD_OPTIONAL,
"Dump volume's header info");