linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Subject: [PATCH 1/3] btrfs-progs: check option conflict for btrfs-convert
Date: Thu, 7 Aug 2014 10:35:57 +0800	[thread overview]
Message-ID: <1407378959-23728-1-git-send-email-guihc.fnst@cn.fujitsu.com> (raw)

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


             reply	other threads:[~2014-08-07  2:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07  2:35 Gui Hecheng [this message]
2014-08-07  2:35 ` [PATCH 2/3] btrfs-progs: remove unused parameter in rollback for btrfs-convert 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407378959-23728-1-git-send-email-guihc.fnst@cn.fujitsu.com \
    --to=guihc.fnst@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).