From fa1d36df7466ebbef0331b79d0ce3c5e140695c9 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 7 Oct 2014 13:59:13 +0200 Subject: block: Eliminate DriveInfo member bdrv, use blk_by_legacy_dinfo() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch is big, but all it really does is replacing dinfo->bdrv by blk_bs(blk_by_legacy_dinfo(dinfo)) The replacement is repetitive, but the conversion of device models to BlockBackend is imminent, and will shorten it to just blk_legacy_dinfo(dinfo). Line wrapping muddies the waters a bit. I also omit tests whether dinfo->bdrv is null, because it never is. Signed-off-by: Markus Armbruster Reviewed-by: BenoƮt Canet Reviewed-by: Max Reitz Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- blockdev.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index c99df8f3f1..aa37dbc541 100644 --- a/blockdev.c +++ b/blockdev.c @@ -220,11 +220,11 @@ bool drive_check_orphaned(void) dinfo = blk_legacy_dinfo(blk); /* If dinfo->bdrv->dev is NULL, it has no device attached. */ /* Unless this is a default drive, this may be an oversight. */ - if (!dinfo->bdrv->dev && !dinfo->is_default && + if (!blk_bs(blk)->dev && !dinfo->is_default && dinfo->type != IF_NONE) { fprintf(stderr, "Warning: Orphaned drive without device: " "id=%s,file=%s,if=%s,bus=%d,unit=%d\n", - dinfo->id, dinfo->bdrv->filename, if_name[dinfo->type], + dinfo->id, blk_bs(blk)->filename, if_name[dinfo->type], dinfo->bus, dinfo->unit); rs = true; } @@ -526,7 +526,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, dinfo = g_malloc0(sizeof(*dinfo)); dinfo->id = g_strdup(qemu_opts_id(opts)); - dinfo->bdrv = bs; blk_set_legacy_dinfo(blk, dinfo); if (!file || !*file) { @@ -556,7 +555,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, QINCREF(bs_opts); ret = bdrv_open(&bs, file, NULL, bs_opts, bdrv_flags, drv, &error); - assert(bs == dinfo->bdrv); + assert(bs == blk_bs(blk)); if (ret < 0) { error_setg(errp, "could not open disk image %s: %s", -- cgit v1.2.3