[PATCH 4/5] btrfs-progs: add help command to btrfs rescue zero-log

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

 



To make it unified with other two rescue command, which support
--help option.

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

diff --git a/cmds-rescue.c b/cmds-rescue.c
index a709e1b..3ed63f6 100644
--- a/cmds-rescue.c
+++ b/cmds-rescue.c
@@ -165,6 +165,7 @@ const char * const cmd_rescue_zero_log_usage[] = {
 	"Clear the tree log. Usable if it's corrupted and prevents mount.",
 	"",
 	HELPINFO_EXTRA_DEV,
+	"-h                 Help",
 	NULL
 };
 
@@ -179,10 +180,22 @@ int cmd_rescue_zero_log(int argc, char **argv)
 	if (set_extra_dev_from_arg(&argc, argv))
 		usage(cmd_rescue_zero_log_usage);
 
-	if (check_argc_exact(argc, 2))
+	while (1) {
+		int c = getopt(argc, argv, "h");
+
+		if (c < 0)
+			break;
+		switch (c) {
+		case 'h':
+		default:
+			usage(cmd_rescue_zero_log_usage);
+		}
+	}
+
+	if (check_argc_exact(argc - optind, 1))
 		usage(cmd_rescue_zero_log_usage);
 
-	devname = argv[1];
+	devname = argv[optind];
 	ret = check_mounted(devname);
 	if (ret < 0) {
 		fprintf(stderr, "Could not check mount status: %s\n", strerror(-ret));
-- 
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