summaryrefslogtreecommitdiff
path: root/hw/block/xen_disk.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-10-07 13:59:05 +0200
committerKevin Wolf <kwolf@redhat.com>2014-10-20 13:41:26 +0200
commit7e7d56d9e05b340290669442cfa05f5869204572 (patch)
tree5ac3934eadc67544a188e1f368357bfe16c6b81c /hw/block/xen_disk.c
parent26f54e9a3cfe62fca61baf83a06b269935d6b9a4 (diff)
downloadqemu-7e7d56d9e05b340290669442cfa05f5869204572.zip
block: Connect BlockBackend to BlockDriverState
Convenience function blk_new_with_bs() creates a BlockBackend with its BlockDriverState. Callers have to unref both. The commit after next will relieve them of the need to unref the BlockDriverState. Complication: due to the silly way drive_del works, we need a way to hide a BlockBackend, just like bdrv_make_anon(). To emphasize its "special" status, give the function a suitably off-putting name: blk_hide_on_behalf_of_do_drive_del(). Unfortunately, hiding turns the BlockBackend's name into the empty string. Can't avoid that without breaking the blk->bs->device_name equals blk->name invariant. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/block/xen_disk.c')
-rw-r--r--hw/block/xen_disk.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index 265cf13aa9..00220837e0 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -860,15 +860,11 @@ static int blk_connect(struct XenDevice *xendev)
/* setup via xenbus -> create new block driver instance */
xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n");
- blk = blk_new(blkdev->dev, NULL);
+ blk = blk_new_with_bs(blkdev->dev, NULL);
if (!blk) {
return -1;
}
- blkdev->bs = bdrv_new_root(blkdev->dev, NULL);
- if (!blkdev->bs) {
- blk_unref(blk);
- return -1;
- }
+ blkdev->bs = blk_bs(blk);
drv = bdrv_find_whitelisted_format(blkdev->fileproto, readonly);
if (bdrv_open(&blkdev->bs, blkdev->filename, NULL, NULL, qflags,