From c76f542bada1e7036f5961cf71b3697d633e00ad Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Paolo Bonzini Date: Fri, 6 Sep 2013 18:12:44 +0200 Subject: [PATCH 24/25] 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 Signed-off-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi (cherry picked from commit 918e92d71b38306a6bf4fedfd1109367f1425587) Signed-off-by: Michal Novotny --- block.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 2306994..9ca164d 100644 --- a/block.c +++ b/block.c @@ -2769,7 +2769,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); -- 1.7.11.7