mirror of https://gitee.com/openkylin/qemu.git
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>
This commit is contained in:
parent
97148076e8
commit
22aa8b246a
|
@ -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);
|
||||
|
|
|
@ -373,6 +373,7 @@ struct BdrvChild {
|
|||
BlockDriverState *bs;
|
||||
char *name;
|
||||
const BdrvChildRole *role;
|
||||
void *opaque;
|
||||
QLIST_ENTRY(BdrvChild) next;
|
||||
QLIST_ENTRY(BdrvChild) next_parent;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue