diff options
author | Kevin Wolf <kwolf@redhat.com> | 2013-07-09 11:09:02 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-07-26 21:10:11 +0200 |
commit | 74fe54f2a1b5c4f4498a8fe521e1dfc936656cd4 (patch) | |
tree | b5efc4e295cb91ea5d2a704ce6ceaca4f46a73ed /block.c | |
parent | 69dd62dfd60631ba69201d8a197fde1ece4b4df3 (diff) |
block: Allow "driver" option on the top level
This is traditionally -drive format=..., which is now translated into
the new driver option. This gives us a more consistent way to select the
driver of BlockDriverStates that can be used in QMP context, too.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -970,6 +970,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, char tmp_filename[PATH_MAX + 1]; BlockDriverState *file = NULL; QDict *file_options = NULL; + const char *drvname; /* NULL means an empty set of options */ if (options == NULL) { @@ -1059,6 +1060,12 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, } /* Find the right image format driver */ + drvname = qdict_get_try_str(options, "driver"); + if (drvname) { + drv = bdrv_find_whitelisted_format(drvname, !(flags & BDRV_O_RDWR)); + qdict_del(options, "driver"); + } + if (!drv) { ret = find_image_format(file, filename, &drv); } |