aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-09-04 19:00:37 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-09-06 15:25:09 +0200
commit918e92d71b38306a6bf4fedfd1109367f1425587 (patch)
tree23ff0146337dfd61890e22623fd3d19f14752d16 /block.c
parentf5f7abcfd50bca38ae278a9c7a3ed60fba3d76dc (diff)
block: add default get_block_status implementation for protocols
Protocols return raw data, so you can assume the offsets to pass through unchanged. 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.c')
-rw-r--r--block.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block.c b/block.c
index 82bbd6c933..3c39769c68 100644
--- a/block.c
+++ b/block.c
@@ -3094,7 +3094,11 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
if (!bs->drv->bdrv_co_get_block_status) {
*pnum = nb_sectors;
- return BDRV_BLOCK_DATA;
+ ret = BDRV_BLOCK_DATA;
+ if (bs->drv->protocol_name) {
+ ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE);
+ }
+ return ret;
}
ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum);