From 787e4a8500020695eb391e2f1cc4767ee071d441 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 6 Mar 2013 11:52:48 +0100 Subject: block: Add options QDict to bdrv_file_open() prototypes The new parameter is unused yet. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'block.c') 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; } -- cgit v1.2.3