@@ -139,6 +139,7 @@ at 'path', ie. all hardlinks
+
-v::::
verbose mode, print count of returned paths and ioctl() return value
+This option is merged to the global verbose option
*logical-resolve* [-Pvo] [-s <bufsize>] <logical> <path>::
(needs root privileges)
@@ -56,12 +56,11 @@ static int __ino_to_path_fd(u64 inum, int fd, int verbose, const char *prepend)
goto out;
}
- if (verbose)
- printf("ioctl ret=%d, bytes_left=%lu, bytes_missing=%lu, "
- "cnt=%d, missed=%d\n", ret,
- (unsigned long)fspath->bytes_left,
- (unsigned long)fspath->bytes_missing,
- fspath->elem_cnt, fspath->elem_missed);
+ pr_verbose(1,
+ "ioctl ret=%d, bytes_left=%lu, bytes_missing=%lu cnt=%d, missed=%d\n",
+ ret, (unsigned long)fspath->bytes_left,
+ (unsigned long)fspath->bytes_missing, fspath->elem_cnt,
+ fspath->elem_missed);
for (i = 0; i < fspath->elem_cnt; ++i) {
u64 ptr;
@@ -83,7 +82,9 @@ static const char * const cmd_inspect_inode_resolve_usage[] = {
"btrfs inspect-internal inode-resolve [-v] <inode> <path>",
"Get file system paths for the given inode",
"",
- "-v verbose mode",
+ "-v verbose mode. This option is merged to the global verbose option",
+ HELPINFO_INSERT_GLOBALS,
+ HELPINFO_INSERT_VERBOSE,
NULL
};
@@ -91,7 +92,6 @@ static int cmd_inspect_inode_resolve(const struct cmd_struct *cmd,
int argc, char **argv)
{
int fd;
- int verbose = 0;
int ret;
DIR *dirstream = NULL;
@@ -103,7 +103,7 @@ static int cmd_inspect_inode_resolve(const struct cmd_struct *cmd,
switch (c) {
case 'v':
- verbose = 1;
+ bconf_be_verbose();
break;
default:
usage_unknown_option(cmd, argv);
@@ -117,8 +117,8 @@ static int cmd_inspect_inode_resolve(const struct cmd_struct *cmd,
if (fd < 0)
return 1;
- ret = __ino_to_path_fd(arg_strtou64(argv[optind]), fd, verbose,
- argv[optind+1]);
+ ret = __ino_to_path_fd(arg_strtou64(argv[optind]), fd,
+ bconf.verbose, argv[optind+1]);
close_file_or_dir(fd, dirstream);
return !!ret;
Transpire global --verbose option down to the btrfs inspect-internal inode-resolve sub-command. Suggested-by: David Sterba <dsterba@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com> --- v3: update help and documentation v2: Use new helper functions and defines HELPINFO_INSERT_GLOBALS, BTRFS_BCONF_UNSET, BTRFS_BCONF_QUIET bconf_be_verbose(), bconf_be_quiet() Documentation/btrfs-inspect-internal.asciidoc | 1 + cmds/inspect.c | 22 +++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-)