@@ -37,9 +37,10 @@ const char * const cmd_rescue_chunk_recover_usage[] = {
"btrfs rescue chunk-recover [options] <device>",
"Recover the chunk tree by scanning the devices one by one.",
"",
- "-y Assume an answer of `yes' to all questions",
- "-v Verbose mode",
- "-h Help",
+ HELPINFO_EXTRA_DEV,
+ "-y Assume an answer of `yes' to all questions",
+ "-v Verbose mode",
+ "-h Help",
NULL
};
@@ -47,8 +48,9 @@ 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",
+ HELPINFO_EXTRA_DEV,
+ "-y Assume an answer of `yes' to all questions",
+ "-v Verbose mode",
NULL
};
@@ -59,6 +61,9 @@ int cmd_rescue_chunk_recover(int argc, char *argv[])
int yes = 0;
int verbose = 0;
+ if (set_extra_dev_from_arg(&argc, argv))
+ usage(cmd_rescue_chunk_recover_usage);
+
while (1) {
int c = getopt(argc, argv, "yvh");
if (c < 0)
@@ -119,6 +124,9 @@ int cmd_rescue_super_recover(int argc, char **argv)
int yes = 0;
char *dname;
+ if (set_extra_dev_from_arg(&argc, argv))
+ usage(cmd_rescue_super_recover_usage);
+
while (1) {
int c = getopt(argc, argv, "vy");
if (c < 0)
@@ -153,9 +161,10 @@ int cmd_rescue_super_recover(int argc, char **argv)
}
const char * const cmd_rescue_zero_log_usage[] = {
- "btrfs rescue zero-log <device>",
+ "btrfs rescue zero-log [options] <device>",
"Clear the tree log. Usable if it's corrupted and prevents mount.",
"",
+ HELPINFO_EXTRA_DEV,
NULL
};
@@ -167,6 +176,9 @@ int cmd_rescue_zero_log(int argc, char **argv)
char *devname;
int ret;
+ if (set_extra_dev_from_arg(&argc, argv))
+ usage(cmd_rescue_zero_log_usage);
+
if (check_argc_exact(argc, 2))
usage(cmd_rescue_zero_log_usage);
Make following command support --extra-dev: btrfs rescue chunk-recover btrfs rescue super-recover btrfs rescue zero-log Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> --- cmds-rescue.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)