qcow: Change signature of get_cluster_offset()
commit56439e9d55626b65ecb887f1ac3714652555312e
authorEric Blake <eblake@redhat.com>
Wed, 9 Aug 2017 20:38:05 +0000 (9 15:38 -0500)
committerKevin Wolf <kwolf@redhat.com>
Mon, 4 Sep 2017 16:33:00 +0000 (4 18:33 +0200)
tree03e2b0ad124882d070c0648aacd01dfb5e0fcc5a
parentf7cc69b326850c34db5dca2f9f74898cd181f43a
qcow: Change signature of get_cluster_offset()

The old signature has an ambiguous meaning for a return of 0:
either no allocation was requested or necessary, or an error
occurred (but any errno associated with the error is lost to
the caller, which then has to assume EIO).

Better is to follow the example of qcow2, by changing the
signature to have a separate return value that cleanly
distinguishes between failure and success, along with a
parameter that cleanly holds a 64-bit value.  Then update all
callers.

While auditing that all return paths return a negative errno
(rather than -1), I also simplified places where we can pass
NULL rather than a local Error that just gets thrown away.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow.c