From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz88z-0002EL-AN for qemu-devel@nongnu.org; Tue, 16 Jul 2013 12:30:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uz88x-0006CK-L8 for qemu-devel@nongnu.org; Tue, 16 Jul 2013 12:30:29 -0400 Received: from mail-qc0-x22e.google.com ([2607:f8b0:400d:c01::22e]:58562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz88x-0006CE-GJ for qemu-devel@nongnu.org; Tue, 16 Jul 2013 12:30:27 -0400 Received: by mail-qc0-f174.google.com with SMTP id m15so491419qcq.5 for ; Tue, 16 Jul 2013 09:30:27 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 16 Jul 2013 18:29:27 +0200 Message-Id: <1373992168-26043-17-git-send-email-pbonzini@redhat.com> In-Reply-To: <1373992168-26043-1-git-send-email-pbonzini@redhat.com> References: <1373992168-26043-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v2 16/17] 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: pl@kamp.de, famz@redhat.com, stefanha@redhat.com Protocols return raw data, so you can assume the offsets to pass through unchanged. Signed-off-by: Paolo Bonzini --- block.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 0c867b8..557ce29 100644 --- a/block.c +++ b/block.c @@ -2991,7 +2991,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