From 77e023ff79222191e8cc3d377504da8f19926837 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 27 Feb 2019 10:26:24 +0100 Subject: qcow2: Return 0/-errno in qcow2_alloc_compressed_cluster_offset() qcow2_alloc_compressed_cluster_offset() used to return the cluster offset for success and 0 for error. This doesn't only conflict with 0 as a valid host offset, but also loses the error code. Similar to the change made to qcow2_alloc_cluster_offset() for uncompressed clusters in commit 148da7ea9d6, make the function return 0/-errno and return the allocated cluster offset in a by-reference parameter. Signed-off-by: Kevin Wolf --- block/qcow2.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'block/qcow2.h') diff --git a/block/qcow2.h b/block/qcow2.h index e3bf322be1..fad6abf602 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -647,9 +647,10 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset, int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, unsigned int *bytes, uint64_t *host_offset, QCowL2Meta **m); -uint64_t qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, - uint64_t offset, - int compressed_size); +int qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, + uint64_t offset, + int compressed_size, + uint64_t *host_offset); int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m); void qcow2_alloc_cluster_abort(BlockDriverState *bs, QCowL2Meta *m); -- cgit v1.2.3