@@ -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_GLOBAL_OPTIONS_HEADER,
+ HELPINFO_INSERT_VERBOSE,
NULL
};
@@ -122,10 +124,13 @@ 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;
+ /* Init global verbose if unset */
+ if (bconf.verbose < 0)
+ bconf.verbose = 0;
+
optind = 0;
while (1) {
int c = getopt(argc, argv, "vy");
@@ -133,7 +138,7 @@ static int cmd_rescue_super_recover(const struct cmd_struct *cmd,
break;
switch (c) {
case 'v':
- verbose = 1;
+ bconf.verbose++;
break;
case 'y':
yes = 1;
@@ -155,7 +160,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, bconf.verbose, yes);
return ret;
}
static DEFINE_SIMPLE_COMMAND(rescue_super_recover, "super-recover");
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> --- cmds/rescue.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)