@@ -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);
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(-)