summaryrefslogtreecommitdiff
path: root/block/vmdk.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-09-04 19:00:30 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-09-06 15:25:09 +0200
commit4bc74be997a72922170f4f272fd5e8074a3ecc27 (patch)
treec3b466014f752398a8b9543e99da0651bb12c759 /block/vmdk.c
parent4333bb71405f58a8dc8d3255feb3ca5960b0daf8 (diff)
downloadqemu-4bc74be997a72922170f4f272fd5e8074a3ecc27.tar.gz
qemu-4bc74be997a72922170f4f272fd5e8074a3ecc27.tar.bz2
qemu-4bc74be997a72922170f4f272fd5e8074a3ecc27.zip
block: return get_block_status data and flags for formats
Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/vmdk.c')
-rw-r--r--block/vmdk.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index 23b4954258..fb5b5297ce 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1059,7 +1059,24 @@ static int64_t coroutine_fn vmdk_co_get_block_status(BlockDriverState *bs,
sector_num * 512, 0, &offset);
qemu_co_mutex_unlock(&s->lock);
- ret = (ret == VMDK_OK || ret == VMDK_ZEROED);
+ switch (ret) {
+ case VMDK_ERROR:
+ ret = -EIO;
+ break;
+ case VMDK_UNALLOC:
+ ret = 0;
+ break;
+ case VMDK_ZEROED:
+ ret = BDRV_BLOCK_ZERO;
+ break;
+ case VMDK_OK:
+ ret = BDRV_BLOCK_DATA;
+ if (extent->file == bs->file) {
+ ret |= BDRV_BLOCK_OFFSET_VALID | offset;
+ }
+
+ break;
+ }
index_in_cluster = sector_num % extent->cluster_sectors;
n = extent->cluster_sectors - index_in_cluster;