From ed3d2ec98a33fbdeabc471b11ff807075f07e996 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 28 Mar 2017 22:51:27 +0200 Subject: 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 Message-id: 20170328205129.15138-3-mreitz@redhat.com Reviewed-by: Stefan Hajnoczi Signed-off-by: Max Reitz --- block/vhdx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'block/vhdx.c') diff --git a/block/vhdx.c b/block/vhdx.c index d25bcd91de..e8fe3fb5e9 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1171,7 +1171,7 @@ static int vhdx_allocate_block(BlockDriverState *bs, BDRVVHDXState *s, /* per the spec, the address for a block is in units of 1MB */ *new_offset = ROUND_UP(*new_offset, 1024 * 1024); - return bdrv_truncate(bs->file, *new_offset + s->block_size); + return bdrv_truncate(bs->file, *new_offset + s->block_size, NULL); } /* @@ -1607,17 +1607,13 @@ static int vhdx_create_bat(BlockBackend *blk, BDRVVHDXState *s, if (type == VHDX_TYPE_DYNAMIC) { /* All zeroes, so we can just extend the file - the end of the BAT * is the furthest thing we have written yet */ - ret = blk_truncate(blk, data_file_offset); + ret = blk_truncate(blk, data_file_offset, errp); if (ret < 0) { - error_setg_errno(errp, -ret, - "Failed to resize the underlying file"); goto exit; } } else if (type == VHDX_TYPE_FIXED) { - ret = blk_truncate(blk, data_file_offset + image_size); + ret = blk_truncate(blk, data_file_offset + image_size, errp); if (ret < 0) { - error_setg_errno(errp, -ret, - "Failed to resize the underlying file"); goto exit; } } else { -- cgit v1.2.1