diff options
author | Kevin Wolf <kwolf@redhat.com> | 2019-01-18 14:40:36 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2019-03-08 12:26:45 +0100 |
commit | c6d619cc12813acb2b1198f28cf2256ea9a30107 (patch) | |
tree | ba8aed5c59a1a2b39eafc37750d3c82dd6f6e259 /block/qcow2.h | |
parent | b8c8353a38296fbb92e05a2843e853c1ddfc2674 (diff) | |
download | qemu-c6d619cc12813acb2b1198f28cf2256ea9a30107.zip qemu-c6d619cc12813acb2b1198f28cf2256ea9a30107.tar.gz qemu-c6d619cc12813acb2b1198f28cf2256ea9a30107.tar.bz2 |
qcow2: Don't assume 0 is an invalid cluster offset
The cluster allocation code uses 0 as an invalid offset that is used in
case of errors or as "offset not yet determined". With external data
files, a host cluster offset of 0 becomes valid, though.
Define a constant INV_OFFSET (which is not cluster aligned and will
therefore never be a valid offset) that can be used for such purposes.
This removes the additional host_offset == 0 check that commit
ff52aab2df5 introduced; the confusion between an invalid offset and
(erroneous) allocation at offset 0 is removed with this change.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2.h')
-rw-r--r-- | block/qcow2.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/block/qcow2.h b/block/qcow2.h index 8fe2d55..e3bf322 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -463,6 +463,8 @@ typedef enum QCow2MetadataOverlap { #define REFT_OFFSET_MASK 0xfffffffffffffe00ULL +#define INV_OFFSET (-1ULL) + static inline bool has_data_file(BlockDriverState *bs) { BDRVQcow2State *s = bs->opaque; |