From nobody Mon Feb 9 12:26:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505400389731750.4521851904341; Thu, 14 Sep 2017 07:46:29 -0700 (PDT) Received: from localhost ([::1]:48202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsVPR-0002OB-0T for importer@patchew.org; Thu, 14 Sep 2017 10:46:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsVKe-000684-3N for qemu-devel@nongnu.org; Thu, 14 Sep 2017 10:41:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsVKd-0002u3-5u for qemu-devel@nongnu.org; Thu, 14 Sep 2017 10:41:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59848) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dsVKU-0002kU-F4; Thu, 14 Sep 2017 10:41:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 637904E4D3; Thu, 14 Sep 2017 14:41:21 +0000 (UTC) Received: from red.redhat.com (ovpn-123-70.rdu2.redhat.com [10.10.123.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 212B618226; Thu, 14 Sep 2017 14:41:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 637904E4D3 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eblake@redhat.com From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 14 Sep 2017 09:40:25 -0500 Message-Id: <20170914144032.14945-14-eblake@redhat.com> In-Reply-To: <20170914144032.14945-1-eblake@redhat.com> References: <20170914144032.14945-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 14 Sep 2017 14:41:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 13/20] raw: Switch to .bdrv_co_block_status() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, famz@redhat.com, jsnow@redhat.com, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We are gradually moving away from sector-based interfaces, towards byte-based. Update the raw driver accordingly. Signed-off-by: Eric Blake --- v2: rebase to mapping --- block/raw-format.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/block/raw-format.c b/block/raw-format.c index ab552c0954..22c7e980f2 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -250,17 +250,18 @@ fail: return ret; } -static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, - int64_t sector_num, - int nb_sectors, int *pnum, - BlockDriverState **file) +static int64_t coroutine_fn raw_co_block_status(BlockDriverState *bs, + bool mapping, + int64_t offset, + int64_t bytes, int64_t *pn= um, + BlockDriverState **file) { BDRVRawState *s =3D bs->opaque; - *pnum =3D nb_sectors; + *pnum =3D bytes; *file =3D bs->file->bs; - sector_num +=3D s->offset / BDRV_SECTOR_SIZE; + offset +=3D s->offset; return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | - (sector_num << BDRV_SECTOR_BITS); + (offset & BDRV_BLOCK_OFFSET_MASK); } static int coroutine_fn raw_co_pwrite_zeroes(BlockDriverState *bs, @@ -496,7 +497,7 @@ BlockDriver bdrv_raw =3D { .bdrv_co_pwritev =3D &raw_co_pwritev, .bdrv_co_pwrite_zeroes =3D &raw_co_pwrite_zeroes, .bdrv_co_pdiscard =3D &raw_co_pdiscard, - .bdrv_co_get_block_status =3D &raw_co_get_block_status, + .bdrv_co_block_status =3D &raw_co_block_status, .bdrv_truncate =3D &raw_truncate, .bdrv_getlength =3D &raw_getlength, .has_variable_length =3D true, --=20 2.13.5