From 251d397870d2563f7f76325fa0792dbacfe631c1 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 22 Feb 2023 01:37:18 +0100 Subject: [PATCH] btrfs-progs: inspect-internal: convert help text to option formatter Signed-off-by: David Sterba --- cmds/inspect-dump-super.c | 19 +++++++++---------- cmds/inspect-dump-tree.c | 29 ++++++++++++++--------------- cmds/inspect-tree-stats.c | 2 +- cmds/inspect.c | 32 +++++++++++++++----------------- 4 files changed, 39 insertions(+), 43 deletions(-) diff --git a/cmds/inspect-dump-super.c b/cmds/inspect-dump-super.c index 414c6e04..d62c3a85 100644 --- a/cmds/inspect-dump-super.c +++ b/cmds/inspect-dump-super.c @@ -60,18 +60,17 @@ static const char * const cmd_inspect_dump_super_usage[] = { "btrfs inspect-internal dump-super [options] device [device...]", "Dump superblock from a device in a textual form", "", - "-f|--full print full superblock information, backup roots etc.", - "-a|--all print information about all superblocks", - "-s|--super specify which copy to print out (values: 0, 1, 2)", - "-F|--force attempt to dump superblocks with bad magic", - "--bytenr specify alternate superblock offset", + OPTLINE("-f|--full", "print full superblock information, backup roots etc."), + OPTLINE("-a|--all", "print information about all superblocks"), + OPTLINE("-s|--super ", "specify which copy to print out (values: 0, 1, 2)"), + OPTLINE("-F|--force", "attempt to dump superblocks with bad magic"), + OPTLINE("--bytenr ", "specify alternate superblock offset"), "", "Deprecated syntax:", - "-s specify alternate superblock offset, values other than 0, 1, 2", - " will be interpreted as --bytenr for backward compatibility,", - " option renamed for consistency with other tools (eg. check)", - "-i specify which copy to print out (values: 0, 1, 2), now moved", - " to -s|--super", + OPTLINE("-s ", "specify alternate superblock offset, values other than 0, 1, 2 " + "will be interpreted as --bytenr for backward compatibility, " + "option renamed for consistency with other tools (eg. check)"), + OPTLINE("-i ", "specify which copy to print out (values: 0, 1, 2), now moved to --super"), NULL }; diff --git a/cmds/inspect-dump-tree.c b/cmds/inspect-dump-tree.c index 8f28779c..4c93056b 100644 --- a/cmds/inspect-dump-tree.c +++ b/cmds/inspect-dump-tree.c @@ -207,21 +207,20 @@ static const char * const cmd_inspect_dump_tree_usage[] = { "Note: contains file names, consider that if you're asked to send the dump", "for analysis.", "", - "-e|--extents print only extent info: extent and device trees", - "-d|--device print only device info: tree root, chunk and device trees", - "-r|--roots print only short root node info", - "-R|--backups same as --roots plus print backup root info", - "-u|--uuid print only the uuid tree", - "-b|--block print info from the specified block only", - " can be specified multiple times", - "-t|--tree print only tree with the given id (string or number)", - "--follow use with -b, to show all children tree blocks of ", - "--noscan do not scan the devices from the filesystem, use only the listed ones", - "--bfs breadth-first traversal of the trees, print nodes, then leaves (default)", - "--dfs depth-first traversal of the trees", - "--hide-names hide filenames/subvolume/xattrs and other name references", - "--csum-headers print node checksums stored in headers (metadata)", - "--csum-items print checksums stored in checksum items (data)", + OPTLINE("-e|--extents", "print only extent info: extent and device trees"), + OPTLINE("-d|--device", "print only device info: tree root, chunk and device trees"), + OPTLINE("-r|--roots", "print only short root node info"), + OPTLINE("-R|--backups", "same as --roots plus print backup root info"), + OPTLINE("-u|--uuid", "print only the uuid tree"), + OPTLINE("-b|--block ", "print info from the specified block only can be specified multiple times"), + OPTLINE("-t|--tree ", "print only tree with the given id (string or number)"), + OPTLINE("--follow", "use with -b, to show all children tree blocks of "), + OPTLINE("--noscan", "do not scan the devices from the filesystem, use only the listed ones"), + OPTLINE("--bfs", "breadth-first traversal of the trees, print nodes, then leaves (default)"), + OPTLINE("--dfs", "depth-first traversal of the trees"), + OPTLINE("--hide-names", "hide filenames/subvolume/xattrs and other name references"), + OPTLINE("--csum-headers", "print node checksums stored in headers (metadata)"), + OPTLINE("--csum-items", "print checksums stored in checksum items (data)"), NULL }; diff --git a/cmds/inspect-tree-stats.c b/cmds/inspect-tree-stats.c index 9ed3dabd..4c6104c1 100644 --- a/cmds/inspect-tree-stats.c +++ b/cmds/inspect-tree-stats.c @@ -434,7 +434,7 @@ static const char * const cmd_inspect_tree_stats_usage[] = { "btrfs inspect-internal tree-stats [options] ", "Print various stats for trees", "", - "-b raw numbers in bytes", + OPTLINE("-b", "raw numbers in bytes"), NULL }; diff --git a/cmds/inspect.c b/cmds/inspect.c index 161fdf80..20f433b9 100644 --- a/cmds/inspect.c +++ b/cmds/inspect.c @@ -94,7 +94,7 @@ static const char * const cmd_inspect_inode_resolve_usage[] = { "btrfs inspect-internal inode-resolve [-v] ", "Get file system paths for the given inode", "", - "-v deprecated, alias for global -v option", + OPTLINE("-v", "deprecated, alias for global -v option"), HELPINFO_INSERT_GLOBALS, HELPINFO_INSERT_VERBOSE, NULL @@ -140,14 +140,13 @@ static const char * const cmd_inspect_logical_resolve_usage[] = { "btrfs inspect-internal logical-resolve [-Pvo] [-s bufsize] ", "Get file system paths for the given logical address", "", - "-P skip the path resolving and print the inodes instead", - "-o ignore offsets when matching references (requires v2 ioctl", - " support in the kernel 4.15+)", - "-s bufsize set inode container's size. This is used to increase inode", - " container's size in case it is not enough to read all the ", - " resolved results. The max value one can set is 64k with the", - " v1 ioctl. Sizes over 64k will use the v2 ioctl (kernel 4.15+)", - "-v deprecated, alias for global -v option", + OPTLINE("-P", "skip the path resolving and print the inodes instead"), + OPTLINE("-o", "ignore offsets when matching references (requires v2 ioctl support in the kernel 4.15+)"), + OPTLINE("-s bufsize", "set inode container's size. This is used to increase inode " + "container's size in case it is not enough to read all the " + "resolved results. The max value one can set is 64k with the " + "v1 ioctl. Sizes over 64k will use the v2 ioctl (kernel 4.15+)"), + OPTLINE("-v", "deprecated, alias for global -v option"), HELPINFO_INSERT_GLOBALS, HELPINFO_INSERT_VERBOSE, NULL @@ -403,7 +402,7 @@ static const char* const cmd_inspect_min_dev_size_usage[] = { "Get the minimum size the device can be shrunk to", "", "The device id 1 is used by default.", - "--id DEVID specify the device id to query", + OPTLINE("--id DEVID", "specify the device id to query"), NULL }; @@ -700,12 +699,11 @@ static const char * const cmd_inspect_list_chunks_usage[] = { "Show chunks (block groups) layout for all devices", "", HELPINFO_UNITS_LONG, - "--sort=MODE sort by the physical or logical chunk start", - " MODE is one of pstart or lstart (default: pstart)", - "--usage show usage per block group (note: this can be slow)", - "--no-usage don't show usage per block group", - "--empty show empty space between block groups", - "--no-empty do not show empty space between block groups", + OPTLINE("--sort MODE", "sort by the physical or logical chunk start MODE is one of pstart or lstart (default: pstart)"), + OPTLINE("--usage", "show usage per block group (note: this can be slow)"), + OPTLINE("--no-usage", "don't show usage per block group"), + OPTLINE("--empty", "show empty space between block groups"), + OPTLINE("--no-empty", "do not show empty space between block groups"), NULL }; @@ -1126,7 +1124,7 @@ static const char * const cmd_inspect_map_swapfile_usage[] = { "Use the value of resume offset for /sys/power/resume_offset, this depends on the", "page size that's detected on this system.", "", - "-r|--resume-offset print only the value of resume_offset", + OPTLINE("-r|--resume-offset", "print only the value of resume_offset"), NULL };