summaryrefslogtreecommitdiff
path: root/btrfs-convert.c
diff options
context:
space:
mode:
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>2014-08-07 10:35:57 +0800
committerDavid Sterba <dsterba@suse.cz>2014-08-22 15:07:04 +0200
commit2b2337830c6bfa2f3dc15bab3ca04ed2a5cc7a25 (patch)
tree007e2a200083686b3ceffe8d7740194aafc35476 /btrfs-convert.c
parentc2d83207bf964e6c0624ce870a01ac1b13ab165b (diff)
btrfs-progs: check option conflict for btrfs-convert
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> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'btrfs-convert.c')
-rw-r--r--btrfs-convert.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/btrfs-convert.c b/btrfs-convert.c
index 952e3e6f..b30b91b3 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,17 @@ int main(int argc, char *argv[])
return 1;
}
+ if (rollback && (!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) {