Make the BlockBackend own the DriveInfo. Change blockdev_init() to
return the BlockBackend instead of the DriveInfo.
Signed-off-by: Markus Armbruster <address@hidden>
---
block.c | 2 --
block/block-backend.c | 38 ++++++++++++++++++++++++
blockdev.c | 73 ++++++++++++++++++++++++-----------------------
include/sysemu/blockdev.h | 4 +++
4 files changed, 79 insertions(+), 38 deletions(-)
@@ -920,19 +922,18 @@ DriveInfo *drive_new(QemuOpts *all_opts,
BlockInterfaceType block_default_type)
}
/* Actual block device init: Functionality shared with blockdev-add */
- dinfo = blockdev_init(filename, bs_opts, &local_err);
+ blk = blockdev_init(filename, bs_opts, &local_err);
bs_opts = NULL;
- if (dinfo == NULL) {
- if (local_err) {
- error_report("%s", error_get_pretty(local_err));
- error_free(local_err);
- }
+ if (!blk) {
+ error_report("%s", error_get_pretty(local_err));
+ error_free(local_err);
goto fail;