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 /block/block-backend.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 'block/block-backend.c')
-rw-r--r-- | block/block-backend.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/block/block-backend.c b/block/block-backend.c index ae3d7713ce..f5bf13eec9 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1746,13 +1746,14 @@ int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *buf, BDRV_REQ_WRITE_COMPRESSED); } -int blk_truncate(BlockBackend *blk, int64_t offset) +int blk_truncate(BlockBackend *blk, int64_t offset, Error **errp) { if (!blk_is_available(blk)) { + error_setg(errp, "No medium inserted"); return -ENOMEDIUM; } - return bdrv_truncate(blk->root, offset); + return bdrv_truncate(blk->root, offset, errp); } static void blk_pdiscard_entry(void *opaque) |