From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSdh-0001bq-Uf for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:51:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKSdg-0006mL-Ne for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:51:57 -0400 From: Kevin Wolf Date: Tue, 5 Jul 2016 17:50:45 +0200 Message-Id: <1467733852-27097-37-git-send-email-kwolf@redhat.com> In-Reply-To: <1467733852-27097-1-git-send-email-kwolf@redhat.com> References: <1467733852-27097-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 36/43] block: Convert bdrv_read() to BdrvChild List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Acked-by: Stefan Hajnoczi --- 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 d8b3c96..6dfc0eb 100644 --- a/block/io.c +++ b/block/io.c @@ -630,10 +630,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 0fb4356..c1e9eee 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -1408,7 +1408,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; @@ -1677,7 +1677,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) { @@ -1859,7 +1859,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 be9036e..5f980bb 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1393,7 +1393,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 fce8c81..b6744ab 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); -- 1.8.3.1