linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] btrfs-progs: check option conflict for btrfs-convert
@ 2014-08-07  2:35 Gui Hecheng
  2014-08-07  2:35 ` [PATCH 2/3] btrfs-progs: remove unused parameter in rollback " Gui Hecheng
  2014-08-07  2:35 ` [PATCH 3/3] btrfs-progs: make close_ctree return void Gui Hecheng
  0 siblings, 2 replies; 4+ messages in thread
From: Gui Hecheng @ 2014-08-07  2:35 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Gui Hecheng

The -d, -i, -n options make no sense to rollback.
Check the improper usages such as:
	# btrfs-convert -r -d <dev>

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
---
 btrfs-convert.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/btrfs-convert.c b/btrfs-convert.c
index 952e3e6..2ea6a09 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -2699,6 +2699,7 @@ int main(int argc, char *argv[])
 	int noxattr = 0;
 	int datacsum = 1;
 	int rollback = 0;
+	int usage_error = 0;
 	char *file;
 	while(1) {
 		int c = getopt(argc, argv, "dinr");
@@ -2729,6 +2730,18 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
+	if (rollback) {
+		if (!datacsum || noxattr || !packing) {
+			fprintf(stderr, "Usage error: -d, -i, -n options do not apply to rollback\n");
+			usage_error++;
+		}
+	}
+
+	if (usage_error) {
+		print_usage();
+		return 1;
+	}
+
 	file = argv[optind];
 	ret = check_mounted(file);
 	if (ret < 0) {
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-19 13:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-07  2:35 [PATCH 1/3] btrfs-progs: check option conflict for btrfs-convert Gui Hecheng
2014-08-07  2:35 ` [PATCH 2/3] btrfs-progs: remove unused parameter in rollback " Gui Hecheng
2014-08-07  2:35 ` [PATCH 3/3] btrfs-progs: make close_ctree return void Gui Hecheng
2014-08-19 13:38   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).