This is the equivalent of bdrv_open_file_child() to be used in cases
where the caller is QAPI based and has a BlockdevRef rather than a
filename and an options QDict.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/block-global-state.h | 4 ++++
block.c | 30 +++++++++++++++++++++++++++---
2 files changed, 31 insertions(+), 3 deletions(-)
+BlockDriverState *bdrv_open_blockdev_ref_file(BlockdevRef *ref,
+ BlockDriverState *parent,
+ Error **errp)
+{
+ BdrvChildRole role;
+
+ /* commit_top and mirror_top don't use this function */
+ assert(!parent->drv->filtered_child_is_backing);
+ role = parent->drv->is_filter ?
+ (BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY) : BDRV_CHILD_IMAGE;
+ return bdrv_open_blockdev_ref_common(ref, parent, &child_of_bds, role,
+ true, errp);
+}