summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf2016-02-24 15:13:35 +0100
committerKevin Wolf2016-05-19 16:45:30 +0200
commit22aa8b246ada8d45add8eef64d4640a20b4f7ef3 (patch)
tree3d4c42208230b6e538be75111281d75cc63beb1f /block
parentblock: Move I/O throttling configuration functions to BlockBackend (diff)
downloadqemu-22aa8b246ada8d45add8eef64d4640a20b4f7ef3.tar.gz
qemu-22aa8b246ada8d45add8eef64d4640a20b4f7ef3.tar.xz
qemu-22aa8b246ada8d45add8eef64d4640a20b4f7ef3.zip
block: Introduce BdrvChild.opaque
BlockBackends use it to get a back pointer from BdrvChild to BlockBackend in any BdrvChildRole callbacks. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/block-backend.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index b9aaa604a6..52b7b922c2 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -133,6 +133,7 @@ BlockBackend *blk_new_with_bs(Error **errp)
bs = bdrv_new_root();
blk->root = bdrv_root_attach_child(bs, "root", &child_root);
+ blk->root->opaque = blk;
bs->blk = blk;
return blk;
}
@@ -458,6 +459,7 @@ void blk_insert_bs(BlockBackend *blk, BlockDriverState *bs)
assert(!blk->root && !bs->blk);
bdrv_ref(bs);
blk->root = bdrv_root_attach_child(bs, "root", &child_root);
+ blk->root->opaque = blk;
bs->blk = blk;
notifier_list_notify(&blk->insert_bs_notifiers, blk);