@@ -226,8 +226,7 @@ static void recover_err_str(int ret)
}
}
-int btrfs_recover_superblocks(const char *dname,
- int verbose, int yes)
+int btrfs_recover_superblocks(const char *dname, int yes)
{
int fd, ret;
struct btrfs_recover_superblock recover;
@@ -249,7 +248,7 @@ int btrfs_recover_superblocks(const char *dname,
goto no_recover;
}
- if (verbose)
+ if (bconf.verbose > BTRFS_BCONF_QUIET)
print_all_devices(&recover.fs_devices->devices);
ret = read_fs_supers(&recover);
@@ -257,7 +256,7 @@ int btrfs_recover_superblocks(const char *dname,
ret = 1;
goto no_recover;
}
- if (verbose) {
+ if (bconf.verbose > BTRFS_BCONF_QUIET) {
printf("Before Recovering:\n");
print_all_supers(&recover);
}
@@ -107,6 +107,8 @@ static const char * const cmd_rescue_super_recover_usage[] = {
"",
"-y Assume an answer of `yes' to all questions",
"-v Verbose mode",
+ HELPINFO_INSERT_GLOBALS,
+ HELPINFO_INSERT_VERBOSE,
NULL
};
@@ -122,7 +124,6 @@ static int cmd_rescue_super_recover(const struct cmd_struct *cmd,
int argc, char **argv)
{
int ret;
- int verbose = 0;
int yes = 0;
char *dname;
@@ -133,7 +134,7 @@ static int cmd_rescue_super_recover(const struct cmd_struct *cmd,
break;
switch (c) {
case 'v':
- verbose = 1;
+ bconf_be_verbose();
break;
case 'y':
yes = 1;
@@ -155,7 +156,7 @@ static int cmd_rescue_super_recover(const struct cmd_struct *cmd,
error("the device is busy");
return 1;
}
- ret = btrfs_recover_superblocks(dname, verbose, yes);
+ ret = btrfs_recover_superblocks(dname, yes);
return ret;
}
static DEFINE_SIMPLE_COMMAND(rescue_super_recover, "super-recover");
@@ -15,7 +15,7 @@
#ifndef __BTRFS_RESCUE_H__
#define __BTRFS_RESCUE_H__
-int btrfs_recover_superblocks(const char *path, int verbose, int yes);
+int btrfs_recover_superblocks(const char *path, int yes);
int btrfs_recover_chunk_tree(const char *path, int yes);
#endif
Transpire global --verbose option down to the btrfs rescue super-recover sub-command. For example: Both global and local verbose options are now supported. btrfs -v|--verbose rescue super-recover btrfs rescue super-recover -v Suggested-by: David Sterba <dsterba@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com> --- v2: Use new helper functions and defines HELPINFO_INSERT_GLOBALS, BTRFS_BCONF_UNSET, BTRFS_BCONF_QUIET bconf_be_verbose(), bconf_be_quiet() Drop verbose argument in btrfs_recover_superblocks() cmds/rescue-super-recover.c | 7 +++---- cmds/rescue.c | 7 ++++--- cmds/rescue.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)