[PATCH 2/5] btrfs-progs: Support extra-dev for btrfs rescue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make following command support --extra-dev:
 btrfs rescue chunk-recover
 btrfs rescue super-recover
 btrfs rescue zero-log

Signed-off-by: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>
---
 cmds-rescue.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/cmds-rescue.c b/cmds-rescue.c
index dd7c01e..163d0bb 100644
--- a/cmds-rescue.c
+++ b/cmds-rescue.c
@@ -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);
 
-- 
1.8.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux