From patchwork Tue Jun 21 09:21:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 9190083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B4DE16075A for ; Tue, 21 Jun 2016 09:48:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A434E27F93 for ; Tue, 21 Jun 2016 09:48:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98CB028066; Tue, 21 Jun 2016 09:48:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 2094E27F93 for ; Tue, 21 Jun 2016 09:48:18 +0000 (UTC) Received: from localhost ([::1]:50187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFIEb-00051d-9m for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Jun 2016 05:44:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFHsx-0003LL-DD for qemu-devel@nongnu.org; Tue, 21 Jun 2016 05:22:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFHsw-0000J9-82 for qemu-devel@nongnu.org; Tue, 21 Jun 2016 05:22:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFHsg-0000Fi-RV; Tue, 21 Jun 2016 05:22:03 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A7403710F0; Tue, 21 Jun 2016 09:22:02 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-68.ams2.redhat.com [10.36.116.68]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5L9LdJF020173; Tue, 21 Jun 2016 05:22:00 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 21 Jun 2016 11:21:28 +0200 Message-Id: <1466500894-9710-12-git-send-email-kwolf@redhat.com> In-Reply-To: <1466500894-9710-1-git-send-email-kwolf@redhat.com> References: <1466500894-9710-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 21 Jun 2016 09:22:02 +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 Subject: [Qemu-devel] [PATCH 11/17] block: Convert bdrv_read() to BdrvChild 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, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/io.c | 4 ++-- block/qcow2-cluster.c | 6 +++--- block/vdi.c | 4 ++-- block/vvfat.c | 2 +- include/block/block.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/block/io.c b/block/io.c index 299e9ec..d14c982 100644 --- a/block/io.c +++ b/block/io.c @@ -634,10 +634,10 @@ static int bdrv_rw_co(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, } /* return < 0 if error. See bdrv_write() for the return codes */ -int bdrv_read(BlockDriverState *bs, int64_t sector_num, +int bdrv_read(BdrvChild *child, int64_t sector_num, uint8_t *buf, int nb_sectors) { - return bdrv_rw_co(bs, sector_num, buf, nb_sectors, false, 0); + return bdrv_rw_co(child->bs, sector_num, buf, nb_sectors, false, 0); } /* Return < 0 if error. Important errors are: diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 893ddf6..ed9832a 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -1410,7 +1410,7 @@ int qcow2_decompress_cluster(BlockDriverState *bs, uint64_t cluster_offset) sector_offset = coffset & 511; csize = nb_csectors * 512 - sector_offset; BLKDBG_EVENT(bs->file, BLKDBG_READ_COMPRESSED); - ret = bdrv_read(bs->file->bs, coffset >> 9, s->cluster_data, + ret = bdrv_read(bs->file, coffset >> 9, s->cluster_data, nb_csectors); if (ret < 0) { return ret; @@ -1679,7 +1679,7 @@ static int expand_zero_clusters_in_l1(BlockDriverState *bs, uint64_t *l1_table, (void **)&l2_table); } else { /* load inactive L2 tables from disk */ - ret = bdrv_read(bs->file->bs, l2_offset / BDRV_SECTOR_SIZE, + ret = bdrv_read(bs->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); } if (ret < 0) { @@ -1861,7 +1861,7 @@ int qcow2_expand_zero_clusters(BlockDriverState *bs, l1_table = g_realloc(l1_table, l1_sectors * BDRV_SECTOR_SIZE); - ret = bdrv_read(bs->file->bs, + ret = bdrv_read(bs->file, s->snapshots[i].l1_table_offset / BDRV_SECTOR_SIZE, (void *)l1_table, l1_sectors); if (ret < 0) { diff --git a/block/vdi.c b/block/vdi.c index 7d9ab9c..46a3436 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -403,7 +403,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, logout("\n"); - ret = bdrv_read(bs->file->bs, 0, (uint8_t *)&header, 1); + ret = bdrv_read(bs->file, 0, (uint8_t *)&header, 1); if (ret < 0) { goto fail; } @@ -500,7 +500,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } - ret = bdrv_read(bs->file->bs, s->bmap_sector, (uint8_t *)s->bmap, + ret = bdrv_read(bs->file, s->bmap_sector, (uint8_t *)s->bmap, bmap_size); if (ret < 0) { goto fail_free_bmap; diff --git a/block/vvfat.c b/block/vvfat.c index 2eb2536..1d287a2 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1392,7 +1392,7 @@ static int vvfat_read(BlockDriverState *bs, int64_t sector_num, if (bdrv_is_allocated(s->qcow->bs, sector_num, nb_sectors-i, &n)) { DLOG(fprintf(stderr, "sectors %d+%d allocated\n", (int)sector_num, n)); - if (bdrv_read(s->qcow->bs, sector_num, buf + i*0x200, n)) { + if (bdrv_read(s->qcow, sector_num, buf + i*0x200, n)) { return -1; } i += n - 1; diff --git a/include/block/block.h b/include/block/block.h index c6891d7..47c0177 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -226,7 +226,7 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, Error **errp); void bdrv_reopen_commit(BDRVReopenState *reopen_state); void bdrv_reopen_abort(BDRVReopenState *reopen_state); -int bdrv_read(BlockDriverState *bs, int64_t sector_num, +int bdrv_read(BdrvChild *child, int64_t sector_num, uint8_t *buf, int nb_sectors); int bdrv_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors);