btrfs-progs: cmd rescue: switch to common error message wrapper
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
b98ad87a03
commit
6bc6e850ee
|
@ -84,22 +84,21 @@ static int cmd_rescue_chunk_recover(int argc, char *argv[])
|
||||||
|
|
||||||
ret = check_mounted(file);
|
ret = check_mounted(file);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Could not check mount status: %s\n",
|
error("could not check mount status: %s", strerror(-ret));
|
||||||
strerror(-ret));
|
|
||||||
return 1;
|
return 1;
|
||||||
} else if (ret) {
|
} else if (ret) {
|
||||||
fprintf(stderr, "the device is busy\n");
|
error("the device is busy");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = btrfs_recover_chunk_tree(file, verbose, yes);
|
ret = btrfs_recover_chunk_tree(file, verbose, yes);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
fprintf(stdout, "Recover the chunk tree successfully.\n");
|
fprintf(stdout, "Chunk tree recovered successfully\n");
|
||||||
} else if (ret > 0) {
|
} else if (ret > 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
fprintf(stdout, "Abort to rebuild the on-disk chunk tree.\n");
|
fprintf(stdout, "Chunk tree recovery aborted\n");
|
||||||
} else {
|
} else {
|
||||||
fprintf(stdout, "Fail to recover the chunk tree.\n");
|
fprintf(stdout, "Chunk tree recovery failed\n");
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -141,11 +140,10 @@ static int cmd_rescue_super_recover(int argc, char **argv)
|
||||||
dname = argv[optind];
|
dname = argv[optind];
|
||||||
ret = check_mounted(dname);
|
ret = check_mounted(dname);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Could not check mount status: %s\n",
|
error("could not check mount status: %s", strerror(-ret));
|
||||||
strerror(-ret));
|
|
||||||
return 1;
|
return 1;
|
||||||
} else if (ret) {
|
} else if (ret) {
|
||||||
fprintf(stderr, "the device is busy\n");
|
error("the device is busy");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ret = btrfs_recover_superblocks(dname, verbose, yes);
|
ret = btrfs_recover_superblocks(dname, verbose, yes);
|
||||||
|
@ -173,16 +171,16 @@ static int cmd_rescue_zero_log(int argc, char **argv)
|
||||||
devname = argv[optind];
|
devname = argv[optind];
|
||||||
ret = check_mounted(devname);
|
ret = check_mounted(devname);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Could not check mount status: %s\n", strerror(-ret));
|
error("could not check mount status: %s", strerror(-ret));
|
||||||
goto out;
|
goto out;
|
||||||
} else if (ret) {
|
} else if (ret) {
|
||||||
fprintf(stderr, "%s is currently mounted. Aborting.\n", devname);
|
error("%s is currently mounted", devname);
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
root = open_ctree(devname, 0, OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL);
|
root = open_ctree(devname, 0, OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL);
|
||||||
if (!root) {
|
if (!root) {
|
||||||
fprintf(stderr, "Could not open ctree\n");
|
error("could not open ctree");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue