diff options
author | Max Reitz <mreitz@redhat.com> | 2014-02-18 18:33:07 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-02-21 21:02:22 +0100 |
commit | 2e40134bfdbb073512f9f264cb96162787ec62b1 (patch) | |
tree | 53cb53980ac38e9ee6d58e49850864ffc62a3f3a /block.c | |
parent | ddf5636dc9e4be894f2ab4a5f803d915478b5099 (diff) |
block: Make bdrv_file_open() static
Add the bdrv_open() option BDRV_O_PROTOCOL which results in passing the
call to bdrv_file_open(). Additionally, make bdrv_file_open() static and
therefore bdrv_open() the only way to call it.
Consequently, all existing calls to bdrv_file_open() have to be adjusted
to use bdrv_open() with the BDRV_O_PROTOCOL flag instead.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -960,9 +960,9 @@ free_and_fail: * 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, - const char *reference, QDict *options, int flags, - Error **errp) +static int bdrv_file_open(BlockDriverState **pbs, const char *filename, + const char *reference, QDict *options, int flags, + Error **errp) { BlockDriverState *bs = NULL; BlockDriver *drv; @@ -1208,8 +1208,8 @@ int bdrv_open_image(BlockDriverState **pbs, const char *filename, ret = bdrv_open(pbs, filename, NULL, image_options, flags, NULL, errp); } else { - ret = bdrv_file_open(pbs, filename, reference, image_options, flags, - errp); + ret = bdrv_open(pbs, filename, reference, image_options, + flags | BDRV_O_PROTOCOL, NULL, errp); } done: @@ -1245,6 +1245,12 @@ int bdrv_open(BlockDriverState **pbs, const char *filename, assert(pbs); + if (flags & BDRV_O_PROTOCOL) { + assert(!drv); + return bdrv_file_open(pbs, filename, reference, options, + flags & ~BDRV_O_PROTOCOL, errp); + } + if (reference) { bool options_non_empty = options ? qdict_size(options) : false; QDECREF(options); |