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] btrfs-progs: deal with conflict options for btrfs fi show
Date: Thu, 11 Sep 2014 13:19:11 +0800	[thread overview]
Message-ID: <1410412751-9277-1-git-send-email-guihc.fnst@cn.fujitsu.com> (raw)

For btrfs fi show, -d|--all-devices & -m|--mounted will
overwrite each other, so if specified both, let the user
know that he should not use them at the same time.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
---
 cmds-filesystem.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 69c1ca5..78aeacc 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -526,16 +526,23 @@ static int cmd_show(int argc, char **argv)
 			break;
 		switch (c) {
 		case 'd':
-			where = BTRFS_SCAN_PROC;
+			where &= ~BTRFS_SCAN_LBLKID;
+			where |= BTRFS_SCAN_PROC;
 			break;
 		case 'm':
-			where = BTRFS_SCAN_MOUNTED;
+			where &= ~BTRFS_SCAN_LBLKID;
+			where |= BTRFS_SCAN_MOUNTED;
 			break;
 		default:
 			usage(cmd_show_usage);
 		}
 	}
 
+	if ((where & BTRFS_SCAN_PROC) && (where & BTRFS_SCAN_MOUNTED)) {
+		fprintf(stderr, "don't use -d|--all-devices and -m|--mounted options at the same time\n");
+		usage(cmd_show_usage);
+	}
+
 	if (check_argc_max(argc, optind + 1))
 		usage(cmd_show_usage);
 
-- 
1.8.1.4


             reply	other threads:[~2014-09-11  5:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11  5:19 Gui Hecheng [this message]
2014-09-12  1:15 ` [PATCH v2] btrfs-progs: deal with conflict options for btrfs fi show Gui Hecheng
2014-09-12  5:56   ` Satoru Takeuchi
2014-09-12  8:33     ` Gui Hecheng

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=1410412751-9277-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).