summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2014-05-06 15:25:36 +0200
committerKevin Wolf <kwolf@redhat.com>2014-05-19 11:36:48 +0200
commite88ae2264d93f98e4b656fa76555c745abe57684 (patch)
tree43c4370b441d90d8693c796ed6dde0b8c1525ed6 /include
parent1a381811b495651ddfc2b50d7c8cfaaf375816b0 (diff)
downloadhqemu-e88ae2264d93f98e4b656fa76555c745abe57684.zip
hqemu-e88ae2264d93f98e4b656fa76555c745abe57684.tar.gz
block: Fix bdrv_is_allocated() for short backing files
bdrv_is_allocated() shouldn't return true for sectors that are unallocated, but after the end of a short backing file, even though such sectors are (correctly) marked as containing zeros. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/block.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/block/block.h b/include/block/block.h
index 1b119aa..59be83f 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -120,6 +120,8 @@ typedef enum {
/* BDRV_BLOCK_DATA: data is read from bs->file or another file
* BDRV_BLOCK_ZERO: sectors read as zero
* BDRV_BLOCK_OFFSET_VALID: sector stored in bs->file as raw data
+ * BDRV_BLOCK_ALLOCATED: the content of the block is determined by this
+ * layer (as opposed to the backing file)
* BDRV_BLOCK_RAW: used internally to indicate that the request
* was answered by the raw driver and that one
* should look in bs->file directly.
@@ -141,10 +143,11 @@ typedef enum {
* f t f not allocated or unknown offset, read as zero
* f f f not allocated or unknown offset, read from backing_hd
*/
-#define BDRV_BLOCK_DATA 1
-#define BDRV_BLOCK_ZERO 2
-#define BDRV_BLOCK_OFFSET_VALID 4
-#define BDRV_BLOCK_RAW 8
+#define BDRV_BLOCK_DATA 0x01
+#define BDRV_BLOCK_ZERO 0x02
+#define BDRV_BLOCK_OFFSET_VALID 0x04
+#define BDRV_BLOCK_RAW 0x08
+#define BDRV_BLOCK_ALLOCATED 0x10
#define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK
typedef enum {
OpenPOWER on IntegriCloud