linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: deal with conflict options for btrfs fi show
@ 2014-09-11  5:19 Gui Hecheng
  2014-09-12  1:15 ` [PATCH v2] " Gui Hecheng
  0 siblings, 1 reply; 4+ messages in thread
From: Gui Hecheng @ 2014-09-11  5:19 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Gui Hecheng

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


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

end of thread, other threads:[~2014-09-12  8:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11  5:19 [PATCH] btrfs-progs: deal with conflict options for btrfs fi show Gui Hecheng
2014-09-12  1:15 ` [PATCH v2] " Gui Hecheng
2014-09-12  5:56   ` Satoru Takeuchi
2014-09-12  8:33     ` Gui Hecheng

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).