summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy2021-09-20 13:55:36 +0200
committerKevin Wolf2021-10-06 10:25:55 +0200
commit96796fae6f22931d91223d086e9fa56d0f3e6720 (patch)
tree21bf665a321bd365939e6cd11525b615e6aecbf2 /block.c
parentblock: bdrv_insert_node(): fix and improve error handling (diff)
downloadqemu-96796fae6f22931d91223d086e9fa56d0f3e6720.tar.gz
qemu-96796fae6f22931d91223d086e9fa56d0f3e6720.tar.xz
qemu-96796fae6f22931d91223d086e9fa56d0f3e6720.zip
block: bdrv_insert_node(): doc and style
- options & flags is common pair for open-like functions, let's use it - add a comment that specifies use of @options Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20210920115538.264372-4-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/block.c b/block.c
index 5d49188073..3a90407b83 100644
--- a/block.c
+++ b/block.c
@@ -5119,14 +5119,23 @@ static void bdrv_delete(BlockDriverState *bs)
g_free(bs);
}
-BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_options,
+
+/*
+ * Replace @bs by newly created block node.
+ *
+ * @options is a QDict of options to pass to the block drivers, or NULL for an
+ * empty set of options. The reference to the QDict belongs to the block layer
+ * after the call (even on failure), so if the caller intends to reuse the
+ * dictionary, it needs to use qobject_ref() before calling bdrv_open.
+ */
+BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *options,
int flags, Error **errp)
{
ERRP_GUARD();
int ret;
BlockDriverState *new_node_bs;
- new_node_bs = bdrv_open(NULL, NULL, node_options, flags, errp);
+ new_node_bs = bdrv_open(NULL, NULL, options, flags, errp);
if (new_node_bs == NULL) {
error_prepend(errp, "Could not create node: ");
return NULL;