mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-22 06:10:06 +00:00
btrfs-progs: super-recover: add global verbose option
Propagate global --verbose option down to the btrfs rescue super-recover subcommand. Both global and local verbose options are now supported: btrfs -v rescue super-recover btrfs rescue super-recover -v Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
968721ad77
commit
7c3b845f9d
@ -226,8 +226,7 @@ static void recover_err_str(int ret)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_recover_superblocks(const char *dname,
|
int btrfs_recover_superblocks(const char *dname, int yes)
|
||||||
int verbose, int yes)
|
|
||||||
{
|
{
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
struct btrfs_recover_superblock recover;
|
struct btrfs_recover_superblock recover;
|
||||||
@ -249,7 +248,7 @@ int btrfs_recover_superblocks(const char *dname,
|
|||||||
goto no_recover;
|
goto no_recover;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose)
|
if (bconf.verbose > BTRFS_BCONF_QUIET)
|
||||||
print_all_devices(&recover.fs_devices->devices);
|
print_all_devices(&recover.fs_devices->devices);
|
||||||
|
|
||||||
ret = read_fs_supers(&recover);
|
ret = read_fs_supers(&recover);
|
||||||
@ -257,7 +256,7 @@ int btrfs_recover_superblocks(const char *dname,
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
goto no_recover;
|
goto no_recover;
|
||||||
}
|
}
|
||||||
if (verbose) {
|
if (bconf.verbose > BTRFS_BCONF_QUIET) {
|
||||||
printf("Before Recovering:\n");
|
printf("Before Recovering:\n");
|
||||||
print_all_supers(&recover);
|
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",
|
"-y Assume an answer of `yes' to all questions",
|
||||||
"-v Verbose mode",
|
"-v Verbose mode",
|
||||||
|
HELPINFO_INSERT_GLOBALS,
|
||||||
|
HELPINFO_INSERT_VERBOSE,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -122,7 +124,6 @@ static int cmd_rescue_super_recover(const struct cmd_struct *cmd,
|
|||||||
int argc, char **argv)
|
int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int verbose = 0;
|
|
||||||
int yes = 0;
|
int yes = 0;
|
||||||
char *dname;
|
char *dname;
|
||||||
|
|
||||||
@ -133,7 +134,7 @@ static int cmd_rescue_super_recover(const struct cmd_struct *cmd,
|
|||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = 1;
|
bconf_be_verbose();
|
||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
yes = 1;
|
yes = 1;
|
||||||
@ -155,7 +156,7 @@ static int cmd_rescue_super_recover(const struct cmd_struct *cmd,
|
|||||||
error("the device is busy");
|
error("the device is busy");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ret = btrfs_recover_superblocks(dname, verbose, yes);
|
ret = btrfs_recover_superblocks(dname, yes);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
static DEFINE_SIMPLE_COMMAND(rescue_super_recover, "super-recover");
|
static DEFINE_SIMPLE_COMMAND(rescue_super_recover, "super-recover");
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef __BTRFS_RESCUE_H__
|
#ifndef __BTRFS_RESCUE_H__
|
||||||
#define __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);
|
int btrfs_recover_chunk_tree(const char *path, int yes);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user