Skip to content

Commit 96796fa

Browse files
Vladimir Sementsov-Ogievskiykevmw
authored andcommitted
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 <[email protected]> Message-Id: <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
1 parent f053b7e commit 96796fa

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

block.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5119,14 +5119,23 @@ static void bdrv_delete(BlockDriverState *bs)
51195119
g_free(bs);
51205120
}
51215121

5122-
BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_options,
5122+
5123+
/*
5124+
* Replace @bs by newly created block node.
5125+
*
5126+
* @options is a QDict of options to pass to the block drivers, or NULL for an
5127+
* empty set of options. The reference to the QDict belongs to the block layer
5128+
* after the call (even on failure), so if the caller intends to reuse the
5129+
* dictionary, it needs to use qobject_ref() before calling bdrv_open.
5130+
*/
5131+
BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *options,
51235132
int flags, Error **errp)
51245133
{
51255134
ERRP_GUARD();
51265135
int ret;
51275136
BlockDriverState *new_node_bs;
51285137

5129-
new_node_bs = bdrv_open(NULL, NULL, node_options, flags, errp);
5138+
new_node_bs = bdrv_open(NULL, NULL, options, flags, errp);
51305139
if (new_node_bs == NULL) {
51315140
error_prepend(errp, "Could not create node: ");
51325141
return NULL;

0 commit comments

Comments
 (0)