diff options
author | Max Reitz <mreitz@redhat.com> | 2017-03-28 22:51:29 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2017-04-28 16:02:03 +0200 |
commit | f59adb325618a2d2ba16aece551e7ab6acadb0ae (patch) | |
tree | bf67551473ad370d0b4ce17906c93247246aa622 /block/qed.c | |
parent | 4bff28b81a0ddb48a09d279e99ab847e8a292506 (diff) |
block: Add .bdrv_truncate() error messages
Add missing error messages for the block driver implementations of
.bdrv_truncate(); drop the generic one from block.c's bdrv_truncate().
Since one of these changes touches a mis-indented block in
block/file-posix.c, this patch fixes that coding style issue along the
way.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20170328205129.15138-5-mreitz@redhat.com
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/qed.c')
-rw-r--r-- | block/qed.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/qed.c b/block/qed.c index fa2aeee471..fd76817cbb 100644 --- a/block/qed.c +++ b/block/qed.c @@ -1526,11 +1526,12 @@ static int bdrv_qed_truncate(BlockDriverState *bs, int64_t offset, Error **errp) if (!qed_is_image_size_valid(offset, s->header.cluster_size, s->header.table_size)) { + error_setg(errp, "Invalid image size specified"); return -EINVAL; } - /* Shrinking is currently not supported */ if ((uint64_t)offset < s->header.image_size) { + error_setg(errp, "Shrinking images is currently not supported"); return -ENOTSUP; } @@ -1539,6 +1540,7 @@ static int bdrv_qed_truncate(BlockDriverState *bs, int64_t offset, Error **errp) ret = qed_write_header_sync(s); if (ret < 0) { s->header.image_size = old_image_size; + error_setg_errno(errp, -ret, "Failed to update the image size"); } return ret; } |