From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2MTG-0004Yk-8i for qemu-devel@nongnu.org; Thu, 25 Jul 2013 10:24:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2MTE-00081H-TX for qemu-devel@nongnu.org; Thu, 25 Jul 2013 10:24:46 -0400 Received: from mail-gh0-x236.google.com ([2607:f8b0:4002:c05::236]:51833) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2MTE-00081B-Q4 for qemu-devel@nongnu.org; Thu, 25 Jul 2013 10:24:44 -0400 Received: by mail-gh0-f182.google.com with SMTP id z15so489817ghb.41 for ; Thu, 25 Jul 2013 07:24:44 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 25 Jul 2013 16:23:16 +0200 Message-Id: <1374762197-7261-19-git-send-email-pbonzini@redhat.com> In-Reply-To: <1374762197-7261-1-git-send-email-pbonzini@redhat.com> References: <1374762197-7261-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v3 18/19] block: add default get_block_status implementation for protocols List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pl@kamp.de, stefanha@redhat.com Protocols return raw data, so you can assume the offsets to pass through unchanged. Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index fc1da56..8738937 100644 --- a/block.c +++ b/block.c @@ -3005,7 +3005,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.8.3.1