#include <afs/errors.h>
#include <afs/acl.h>
#include <afs/prs_fs.h>
-#include <opr/queue.h>
+#include <rx/rx_queue.h>
#include "nfs.h"
#include "lock.h"
#include "salvage.h"
#include "daemon_com_inline.h"
#include "fssync_inline.h"
+#include "vol-info.h"
-#ifndef AFS_NT40_ENV
-#include "AFS_component_version_number.c"
-#endif
-
-static const char *progname = NULL;
+static int volinfo_init = 0;
+static const char *progname = "";
static const char *PLACEHOLDER = "-";
-/* Command line options */
-typedef enum {
- P_CHECKOUT,
- P_VNODE,
- P_DATE,
- P_INODE,
- P_ITIME,
- P_PART,
- P_VOLUMEID,
- P_HEADER,
- P_SIZEONLY,
- P_FIXHEADER,
- P_SAVEINODES,
- P_ORPHANED,
- P_FILENAMES,
- P_TYPE,
- P_FIND,
- P_MASK,
- P_OUTPUT,
- P_DELIM,
- P_NOHEADING,
- P_NOMAGIC,
-} volinfo_parm_t;
-
-/*
- * volscan output columns
- */
-#define VOLSCAN_COLUMNS \
- c(host) \
- c(desc) \
- c(vid) \
- c(offset) \
- c(vtype) \
- c(vname) \
- c(part) \
- c(partid) \
- c(fid) \
- c(path) \
- c(target) \
- c(mount) \
- c(mtype) \
- c(mcell) \
- c(mvol) \
- c(aid) \
- c(arights) \
- c(vntype) \
- c(cloned) \
- c(mode) \
- c(links) \
- c(length) \
- c(uniq) \
- c(dv) \
- c(inode) \
- c(namei) \
- c(modtime) \
- c(author) \
- c(owner) \
- c(parent) \
- c(magic) \
- c(lock) \
- c(smodtime) \
- c(group)
/* Numeric column type ids */
typedef enum columnType {
{max_column_type, NULL}
};
-/* All columns names as a single string. */
-#define c(x) #x " "
-static char *ColumnNames = VOLSCAN_COLUMNS;
-#undef c
-#undef VOLSCAN_COLUMNS
-
/* VnodeDetails union descriminator */
typedef enum {
} u;
};
-/* Modes */
-static int Checkout = 0; /**< Use FSSYNC to checkout volumes from the fileserver. */
-static int DumpInfo = 0; /**< Dump volume information */
-static int DumpHeader = 0; /**< Dump volume header files info */
-static int DumpVnodes = 0; /**< Dump vnode info */
-static int DumpInodeNumber = 0; /**< Dump inode numbers with vnodes */
-static int DumpDate = 0; /**< Dump vnode date (server modify date) with vnode */
-static int InodeTimes = 0; /**< Dump some of the dates associated with inodes */
-#if defined(AFS_NAMEI_ENV)
-static int PrintFileNames = 0; /**< Dump vnode and special file name filenames */
-#endif
-static int ShowOrphaned = 0; /**< Show "orphaned" vnodes (vnodes with parent of 0) */
-static int ShowSizes = 0; /**< Show volume size summary */
-static int SaveInodes = 0; /**< Save vnode data to files */
-static int FixHeader = 0; /**< Repair header files magic and version fields. */
-static char Hostname[64] = ""; /**< This hostname, for volscan output. */
-static int NeedDirIndex = 0; /**< Large vnode index handle is needed for path lookups. */
-static char ColumnDelim[16] = " "; /**< Column delimiter char(s) */
-static char PrintHeading = 0; /**< Print column heading */
-static int CheckMagic = 1; /**< Check directory vnode magic when looking up paths */
-static unsigned int ModeMask[64];
+static int NeedDirIndex; /**< Large vnode index handle is needed for path lookups. */
static FdHandle_t *DirIndexFd = NULL; /**< Current large vnode index handle for path lookups. */
static int NumOutputColumns = 0;
static columnType OutputColumn[max_column_type];
-#define SCAN_RW 0x01 /**< scan read-write volumes vnodes */
-#define SCAN_RO 0x02 /**< scan read-only volume vnodes */
-#define SCAN_BK 0x04 /**< scan backup volume vnodes */
-static int ScanVolType = 0; /**< volume types to scan; zero means do not check */
-
-#define FIND_FILE 0x01 /**< find regular files */
-#define FIND_DIR 0x02 /**< find directories */
-#define FIND_MOUNT 0x04 /**< find afs mount points */
-#define FIND_SYMLINK 0x08 /**< find symlinks */
-#define FIND_ACL 0x10 /**< find access entiries */
-static int FindVnType = 0; /**< types of objects to find */
-
/**
* Volume size running totals
*/
struct VnodeScanProc {
struct opr_queue link;
const char *heading;
- void (*proc) (struct VnodeDetails * vdp);
+ void (*proc) (struct VolInfoOpt *opt, struct VnodeDetails * vdp);
};
static struct opr_queue VnodeScanLists[nVNODECLASSES];
/* Forward Declarations */
-void PrintHeader(Volume * vp);
-void HandleAllPart(void);
-void HandlePart(struct DiskPartition64 *partP);
-void HandleVolume(struct DiskPartition64 *partP, char *name);
-struct DiskPartition64 *FindCurrentPartition(void);
-Volume *AttachVolume(struct DiskPartition64 *dp, char *volname,
+static void PrintHeader(Volume * vp);
+static void HandleAllPart(struct VolInfoOpt *opt);
+static void HandlePart(struct VolInfoOpt *opt, struct DiskPartition64 *partP);
+static void HandleVolume(struct VolInfoOpt *opt, struct DiskPartition64 *partP, char *name);
+static struct DiskPartition64 *FindCurrentPartition(void);
+static Volume *AttachVolume(struct VolInfoOpt *opt, struct DiskPartition64 *dp, char *volname,
struct VolumeHeader *header);
-void HandleVnodes(Volume * vp, VnodeClass class);
-static void AddVnodeToSizeTotals(struct VnodeDetails *vdp);
-static void SaveInode(struct VnodeDetails *vdp);
-static void PrintVnode(struct VnodeDetails *vdp);
-static void PrintVnodeDetails(struct VnodeDetails *vdp);
-static void ScanAcl(struct VnodeDetails *vdp);
-static void PrintColumnHeading(void);
-static void PrintColumns(struct VnodeDetails *vdp, const char *desc);
+static void HandleVnodes(struct VolInfoOpt *opt, Volume * vp, VnodeClass class);
+static void PrintColumnHeading(struct VolInfoOpt *opt);
+static void PrintColumns(struct VolInfoOpt *opt, struct VnodeDetails *vdp, const char *desc);
/* externs */
extern void SetSalvageDirHandle(DirHandle * dir, afs_int32 volume,
* caller must not reference the returned string after
* seven additional calls to this function.
*/
-char *
+static char *
date(time_t date)
{
#define MAX_DATE_RESULT 100
* caller must not reference the returned string after
* seven additional calls to this function.
*/
-char *
+static char *
NT_date(FILETIME * ft)
{
static char result[8][64];
*
* @return none
*/
-static void
-AddVnodeToSizeTotals(struct VnodeDetails *vdp)
+void
+volinfo_AddVnodeToSizeTotals(struct VolInfoOpt *opt, struct VnodeDetails *vdp)
{
afs_fsize_t fileLength;
afs_int64 diff_k = volumeTotals.size_k - volumeTotals.diskused_k;
PrintVolumeSizeHeading();
- printf("%u\t%9llu%9llu%10llu%10llu%9lld\t%24s\n",
- V_id(vp),
+ printf("%" AFS_VOLID_FMT "\t%9llu%9llu%10llu%10llu%9lld\t%24s\n",
+ afs_printable_VolumeId_lu(V_id(vp)),
volumeTotals.diskused_k,
volumeTotals.auxsize_k, volumeTotals.vnodesize_k,
volumeTotals.size_k, diff_k, V_name(vp));
* @retval 0 success
* @retval -1 failed to read file
*/
-int
-ReadHdr1(IHandle_t * ih, char *to, afs_sfsize_t size, u_int magic, u_int version)
+static int
+ReadHdr1(struct VolInfoOpt *opt, IHandle_t * ih, char *to, afs_sfsize_t size,
+ u_int magic, u_int version)
{
struct versionStamp *vsn;
int bad = 0;
progname,
PrintInode(NULL, ih->ih_ino), vsn->version, version);
}
- if (bad && FixHeader) {
+ if (bad && opt->fixHeader) {
vsn->magic = magic;
vsn->version = version;
printf("Special index inode %s has a bad header. Reconstructing...\n",
progname, PrintInode(NULL, ih->ih_ino));
}
}
- if (!bad && DumpInfo) {
+ if (!bad && opt->dumpInfo) {
printf("Inode %s: Good magic %x and version %x\n",
PrintInode(NULL, ih->ih_ino), magic, version);
}
*
* @return volume object or null on error
*/
-Volume *
-AttachVolume(struct DiskPartition64 * dp, char *volname,
- struct VolumeHeader * header)
+static Volume *
+AttachVolume(struct VolInfoOpt *opt, struct DiskPartition64 *dp,
+ char *volname, struct VolumeHeader *header)
{
Volume *vp;
afs_int32 ec = 0;
- if (Checkout) {
+ if (opt->checkout) {
afs_int32 code;
SYNC_response response;
VolumeId volid = header->id;
vp->shuttingDown = 0;
vp->goingOffline = 0;
vp->nUsers = 1;
- vp->header = (struct volHeader *)calloc(1, sizeof(*vp->header));
+ vp->header = calloc(1, sizeof(*vp->header));
if (!vp->header) {
fprintf(stderr, "%s: Failed to allocate volume header.\n", progname);
free(vp);
return NULL;
}
- ec = ReadHdr1(V_diskDataHandle(vp), (char *)&V_disk(vp),
+ ec = ReadHdr1(opt, V_diskDataHandle(vp), (char *)&V_disk(vp),
sizeof(V_disk(vp)), VOLUMEINFOMAGIC, VOLUMEINFOVERSION);
if (!ec) {
struct IndexFileHeader iHead;
- ec = ReadHdr1(vp->vnodeIndex[vSmall].handle, (char *)&iHead,
+ ec = ReadHdr1(opt, vp->vnodeIndex[vSmall].handle, (char *)&iHead,
sizeof(iHead), SMALLINDEXMAGIC, SMALLINDEXVERSION);
}
if (!ec) {
struct IndexFileHeader iHead;
- ec = ReadHdr1(vp->vnodeIndex[vLarge].handle, (char *)&iHead,
+ ec = ReadHdr1(opt, vp->vnodeIndex[vLarge].handle, (char *)&iHead,
sizeof(iHead), LARGEINDEXMAGIC, LARGEINDEXVERSION);
}
#ifdef AFS_NAMEI_ENV
if (!ec) {
struct versionStamp stamp;
- ec = ReadHdr1(V_linkHandle(vp), (char *)&stamp, sizeof(stamp),
+ ec = ReadHdr1(opt, V_linkHandle(vp), (char *)&stamp, sizeof(stamp),
LINKTABLEMAGIC, LINKTABLEVERSION);
}
#endif
* @return none
*/
static void
-DetachVolume(Volume * vp)
+DetachVolume(struct VolInfoOpt *opt, Volume * vp)
{
- if (Checkout) {
+ if (opt->checkout) {
afs_int32 code;
SYNC_response response;
memset(&response, 0, sizeof(response));
*
* @return 0 if successful
*/
-static int
-ScanPartitions(char *partNameOrId, afs_uint32 volumeId)
+int
+volinfo_ScanPartitions(struct VolInfoOpt *opt, char *partNameOrId, VolumeId volumeId)
{
int err = 0;
char partName[64] = "";
struct DiskPartition64 *partP = NULL;
-#ifndef AFS_NT40_ENV
- if (geteuid() != 0) {
- fprintf(stderr, "%s: Must be run as root; sorry\n", progname);
- return 1;
- }
-#endif
-
- if (Checkout) {
+ if (opt->checkout) {
if (!FSYNC_clientInit()) {
fprintf(stderr, "%s: Failed to connect to fileserver.\n",
progname);
}
}
- DInit(1024);
- VInitVnodes(vLarge, 0);
- VInitVnodes(vSmall, 0);
/* Allow user to specify partition by name or id. */
if (partNameOrId) {
}
if (!volumeId) {
- if (PrintHeading) {
- PrintColumnHeading();
+ if (opt->printHeading) {
+ PrintColumnHeading(opt);
}
if (!partP) {
- HandleAllPart();
+ HandleAllPart(opt);
} else {
- HandlePart(partP);
+ HandlePart(opt, partP);
}
} else {
char name1[128];
}
}
snprintf(name1, sizeof name1, VFORMAT,
- afs_printable_uint32_lu(volumeId));
- if (PrintHeading) {
- PrintColumnHeading();
+ afs_printable_VolumeId_lu(volumeId));
+ if (opt->printHeading) {
+ PrintColumnHeading(opt);
}
- HandleVolume(partP, name1);
+ HandleVolume(opt, partP, name1);
}
cleanup:
- if (Checkout) {
+ if (opt->checkout) {
FSYNC_clientFinis();
}
return err;
*
* @return none
*/
-static void
-AddVnodeHandler(VnodeClass class, void (*proc) (struct VnodeDetails * vdp),
- const char *heading)
+void
+volinfo_AddVnodeHandler(int vnodeClass,
+ void (*proc) (struct VolInfoOpt * opt,
+ struct VnodeDetails * vdp), const char *heading)
{
struct VnodeScanProc *entry = malloc(sizeof(struct VnodeScanProc));
entry->proc = proc;
entry->heading = heading;
- opr_queue_Append(&VnodeScanLists[class], (struct opr_queue *)entry);
+ opr_queue_Append(&VnodeScanLists[vnodeClass], (struct opr_queue *)entry);
}
/**
- * Process command line options and start scanning
- *
- * @param[in] as command syntax object
- * @param[in] arock opaque object; not used
- *
- * @return error code
+ * Initialize the vol-info module.
*/
-static int
-VolInfo(struct cmd_syndesc *as, void *arock)
+int
+volinfo_Init(const char *aprogname)
{
- struct cmd_item *ti;
- afs_uint32 volumeId = 0;
- char *partNameOrId = NULL;
-
- DumpInfo = 1; /* volinfo default mode */
-
- if (as->parms[P_CHECKOUT].items) {
- Checkout = 1;
- }
- if (as->parms[P_VNODE].items) {
- DumpVnodes = 1;
- }
- if (as->parms[P_DATE].items) {
- DumpDate = 1;
- }
- if (as->parms[P_INODE].items) {
- DumpInodeNumber = 1;
- }
- if (as->parms[P_ITIME].items) {
- InodeTimes = 1;
- }
- if ((ti = as->parms[P_PART].items)) {
- partNameOrId = ti->data;
- }
- if ((ti = as->parms[P_VOLUMEID].items)) {
- volumeId = strtoul(ti->data, NULL, 10);
- }
- if (as->parms[P_HEADER].items) {
- DumpHeader = 1;
- }
- if (as->parms[P_SIZEONLY].items) {
- ShowSizes = 1;
- }
- if (as->parms[P_FIXHEADER].items) {
- FixHeader = 1;
- }
- if (as->parms[P_SAVEINODES].items) {
- SaveInodes = 1;
- }
- if (as->parms[P_ORPHANED].items) {
- ShowOrphaned = 1;
- }
-#if defined(AFS_NAMEI_ENV)
- if (as->parms[P_FILENAMES].items) {
- PrintFileNames = 1;
- }
-#endif
-
- /* -saveinodes and -sizeOnly override the default mode.
- * For compatibility with old versions of volinfo, -orphaned
- * and -filename options imply -vnodes */
- if (SaveInodes || ShowSizes) {
- DumpInfo = 0;
- DumpHeader = 0;
- DumpVnodes = 0;
- InodeTimes = 0;
- ShowOrphaned = 0;
- } else if (ShowOrphaned) {
- DumpVnodes = 1; /* implied */
-#ifdef AFS_NAMEI_ENV
- } else if (PrintFileNames) {
- DumpVnodes = 1; /* implied */
+ if (!volinfo_init) {
+ progname = aprogname; /* for error messages */
+#ifndef AFS_NT40_ENV
+ if (geteuid() != 0) {
+ fprintf(stderr, "%s: Must be run as root.\n", progname);
+ return EPERM;
+ }
#endif
+ DInit(1024);
+ VInitVnodes(vLarge, 0);
+ VInitVnodes(vSmall, 0);
+ opr_queue_Init(&VnodeScanLists[vLarge]);
+ opr_queue_Init(&VnodeScanLists[vSmall]);
+ volinfo_init = 1;
}
+ return 0;
+}
- if (SaveInodes) {
- AddVnodeHandler(vSmall, SaveInode,
- "Saving all volume files to current directory ...\n");
- }
- if (ShowSizes) {
- AddVnodeHandler(vLarge, AddVnodeToSizeTotals, NULL);
- AddVnodeHandler(vSmall, AddVnodeToSizeTotals, NULL);
- }
- if (DumpVnodes) {
- AddVnodeHandler(vLarge, PrintVnode, "\nLarge vnodes (directories)\n");
- AddVnodeHandler(vSmall, PrintVnode,
- "\nSmall vnodes(files, symbolic links)\n");
- }
- return ScanPartitions(partNameOrId, volumeId);
+/**
+ * Alloc an options structure with default values.
+ *
+ * The caller must free the options pointer after use.
+ *
+ * @param[out] optp address of options pointer
+ * @return 0 on success
+ */
+int
+volinfo_Options(struct VolInfoOpt **optp)
+{
+ struct VolInfoOpt *opt;
+
+ opt = calloc(1, sizeof(struct VolInfoOpt));
+ if (!opt) {
+ fprintf(stderr, "%s: Failed to allocate options (%d).\n", progname, ENOMEM);
+ return ENOMEM;
+ }
+ opt->dumpInfo = 1;
+ gethostname(opt->hostname, sizeof(opt->hostname));
+ opt->columnDelim[0] = ' ';
+ opt->checkMagic = 1;
+ *optp = opt;
+ return 0;
}
/**
* @retval 1 too many columns
* @retval 2 invalid column name
*/
-static int
-AddOutputColumn(char *name)
+int
+volinfo_AddOutputColumn(char *name)
{
int i;
return 2;
}
-/**
- * Process command line options and start scanning
- *
- * @param[in] as command syntax object
- * @param[in] arock opaque object; not used
- *
- * @return error code
- * @retval 0 success
- * @retvol 1 failure
- */
-static int
-VolScan(struct cmd_syndesc *as, void *arock)
-{
- struct cmd_item *ti;
- afs_uint32 volumeId = 0;
- char *partNameOrId = NULL;
- int i;
-
- if (as->parms[P_CHECKOUT].items) {
- Checkout = 1;
- }
- if ((ti = as->parms[P_PART].items)) {
- partNameOrId = ti->data;
- }
- if ((ti = as->parms[P_VOLUMEID].items)) {
- volumeId = strtoul(ti->data, NULL, 10);
- }
- if (as->parms[P_NOHEADING].items) {
- PrintHeading = 0;
- } else {
- PrintHeading = 1;
- }
- if (as->parms[P_NOMAGIC].items) {
- CheckMagic = 0;
- }
- if ((ti = as->parms[P_DELIM].items)) {
- strncpy(ColumnDelim, ti->data, 15);
- ColumnDelim[15] = '\0';
- }
-
- /* Limit types of volumes to scan. */
- if (!as->parms[P_TYPE].items) {
- ScanVolType = (SCAN_RW | SCAN_RO | SCAN_BK);
- } else {
- ScanVolType = 0;
- for (ti = as->parms[P_TYPE].items; ti; ti = ti->next) {
- if (strcmp(ti->data, "rw") == 0) {
- ScanVolType |= SCAN_RW;
- } else if (strcmp(ti->data, "ro") == 0) {
- ScanVolType |= SCAN_RO;
- } else if (strcmp(ti->data, "bk") == 0) {
- ScanVolType |= SCAN_BK;
- } else {
- fprintf(stderr, "%s: Unknown -type value: %s\n", progname,
- ti->data);
- return 1;
- }
- }
- }
-
- /* Limit types of vnodes to find (plus access entries) */
- if (!as->parms[P_FIND].items) {
- FindVnType = (FIND_FILE | FIND_DIR | FIND_MOUNT | FIND_SYMLINK);
- } else {
- FindVnType = 0;
- for (ti = as->parms[P_FIND].items; ti; ti = ti->next) {
- if (strcmp(ti->data, "file") == 0) {
- FindVnType |= FIND_FILE;
- } else if (strcmp(ti->data, "dir") == 0) {
- FindVnType |= FIND_DIR;
- } else if (strcmp(ti->data, "mount") == 0) {
- FindVnType |= FIND_MOUNT;
- } else if (strcmp(ti->data, "symlink") == 0) {
- FindVnType |= FIND_SYMLINK;
- } else if (strcmp(ti->data, "acl") == 0) {
- FindVnType |= FIND_ACL;
- } else {
- fprintf(stderr, "%s: Unknown -find value: %s\n", progname,
- ti->data);
- return 1;
- }
- }
- }
-
- /* Show vnodes matching one of the mode masks */
- for (i = 0, ti = as->parms[P_MASK].items; ti; i++, ti = ti->next) {
- if (i >= (sizeof(ModeMask) / sizeof(*ModeMask))) {
- fprintf(stderr, "Too many -mask values\n");
- return -1;
- }
- ModeMask[i] = strtol(ti->data, NULL, 8);
- if (!ModeMask[i]) {
- fprintf(stderr, "Invalid -mask value: %s\n", ti->data);
- return 1;
- }
- }
-
- /* Set which columns to be printed. */
- if (!as->parms[P_OUTPUT].items) {
- AddOutputColumn("host");
- AddOutputColumn("desc");
- AddOutputColumn("fid");
- AddOutputColumn("dv");
- if (FindVnType & FIND_ACL) {
- AddOutputColumn("aid");
- AddOutputColumn("arights");
- }
- AddOutputColumn("path");
- } else {
- for (ti = as->parms[P_OUTPUT].items; ti; ti = ti->next) {
- if (AddOutputColumn(ti->data) != 0) {;
- fprintf(stderr, "%s: Unknown -output value: %s\n", progname,
- ti->data);
- return 1;
- }
- }
- }
-
- if (FindVnType & FIND_DIR) {
- AddVnodeHandler(vLarge, PrintVnodeDetails, NULL);
- }
- if (FindVnType & (FIND_FILE | FIND_MOUNT | FIND_SYMLINK)) {
- AddVnodeHandler(vSmall, PrintVnodeDetails, NULL);
- }
- if (FindVnType & FIND_ACL) {
- AddVnodeHandler(vLarge, ScanAcl, NULL);
- }
-
- return ScanPartitions(partNameOrId, volumeId);
-}
/**
* Determine if the current directory is a vice partition
*/
#ifdef AFS_NT40_ENV
#include <direct.h>
-struct DiskPartition64 *
+static struct DiskPartition64 *
FindCurrentPartition(void)
{
int dr = _getdrive();
return dp;
}
#else
-struct DiskPartition64 *
+static struct DiskPartition64 *
FindCurrentPartition(void)
{
char partName[1024];
*
* @return none
*/
-void
-HandleAllPart(void)
+static void
+HandleAllPart(struct VolInfoOpt *opt)
{
struct DiskPartition64 *partP;
-
for (partP = DiskPartitionList; partP; partP = partP->next) {
- if (DumpInfo || SaveInodes || ShowSizes) {
+ if (opt->dumpInfo || opt->saveInodes || opt->showSizes) {
printf("Processing Partition %s:\n", partP->name);
}
- HandlePart(partP);
- if (ShowSizes) {
+ HandlePart(opt, partP);
+ if (opt->showSizes) {
AddSizeTotals(&serverTotals, &partitionTotals);
}
}
- if (ShowSizes) {
+ if (opt->showSizes) {
PrintServerTotals();
}
}
*
* @return none
*/
-void
-HandlePart(struct DiskPartition64 *partP)
+static void
+HandlePart(struct VolInfoOpt *opt, struct DiskPartition64 *partP)
{
afs_int64 nvols = 0;
DIR *dirp;
while ((dp = readdir(dirp))) {
p = (char *)strrchr(dp->d_name, '.');
if (p != NULL && strcmp(p, VHDREXT) == 0) {
- HandleVolume(partP, dp->d_name);
- if (ShowSizes) {
+ HandleVolume(opt, partP, dp->d_name);
+ if (opt->showSizes) {
nvols++;
AddSizeTotals(&partitionTotals, &volumeTotals);
}
}
}
closedir(dirp);
- if (ShowSizes) {
+ if (opt->showSizes) {
PrintPartitionTotals(nvols);
}
}
/**
* Inspect a volume header special file.
*
- * @param[in] name descriptive name of the type of header special file
- * @param[in] dp partition object for this volume
- * @param[in] header header object for this volume
- * @param[in] inode fileserver inode number for this header special file
- * @param[out] psize total of the header special file
+ * @param[in] name descriptive name of the type of header special file
+ * @param[in] dp partition object for this volume
+ * @param[in] header header object for this volume
+ * @param[in] inode fileserver inode number for this header special file
+ * @param[inout] psize total of the header special file sizes
*
* @return none
*/
-void
-HandleSpecialFile(const char *name, struct DiskPartition64 *dp,
+static void
+HandleSpecialFile(struct VolInfoOpt *opt, const char *name, struct DiskPartition64 *dp,
struct VolumeHeader *header, Inode inode,
afs_sfsize_t * psize)
{
fdP = IH_OPEN(ih);
if (fdP == NULL) {
fprintf(stderr,
- "%s: Error opening header file '%s' for volume %u\n", progname,
- name, header->id);
+ "%s: Error opening header file '%s' for volume %" AFS_VOLID_FMT "\n", progname,
+ name, afs_printable_VolumeId_lu(header->id));
perror("open");
goto error;
}
size = FDH_SIZE(fdP);
if (size == -1) {
fprintf(stderr,
- "%s: Error getting size of header file '%s' for volume %u\n",
- progname, name, header->id);
+ "%s: Error getting size of header file '%s' for volume %" AFS_VOLID_FMT "\n",
+ progname, name, afs_printable_VolumeId_lu(header->id));
perror("fstat");
goto error;
}
*psize += size;
error:
- if (DumpInfo) {
+ if (opt->dumpInfo) {
printf("\t%s inode\t= %s (size = ", name, PrintInode(NULL, inode));
if (size != -1) {
printf("%lld)\n", size);
* @param[in] dp partition object for this volume
* @param[in] header_fd volume header file descriptor
* @param[in] header volume header object
- * @param[out] psize total of the header special file
*
* @return none
*/
-void
-HandleHeaderFiles(struct DiskPartition64 *dp, FD_t header_fd,
+static void
+HandleHeaderFiles(struct VolInfoOpt *opt, struct DiskPartition64 *dp, FD_t header_fd,
struct VolumeHeader *header)
{
afs_sfsize_t size = 0;
- if (DumpInfo) {
+ if (opt->dumpInfo) {
size = OS_SIZE(header_fd);
printf("Volume header (size = %lld):\n", size);
printf("\tstamp\t= 0x%x\n", header->stamp.version);
- printf("\tVolId\t= %u\n", header->id);
- printf("\tparent\t= %u\n", header->parent);
+ printf("\tVolId\t= %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(header->id));
+ printf("\tparent\t= %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(header->parent));
}
- HandleSpecialFile("Info", dp, header, header->volumeInfo, &size);
- HandleSpecialFile("Small", dp, header, header->smallVnodeIndex,
+ HandleSpecialFile(opt, "Info", dp, header, header->volumeInfo, &size);
+ HandleSpecialFile(opt, "Small", dp, header, header->smallVnodeIndex,
&size);
- HandleSpecialFile("Large", dp, header, header->largeVnodeIndex,
+ HandleSpecialFile(opt, "Large", dp, header, header->largeVnodeIndex,
&size);
#ifdef AFS_NAMEI_ENV
- HandleSpecialFile("Link", dp, header, header->linkTable, &size);
+ HandleSpecialFile(opt, "Link", dp, header, header->linkTable, &size);
#endif /* AFS_NAMEI_ENV */
- if (DumpInfo) {
+ if (opt->dumpInfo) {
printf("Total aux volume size = %lld\n\n", size);
}
- if (ShowSizes) {
+ if (opt->showSizes) {
volumeTotals.auxsize = size;
volumeTotals.auxsize_k = size / 1024;
}
* @return true if vnodes should be scanned
*/
static int
-IsScannable(Volume * vp)
+IsScannable(struct VolInfoOpt *opt, Volume * vp)
{
if (opr_queue_IsEmpty(&VnodeScanLists[vLarge]) &&
opr_queue_IsEmpty(&VnodeScanLists[vSmall])) {
return 0;
}
- if (!ScanVolType) {
+ if (!opt->scanVolType) {
return 1; /* filtering disabled; do not check vol type */
}
switch (V_type(vp)) {
case RWVOL:
- return ScanVolType & SCAN_RW;
+ return opt->scanVolType & SCAN_RW;
case ROVOL:
- return ScanVolType & SCAN_RO;
+ return opt->scanVolType & SCAN_RO;
case BACKVOL:
- return ScanVolType & SCAN_BK;
+ return opt->scanVolType & SCAN_BK;
default:
- fprintf(stderr, "%s: Volume %u; Unknown volume type %d\n", progname,
- V_id(vp), V_type(vp));
+ fprintf(stderr, "%s: Volume %" AFS_VOLID_FMT "; Unknown volume type %d\n", progname,
+ afs_printable_VolumeId_lu(V_id(vp)), V_type(vp));
break;
}
return 0;
*
* @return none
*/
-void
-HandleVolume(struct DiskPartition64 *dp, char *name)
+static void
+HandleVolume(struct VolInfoOpt *opt, struct DiskPartition64 *dp, char *name)
{
struct VolumeHeader header;
struct VolumeDiskHeader diskHeader;
}
DiskToVolumeHeader(&header, &diskHeader);
- if (DumpHeader || ShowSizes) {
- HandleHeaderFiles(dp, fd, &header);
+ if (opt->dumpHeader || opt->showSizes) {
+ HandleHeaderFiles(opt, dp, fd, &header);
}
- vp = AttachVolume(dp, name, &header);
+ vp = AttachVolume(opt, dp, name, &header);
if (!vp) {
fprintf(stderr, "%s: Error attaching volume header %s\n",
progname, name);
goto cleanup;
}
- if (DumpInfo) {
+ if (opt->dumpInfo) {
PrintHeader(vp);
}
- if (IsScannable(vp)) {
+ if (IsScannable(opt, vp)) {
if (NeedDirIndex) {
IHandle_t *ih = vp->vnodeIndex[vLarge].handle;
DirIndexFd = IH_OPEN(ih);
}
}
- HandleVnodes(vp, vLarge);
- HandleVnodes(vp, vSmall);
+ HandleVnodes(opt, vp, vLarge);
+ HandleVnodes(opt, vp, vSmall);
if (DirIndexFd) {
FDH_CLOSE(DirIndexFd);
DirIndexFd = NULL;
}
}
- if (ShowSizes) {
+ if (opt->showSizes) {
volumeTotals.diskused_k = V_diskused(vp);
volumeTotals.size_k =
volumeTotals.auxsize_k + volumeTotals.vnodesize_k;
- if (SaveInodes) {
+ if (opt->saveInodes) {
PrintingVolumeSizes = 0; /* print heading again */
}
PrintVolumeSizes(vp);
OS_CLOSE(fd);
}
if (vp) {
- DetachVolume(vp);
+ DetachVolume(opt, vp);
}
}
/**
- * Declare volinfo command line syntax
- *
- * @returns none
- */
-static void
-VolInfoSyntax(void)
-{
- struct cmd_syndesc *ts;
-
- ts = cmd_CreateSyntax(NULL, VolInfo, NULL,
- "Dump volume's internal state");
- cmd_AddParmAtOffset(ts, P_CHECKOUT, "-checkout", CMD_FLAG, CMD_OPTIONAL,
- "Checkout volumes from running fileserver");
- cmd_AddParmAtOffset(ts, P_VNODE, "-vnode", CMD_FLAG, CMD_OPTIONAL,
- "Dump vnode info");
- cmd_AddParmAtOffset(ts, P_DATE, "-date", CMD_FLAG, CMD_OPTIONAL,
- "Also dump vnode's mod date");
- cmd_AddParmAtOffset(ts, P_INODE, "-inode", CMD_FLAG, CMD_OPTIONAL,
- "Also dump vnode's inode number");
- cmd_AddParmAtOffset(ts, P_ITIME, "-itime", CMD_FLAG, CMD_OPTIONAL,
- "Dump special inode's mod times");
- cmd_AddParmAtOffset(ts, P_PART, "-part", CMD_LIST, CMD_OPTIONAL,
- "AFS partition name or id (default current partition)");
- cmd_AddParmAtOffset(ts, P_VOLUMEID, "-volumeid", CMD_LIST, CMD_OPTIONAL,
- "Volume id");
- cmd_AddParmAtOffset(ts, P_HEADER, "-header", CMD_FLAG, CMD_OPTIONAL,
- "Dump volume's header info");
- cmd_AddParmAtOffset(ts, P_SIZEONLY, "-sizeonly", CMD_FLAG, CMD_OPTIONAL,
- "Dump volume's size");
- cmd_AddParmAtOffset(ts, P_FIXHEADER, "-fixheader", CMD_FLAG,
- CMD_OPTIONAL, "Try to fix header");
- cmd_AddParmAtOffset(ts, P_SAVEINODES, "-saveinodes", CMD_FLAG,
- CMD_OPTIONAL, "Try to save all inodes");
- cmd_AddParmAtOffset(ts, P_ORPHANED, "-orphaned", CMD_FLAG, CMD_OPTIONAL,
- "List all dir/files without a parent");
-#if defined(AFS_NAMEI_ENV)
- cmd_AddParmAtOffset(ts, P_FILENAMES, "-filenames", CMD_FLAG,
- CMD_OPTIONAL, "Also dump vnode's namei filename");
-#endif
-
- /* For compatibility with older versions. */
- cmd_AddParmAlias(ts, P_SIZEONLY, "-sizeOnly");
-}
-
-/**
- * Declare volscan command line syntax
- *
- * @returns none
- */
-static void
-VolScanSyntax(void)
-{
- struct cmd_syndesc *ts;
-
- ts = cmd_CreateSyntax(NULL, VolScan, NULL,
- "Print volume vnode information");
-
- cmd_AddParmAtOffset(ts, P_CHECKOUT, "-checkout", CMD_FLAG, CMD_OPTIONAL,
- "Checkout volumes from running fileserver");
- cmd_AddParmAtOffset(ts, P_PART, "-partition", CMD_SINGLE, CMD_OPTIONAL,
- "AFS partition name or id (default current partition)");
- cmd_AddParmAtOffset(ts, P_VOLUMEID, "-volumeid", CMD_SINGLE, CMD_OPTIONAL,
- "Volume id (-partition required)");
- cmd_AddParmAtOffset(ts, P_TYPE, "-type", CMD_LIST, CMD_OPTIONAL,
- "Volume types: rw, ro, bk");
- cmd_AddParmAtOffset(ts, P_FIND, "-find", CMD_LIST, CMD_OPTIONAL,
- "Objects to find: file, dir, mount, symlink, acl");
- cmd_AddParmAtOffset(ts, P_MASK, "-mask", CMD_LIST, CMD_OPTIONAL,
- "Unix mode mask (example: 06000)");
- cmd_AddParmAtOffset(ts, P_OUTPUT, "-output", CMD_LIST, CMD_OPTIONAL,
- ColumnNames);
- cmd_AddParmAtOffset(ts, P_DELIM, "-delim", CMD_SINGLE, CMD_OPTIONAL,
- "Output field delimiter");
- cmd_AddParmAtOffset(ts, P_NOHEADING, "-noheading", CMD_FLAG, CMD_OPTIONAL,
- "Do not print the heading line");
- cmd_AddParmAtOffset(ts, P_NOMAGIC, "-ignore-magic", CMD_FLAG, CMD_OPTIONAL,
- "Skip directory vnode magic checks when looking up paths.");
-}
-
-/**
- * volinfo/volscan program entry
- */
-int
-main(int argc, char **argv)
-{
- afs_int32 code;
- char *base;
-
- opr_queue_Init(&VnodeScanLists[vLarge]);
- opr_queue_Init(&VnodeScanLists[vSmall]);
- memset(ModeMask, 0, sizeof(ModeMask) / sizeof(*ModeMask));
- gethostname(Hostname, sizeof(Hostname));
-
- base = strrchr(argv[0], '/');
-#ifdef AFS_NT40_ENV
- if (!base) {
- base = strrchr(argv[0], '\\');
- }
-#endif /* AFS_NT40_ENV */
- if (!base) {
- base = argv[0];
- }
-#ifdef AFS_NT40_ENV
- if ((base[0] == '/' || base[0] == '\\') && base[1] != '\0') {
-#else /* AFS_NT40_ENV */
- if (base[0] == '/' && base[1] != '\0') {
-#endif /* AFS_NT40_ENV */
- base++;
- }
- progname = base;
-
-#ifdef AFS_NT40_ENV
- if (stricmp(progname, "volscan") == 0
- || stricmp(progname, "volscan.exe") == 0) {
-#else /* AFS_NT40_ENV */
- if (strcmp(progname, "volscan") == 0) {
-#endif /* AFS_NT40_ENV */
- VolScanSyntax();
- } else {
- VolInfoSyntax();
- }
-
- code = cmd_Dispatch(argc, argv);
- return code;
-}
-
-/**
* Return a display string for the volume type.
*
* @param[in] type volume type
*
* @return none
*/
-void
+static void
PrintHeader(Volume * vp)
{
- printf("Volume header for volume %u (%s)\n", V_id(vp), V_name(vp));
+ printf("Volume header for volume %" AFS_VOLID_FMT " (%s)\n", afs_printable_VolumeId_lu(V_id(vp)), V_name(vp));
printf("stamp.magic = %x, stamp.version = %u\n", V_stamp(vp).magic,
V_stamp(vp).version);
printf
V_type(vp), volumeTypeString(V_type(vp)), V_uniquifier(vp),
V_needsCallback(vp), V_destroyMe(vp));
printf
- ("id = %u, parentId = %u, cloneId = %u, backupId = %u, restoredFromId = %u\n",
- V_id(vp), V_parentId(vp), V_cloneId(vp), V_backupId(vp),
- V_restoredFromId(vp));
+ ("id = %" AFS_VOLID_FMT ", parentId = %" AFS_VOLID_FMT ", cloneId = %" AFS_VOLID_FMT ", backupId = %" AFS_VOLID_FMT ", restoredFromId = %" AFS_VOLID_FMT "\n",
+ afs_printable_VolumeId_lu(V_id(vp)), afs_printable_VolumeId_lu(V_parentId(vp)), afs_printable_VolumeId_lu(V_cloneId(vp)), afs_printable_VolumeId_lu(V_backupId(vp)), afs_printable_VolumeId_lu(V_restoredFromId(vp)));
printf
("maxquota = %d, minquota = %d, maxfiles = %d, filecount = %d, diskused = %d\n",
V_maxquota(vp), V_minquota(vp), V_maxfiles(vp), V_filecount(vp),
V_dayUse(vp), V_weekUse(vp)[0], V_weekUse(vp)[1], V_weekUse(vp)[2],
V_weekUse(vp)[3], V_weekUse(vp)[4], V_weekUse(vp)[5],
V_weekUse(vp)[6], date(V_dayUseDate(vp)));
- printf("volUpdateCounter = %u\n", V_volUpCounter(vp));
+ printf("volUpdateCounter = %u\n", V_volUpdateCounter(vp));
}
/**
*
* @return none
*/
-static void
-SaveInode(struct VnodeDetails *vdp)
+void
+volinfo_SaveInode(struct VolInfoOpt *opt, struct VnodeDetails *vdp)
{
IHandle_t *ih;
FdHandle_t *fdP;
* @retval 0 success
* @retval -1 failure
*/
-int
-GetDirVnode(Volume * vp, VnodeId parent, VnodeDiskObject * pvn)
+static int
+GetDirVnode(struct VolInfoOpt *opt, Volume * vp, VnodeId parent, VnodeDiskObject * pvn)
{
afs_int32 code;
afs_foff_t offset;
afs_printable_uint32_lu(V_id(vp)));
}
offset = vnodeIndexOffset(&VnodeClassInfo[vLarge], parent);
- code = FDH_SEEK(DirIndexFd, offset, 0);
- if (code == -1) {
- fprintf(stderr,
- "%s: GetDirVnode: seek failed for %lu.%lu to offset %llu\n",
- progname, afs_printable_uint32_lu(V_id(vp)),
- afs_printable_uint32_lu(parent), (long long unsigned)offset);
- return -1;
- }
- code = FDH_READ(DirIndexFd, pvn, SIZEOF_LARGEDISKVNODE);
+ code = FDH_PREAD(DirIndexFd, pvn, SIZEOF_LARGEDISKVNODE, offset);
if (code != SIZEOF_LARGEDISKVNODE) {
fprintf(stderr,
"%s: GetDirVnode: read failed for %lu.%lu at offset %llu\n",
afs_printable_uint32_lu(parent), (long long unsigned)offset);
return -1;
}
- if (CheckMagic && (pvn->vnodeMagic != LARGEVNODEMAGIC)) {
+ if (opt->checkMagic && (pvn->vnodeMagic != LARGEVNODEMAGIC)) {
fprintf(stderr, "%s: GetDirVnode: bad vnode magic for %lu.%lu at offset %llu\n",
progname, afs_printable_uint32_lu(V_id(vp)),
afs_printable_uint32_lu(parent), (long long unsigned)offset);
* @retval 0 success
* @retval -1 error
*/
-int
-LookupPath(struct VnodeDetails *vdp)
+static int
+LookupPath(struct VolInfoOpt *opt, struct VnodeDetails *vdp)
{
#define MAX_PATH_LEN 1023
static char path_buffer[MAX_PATH_LEN + 1];
while (parent) {
int len;
- code = GetDirVnode(vp, parent, pvn);
+ code = GetDirVnode(opt, vp, parent, pvn);
if (code) {
cursor = NULL;
break;
code = -1;
goto cleanup;
}
- if (FDH_SEEK(fdP, 0, SEEK_SET) < 0) {
- code = -1;
- goto cleanup;
- }
- readLength = FDH_READ(fdP, buffer, fileLength);
+ readLength = FDH_PREAD(fdP, buffer, fileLength, 0);
if (readLength < 0) {
fprintf(stderr,
"%s: Error reading symlink contents for fid (%lu.%lu.%lu.%lu); "
*
* @return none
*/
-static void
-PrintVnodeDetails(struct VnodeDetails *vdp)
+void
+volinfo_PrintVnodeDetails(struct VolInfoOpt *opt, struct VnodeDetails *vdp)
{
switch (vdp->vnode->type) {
case vNull:
break;
case vFile:
- if (FindVnType & FIND_FILE) {
- PrintColumns(vdp, "file");
+ if (opt->findVnType & FIND_FILE) {
+ PrintColumns(opt, vdp, "file");
}
break;
case vDirectory:
- if (FindVnType & FIND_DIR) {
- PrintColumns(vdp, "dir");
+ if (opt->findVnType & FIND_DIR) {
+ PrintColumns(opt, vdp, "dir");
}
break;
case vSymlink:
- if (FindVnType & (FIND_MOUNT | FIND_SYMLINK)) {
+ if (opt->findVnType & (FIND_MOUNT | FIND_SYMLINK)) {
ReadSymlinkTarget(vdp);
- if ((FindVnType & FIND_MOUNT) && (vdp->t == VNODE_U_MOUNT)) {
- PrintColumns(vdp, "mount");
+ if ((opt->findVnType & FIND_MOUNT) && (vdp->t == VNODE_U_MOUNT)) {
+ PrintColumns(opt, vdp, "mount");
}
- if ((FindVnType & FIND_SYMLINK) && (vdp->t == VNODE_U_SYMLINK)) {
- PrintColumns(vdp, "symlink");
+ if ((opt->findVnType & FIND_SYMLINK) && (vdp->t == VNODE_U_SYMLINK)) {
+ PrintColumns(opt, vdp, "symlink");
}
}
break;
*
* @return none
*/
-static void
-ScanAcl(struct VnodeDetails *vdp)
+void
+volinfo_ScanAcl(struct VolInfoOpt *opt, struct VnodeDetails *vdp)
{
int i;
struct acl_accessList *acl;
for (i = 0; i < acl->positive; i++) {
vdp->t = VNODE_U_POS_ACCESS;
vdp->u.access = &(acl->entries[i]);
- PrintColumns(vdp, "acl");
+ PrintColumns(opt, vdp, "acl");
}
for (i = (acl->total - 1); i >= (acl->total - acl->negative); i--) {
vdp->t = VNODE_U_NEG_ACCESS;
vdp->u.access = &(acl->entries[i]);
- PrintColumns(vdp, "acl");
+ PrintColumns(opt, vdp, "acl");
}
}
*
*/
static int
-ModeMaskMatch(unsigned int modeBits)
+ModeMaskMatch(struct VolInfoOpt *opt, unsigned int modeBits)
{
int i;
- for (i = 0; ModeMask[i] && i <= sizeof(ModeMask) / sizeof(*ModeMask); i++) {
- if ((ModeMask[i] & modeBits) == 0) {
+ for (i = 0; i < sizeof(opt->modeMask) / sizeof(*opt->modeMask) && opt->modeMask[i]; i++) {
+ if ((opt->modeMask[i] & modeBits) == 0) {
return 0; /* at least one mode bit is not present */
}
}
*
* @return none
*/
-void
-HandleVnodes(Volume * vp, VnodeClass class)
+static void
+HandleVnodes(struct VolInfoOpt *opt, Volume * vp, VnodeClass class)
{
afs_int32 diskSize =
(class == vSmall ? SIZEOF_SMALLDISKVNODE : SIZEOF_LARGEDISKVNODE);
if (GetFileInfo(fdP->fd_fd, &size, &ctime, &atime, &mtime) != 0) {
goto error;
}
- if (InodeTimes) {
+ if (opt->dumpInodeTimes) {
printf("ichanged : %s\nimodified: %s\niaccessed: %s\n\n", ctime,
mtime, atime);
}
struct VnodeDetails vnodeDetails;
- if (!ModeMaskMatch(vnode->modeBits)) {
+ if (!ModeMaskMatch(opt, vnode->modeBits)) {
continue;
}
for (opr_queue_Scan(scanList, cursor)) {
struct VnodeScanProc *entry = (struct VnodeScanProc *)cursor;
if (entry->proc) {
- (*entry->proc) (&vnodeDetails);
+ (*entry->proc) (opt, &vnodeDetails);
}
}
}
* @return none
*/
void
-PrintVnode(struct VnodeDetails *vdp)
+volinfo_PrintVnode(struct VolInfoOpt *opt, struct VnodeDetails *vdp)
{
#if defined(AFS_NAMEI_ENV)
IHandle_t *ihtmpp;
/* The check for orphaned vnodes is currently limited to non-empty
* vnodes with a parent of zero (and which are not the first entry
* in the index). */
- if (ShowOrphaned && (fileLength == 0 || vnode->parent || !offset))
+ if (opt->showOrphaned && (fileLength == 0 || vnode->parent || !offset))
return;
printf
(long long)offset, vdp->vnodeNumber, vnode->uniquifier,
vnode->dataVersion, vnode->cloned, (afs_uintmax_t) fileLength,
vnode->linkCount, vnode->parent);
- if (DumpInodeNumber)
+ if (opt->dumpInodeNumber)
printf(" inode: %s", PrintInode(NULL, ino));
- if (DumpDate)
+ if (opt->dumpDate)
printf(" ServerModTime: %s", date(vnode->serverModifyTime));
#if defined(AFS_NAMEI_ENV)
- if (PrintFileNames) {
+ if (opt->dumpFileNames) {
IH_INIT(ihtmpp, V_device(vdp->vp), V_parentId(vdp->vp), ino);
namei_HandleToName(&filename, ihtmpp);
#if !defined(AFS_NT40_ENV)
* @return none
*/
static void
-PrintVnodeType(int type)
+volinfo_PrintVnodeType(int type)
{
switch (type) {
case vNull:
* Print the column heading line.
*/
static void
-PrintColumnHeading(void)
+PrintColumnHeading(struct VolInfoOpt *opt)
{
int i;
const char *name;
for (i = 0; i < NumOutputColumns; i++) {
if (i > 0) {
- printf("%s", ColumnDelim);
+ printf("%s", opt->columnDelim);
}
name = ColumnName[OutputColumn[i]].name;
while (*name) {
* @return none
*/
static void
-PrintColumns(struct VnodeDetails *vdp, const char *desc)
+PrintColumns(struct VolInfoOpt *opt, struct VnodeDetails *vdp, const char *desc)
{
int i;
afs_fsize_t length;
for (i = 0; i < NumOutputColumns; i++) {
if (i > 0) {
- printf("%s", ColumnDelim);
+ printf("%s", opt->columnDelim);
}
switch (OutputColumn[i]) {
case col_host:
- printf("%s", Hostname);
+ printf("%s", opt->hostname);
break;
case col_desc:
printf("%s", desc);
break;
case col_path:
if (!vdp->path) {
- LookupPath(vdp);
+ LookupPath(opt, vdp);
}
printf("%s", vdp->path ? vdp->path : PLACEHOLDER);
break;
break;
case col_mcell:
printf("%s",
- (vdp->t == VNODE_U_MOUNT ? vdp->u.mnt.cell : PLACEHOLDER));
+ (vdp->t == VNODE_U_MOUNT && vdp->u.mnt.cell ? vdp->u.mnt.cell : PLACEHOLDER));
break;
case col_mvol:
printf("%s",
}
break;
case col_vntype:
- PrintVnodeType(vdp->vnode->type);
+ volinfo_PrintVnodeType(vdp->vnode->type);
break;
case col_cloned:
printf("%c", vdp->vnode->cloned ? 'y' : 'n');