mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
block: Add errp to b{lk,drv}_truncate()
For one thing, this allows us to drop the error message generation from qemu-img.c and blockdev.c and instead have it unified in bdrv_truncate(). Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20170328205129.15138-3-mreitz@redhat.com Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
55b9392b98
commit
ed3d2ec98a
22 changed files with 73 additions and 90 deletions
17
qemu-img.c
17
qemu-img.c
|
@ -3464,20 +3464,11 @@ static int img_resize(int argc, char **argv)
|
|||
goto out;
|
||||
}
|
||||
|
||||
ret = blk_truncate(blk, total_size);
|
||||
switch (ret) {
|
||||
case 0:
|
||||
ret = blk_truncate(blk, total_size, &err);
|
||||
if (!ret) {
|
||||
qprintf(quiet, "Image resized.\n");
|
||||
break;
|
||||
case -ENOTSUP:
|
||||
error_report("This image does not support resize");
|
||||
break;
|
||||
case -EACCES:
|
||||
error_report("Image is read-only");
|
||||
break;
|
||||
default:
|
||||
error_report("Error resizing image: %s", strerror(-ret));
|
||||
break;
|
||||
} else {
|
||||
error_report_err(err);
|
||||
}
|
||||
out:
|
||||
blk_unref(blk);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue