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 148da7ea9d, make the function return
0/-errno and return the allocated cluster offset in a by-reference
parameter.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Kevin Wolf 2019-02-27 10:26:24 +01:00
parent c6d619cc12
commit 77e023ff79
4 changed files with 26 additions and 30 deletions

View file

@ -38,7 +38,7 @@ wrote 2097152/2097152 bytes at offset 37748736
No errors were found on the image.
image size 39845888
== Trying to write compressed cluster ==
write failed: Input/output error
write failed: File too large
image size 562949957615616
== Writing normal cluster ==
wrote 2097152/2097152 bytes at offset 0