aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-03-06 11:52:48 +0100
committerKevin Wolf <kwolf@redhat.com>2013-03-22 17:51:31 +0100
commit787e4a8500020695eb391e2f1cc4767ee071d441 (patch)
tree1dec822d44c48a551095b3d9242281e9c38d92bb /block.c
parent92b7a08d64e5e3129fa885f9d180e5bddcb76b42 (diff)
block: Add options QDict to bdrv_file_open() prototypes
The new parameter is unused yet. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/block.c b/block.c
index 22647b221a..0fb0165eb6 100644
--- a/block.c
+++ b/block.c
@@ -708,7 +708,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
bdrv_swap(file, bs);
ret = 0;
} else {
- ret = drv->bdrv_file_open(bs, filename, open_flags);
+ ret = drv->bdrv_file_open(bs, filename, options, open_flags);
}
} else {
assert(file != NULL);
@@ -742,13 +742,21 @@ free_and_fail:
/*
* Opens a file using a protocol (file, host_device, nbd, ...)
+ *
+ * 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 QINCREF() before calling bdrv_file_open.
*/
-int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags)
+int bdrv_file_open(BlockDriverState **pbs, const char *filename,
+ QDict *options, int flags)
{
BlockDriverState *bs;
BlockDriver *drv;
int ret;
+ QDECREF(options);
+
drv = bdrv_find_protocol(filename);
if (!drv) {
return -ENOENT;
@@ -888,7 +896,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
flags |= BDRV_O_ALLOW_RDWR;
}
- ret = bdrv_file_open(&file, filename, bdrv_open_flags(bs, flags));
+ ret = bdrv_file_open(&file, filename, NULL, bdrv_open_flags(bs, flags));
if (ret < 0) {
goto fail;
}