btrfs-progs: image: use common message helpers

Usage errors are turned to normal errors.

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2016-09-30 13:00:24 +02:00
parent b2fbec8be1
commit f446c027ca
1 changed files with 9 additions and 12 deletions

View File

@ -312,7 +312,7 @@ static u64 logical_to_physical(struct mdrestore_struct *mdres, u64 logical,
entry = tree_search(&mdres->chunk_tree, &search.l, chunk_cmp, 1); entry = tree_search(&mdres->chunk_tree, &search.l, chunk_cmp, 1);
if (!entry) { if (!entry) {
if (mdres->in != stdin) if (mdres->in != stdin)
printf("Couldn't find a chunk, using logical\n"); warning("cannot find a chunk, using logical");
return logical; return logical;
} }
fs_chunk = rb_entry(entry, struct fs_chunk, l); fs_chunk = rb_entry(entry, struct fs_chunk, l);
@ -2390,9 +2390,8 @@ static void remap_overlapping_chunks(struct mdrestore_struct *mdres)
list_del_init(&fs_chunk->list); list_del_init(&fs_chunk->list);
if (range_contains_super(fs_chunk->physical, if (range_contains_super(fs_chunk->physical,
fs_chunk->bytes)) { fs_chunk->bytes)) {
printf("remapping a chunk that had a super " warning(
"mirror inside of it, clearing space cache " "remapping a chunk that had a super mirror inside of it, clearing space cache so we don't end up with corruption");
"so we don't end up with corruption\n");
mdres->clear_space_cache = 1; mdres->clear_space_cache = 1;
} }
fs_chunk->physical = mdres->last_physical_offset; fs_chunk->physical = mdres->last_physical_offset;
@ -2803,24 +2802,22 @@ int main(int argc, char *argv[])
if (create) { if (create) {
if (old_restore) { if (old_restore) {
fprintf(stderr, error(
"Usage error: create and restore cannot be used at the same time\n"); "create and restore cannot be used at the same time");
usage_error++; usage_error++;
} }
} else { } else {
if (walk_trees || sanitize || compress_level) { if (walk_trees || sanitize || compress_level) {
fprintf(stderr, error(
"Usage error: use -w, -s, -c options for restore makes no sense\n"); "useing -w, -s, -c options for restore makes no sense");
usage_error++; usage_error++;
} }
if (multi_devices && dev_cnt < 2) { if (multi_devices && dev_cnt < 2) {
fprintf(stderr, error("not enough devices specified for -m option");
"Usage error: not enough devices specified for -m option\n");
usage_error++; usage_error++;
} }
if (!multi_devices && dev_cnt != 1) { if (!multi_devices && dev_cnt != 1) {
fprintf(stderr, error("accepts only 1 device without -m option");
"Usage error: accepts only 1 device without -m option\n");
usage_error++; usage_error++;
} }
} }