summary refs log tree commit diff stats
path: root/blockdev.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-10-07 13:59:13 +0200
committerKevin Wolf <kwolf@redhat.com>2014-10-20 13:41:27 +0200
commitfa1d36df7466ebbef0331b79d0ce3c5e140695c9 (patch)
tree09c705b3c00506d246b712a330deef215f483e2a /blockdev.c
parent7f06d47eff9d26cca87855273f20786502f8c57e (diff)
downloadfocaccia-qemu-fa1d36df7466ebbef0331b79d0ce3c5e140695c9.tar.gz
focaccia-qemu-fa1d36df7466ebbef0331b79d0ce3c5e140695c9.zip
block: Eliminate DriveInfo member bdrv, use blk_by_legacy_dinfo()
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 <armbru@redhat.com>
Reviewed-by: BenoƮt Canet <benoit.canet@nodalink.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c7
1 files changed, 3 insertions, 4 deletions
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",