btrfs-progs: map-logical: use message helpers for error messages
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
972156289e
commit
b959a9a16b
|
@ -391,7 +391,7 @@ int main(int argc, char **argv)
|
||||||
ret = btrfs_find_root_search(fs_info, &filter, &result, &found);
|
ret = btrfs_find_root_search(fs_info, &filter, &result, &found);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
errno = -ret;
|
errno = -ret;
|
||||||
fprintf(stderr, "Fail to search the tree root: %m\n");
|
error("fail to search the tree root: %m");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
|
|
|
@ -182,8 +182,7 @@ static int write_extent_content(struct btrfs_fs_info *fs_info, int out_fd,
|
||||||
mirror);
|
mirror);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
errno = -ret;
|
errno = -ret;
|
||||||
fprintf(stderr,
|
error("failed to read extent at [%llu, %llu]: %m",
|
||||||
"Failed to read extent at [%llu, %llu]: %m\n",
|
|
||||||
logical, logical + length);
|
logical, logical + length);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +191,7 @@ static int write_extent_content(struct btrfs_fs_info *fs_info, int out_fd,
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
ret = -EINTR;
|
ret = -EINTR;
|
||||||
errno = -ret;
|
errno = -ret;
|
||||||
fprintf(stderr, "output file write failed: %m\n");
|
error("output file write failed: %m");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
cur_offset += cur_len;
|
cur_offset += cur_len;
|
||||||
|
@ -270,7 +269,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
root = open_ctree(dev, 0, 0);
|
root = open_ctree(dev, 0, 0);
|
||||||
if (!root) {
|
if (!root) {
|
||||||
fprintf(stderr, "Open ctree failed\n");
|
error("open ctree failed");
|
||||||
free(output_file);
|
free(output_file);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -303,7 +302,7 @@ int main(int argc, char **argv)
|
||||||
ret = map_one_extent(root->fs_info, &cur_logical, &cur_len, 0);
|
ret = map_one_extent(root->fs_info, &cur_logical, &cur_len, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
errno = -ret;
|
errno = -ret;
|
||||||
fprintf(stderr, "Failed to find extent at [%llu,%llu): %m\n",
|
error("failed to find extent at [%llu,%llu): %m",
|
||||||
cur_logical, cur_logical + cur_len);
|
cur_logical, cur_logical + cur_len);
|
||||||
goto out_close_fd;
|
goto out_close_fd;
|
||||||
}
|
}
|
||||||
|
@ -316,14 +315,12 @@ int main(int argc, char **argv)
|
||||||
ret = map_one_extent(root->fs_info, &cur_logical, &cur_len, 1);
|
ret = map_one_extent(root->fs_info, &cur_logical, &cur_len, 1);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
errno = -ret;
|
errno = -ret;
|
||||||
fprintf(stderr,
|
error("Failed to find extent at [%llu,%llu): %m",
|
||||||
"Failed to find extent at [%llu,%llu): %m\n",
|
|
||||||
cur_logical, cur_logical + cur_len);
|
cur_logical, cur_logical + cur_len);
|
||||||
goto out_close_fd;
|
goto out_close_fd;
|
||||||
}
|
}
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
fprintf(stderr,
|
error("failed to find any extent at [%llu,%llu)",
|
||||||
"Failed to find any extent at [%llu,%llu)\n",
|
|
||||||
cur_logical, cur_logical + cur_len);
|
cur_logical, cur_logical + cur_len);
|
||||||
goto out_close_fd;
|
goto out_close_fd;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +360,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
fprintf(stderr, "No extent found at range [%llu,%llu)\n",
|
error("no extent found at range [%llu,%llu)",
|
||||||
logical, logical + bytes);
|
logical, logical + bytes);
|
||||||
}
|
}
|
||||||
out_close_fd:
|
out_close_fd:
|
||||||
|
|
Loading…
Reference in New Issue