[RFC PATCH 08/14] btrfs-progs: migrate rescue super-recover to global verbose

Anand Jain
2019-10-21T10:01:49Z

Now with this patch 'btrfs rescue super-recover' can show verbose output
either by the top level --verbose option or by the sub-command -v
option.

Suggested-by: David Sterba <dsterba@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
cmds/rescue.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/cmds/rescue.c b/cmds/rescue.c
index 1785bc164264..bd11241478a8 100644
--- a/cmds/rescue.c
+++ b/cmds/rescue.c
@@ -101,8 +101,8 @@ static const char * const cmd_rescue_super_recover_usage[] = {
"btrfs rescue super-recover [options] <device>",
"Recover bad superblocks from good copies",
"",
- "-y Assume an answer of `yes' to all questions",
- "-v Verbose mode",
+ "-y Assume an answer of `yes' to all questions",
+ HELPINFO_INSERT_VERBOSE_SHORT,
NULL
};

@@ -118,7 +118,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;

@@ -129,7 +128,7 @@ static int cmd_rescue_super_recover(const struct cmd_struct *cmd,
break;
switch (c) {
case 'v':
- verbose = 1;
+ global_verbose = true;
break;
case 'y':
yes = 1;
@@ -151,7 +150,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, global_verbose, yes);
return ret;
}
static DEFINE_SIMPLE_COMMAND(rescue_super_recover, "super-recover");
--
1.8.3.1