diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-09-04 19:00:30 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-09-06 15:25:09 +0200 |
commit | 4bc74be997a72922170f4f272fd5e8074a3ecc27 (patch) | |
tree | c3b466014f752398a8b9543e99da0651bb12c759 /block/vmdk.c | |
parent | 4333bb71405f58a8dc8d3255feb3ca5960b0daf8 (diff) |
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.c | 19 |
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; |