From patchwork Sat Feb 20 17:39:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 8367551 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DB65CC0553 for ; Sat, 20 Feb 2016 17:42:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F82A2041F for ; Sat, 20 Feb 2016 17:42:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9FA4B203F7 for ; Sat, 20 Feb 2016 17:42:10 +0000 (UTC) Received: from localhost ([::1]:34476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXBXm-0007zS-3t for patchwork-qemu-devel@patchwork.kernel.org; Sat, 20 Feb 2016 12:42:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXBVq-0004FD-P5 for qemu-devel@nongnu.org; Sat, 20 Feb 2016 12:40:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXBVp-0000O4-VB for qemu-devel@nongnu.org; Sat, 20 Feb 2016 12:40:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXBVl-0000LP-Qa; Sat, 20 Feb 2016 12:40:05 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 6C20D19F5C; Sat, 20 Feb 2016 17:40:05 +0000 (UTC) Received: from localhost (ovpn-116-33.ams2.redhat.com [10.36.116.33]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1KHe3P9010771 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 20 Feb 2016 12:40:04 -0500 From: Max Reitz To: qemu-block@nongnu.org Date: Sat, 20 Feb 2016 18:39:52 +0100 Message-Id: <1455989993-1917-4-git-send-email-mreitz@redhat.com> In-Reply-To: <1455989993-1917-1-git-send-email-mreitz@redhat.com> References: <1455989993-1917-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 20 Feb 2016 17:40:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Fam Zheng , qemu-devel@nongnu.org, Max Reitz Subject: [Qemu-devel] [PATCH 3/4] block/null-{co, aio}: Implement get_block_status() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Max Reitz --- block/null.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/block/null.c b/block/null.c index ad883d9..0a8ff7b 100644 --- a/block/null.c +++ b/block/null.c @@ -186,6 +186,19 @@ static int null_reopen_prepare(BDRVReopenState *reopen_state, return 0; } +static int64_t coroutine_fn null_co_get_block_status(BlockDriverState *bs, + int64_t sector_num, + int nb_sectors, int *pnum, + BlockDriverState **file) +{ + off_t start = sector_num * BDRV_SECTOR_SIZE; + + *pnum = nb_sectors; + *file = bs; + + return BDRV_BLOCK_ZERO | BDRV_BLOCK_OFFSET_VALID | start; +} + static BlockDriver bdrv_null_co = { .format_name = "null-co", .protocol_name = "null-co", @@ -199,6 +212,8 @@ static BlockDriver bdrv_null_co = { .bdrv_co_writev = null_co_writev, .bdrv_co_flush_to_disk = null_co_flush, .bdrv_reopen_prepare = null_reopen_prepare, + + .bdrv_co_get_block_status = null_co_get_block_status, }; static BlockDriver bdrv_null_aio = { @@ -214,6 +229,8 @@ static BlockDriver bdrv_null_aio = { .bdrv_aio_writev = null_aio_writev, .bdrv_aio_flush = null_aio_flush, .bdrv_reopen_prepare = null_reopen_prepare, + + .bdrv_co_get_block_status = null_co_get_block_status, }; static void bdrv_null_init(void)