diff options
author | Max Reitz <mreitz@redhat.com> | 2017-03-28 22:51:27 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2017-04-28 16:02:02 +0200 |
commit | ed3d2ec98a33fbdeabc471b11ff807075f07e996 (patch) | |
tree | d76333098ab7b42da2dbae9075bc32ba9d0e2263 /blockdev.c | |
parent | 55b9392b98e500399f2da1edc1d110bbfd40fb05 (diff) |
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>
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/blockdev.c b/blockdev.c index 64282065d8..4d8cdedd54 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2930,26 +2930,7 @@ void qmp_block_resize(bool has_device, const char *device, /* complete all in-flight operations before resizing the device */ bdrv_drain_all(); - ret = blk_truncate(blk, size); - switch (ret) { - case 0: - break; - case -ENOMEDIUM: - error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); - break; - case -ENOTSUP: - error_setg(errp, QERR_UNSUPPORTED); - break; - case -EACCES: - error_setg(errp, "Device '%s' is read only", device); - break; - case -EBUSY: - error_setg(errp, QERR_DEVICE_IN_USE, device); - break; - default: - error_setg_errno(errp, -ret, "Could not resize"); - break; - } + ret = blk_truncate(blk, size, errp); out: blk_unref(blk); |