mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
7f06d47eff
commit
fa1d36df74
44 changed files with 168 additions and 96 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue