diff options
author | Max Reitz <mreitz@redhat.com> | 2013-12-20 19:28:12 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-01-22 12:07:18 +0100 |
commit | 054963f8f082695ecb1f169024c83ce3e4eea3d8 (patch) | |
tree | 99bc4c528865df2de1b6162b0f0f995e7230c749 /block.c | |
parent | da557aac181fa71fde6a2a7c7a1eb2aea20caf64 (diff) |
block: Use bdrv_open_image() in bdrv_open()
Using bdrv_open_image() instead of bdrv_file_open() directly in
bdrv_open() is easier.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 18 |
1 files changed, 5 insertions, 13 deletions
@@ -1128,8 +1128,6 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ char tmp_filename[PATH_MAX + 1]; BlockDriverState *file = NULL; - QDict *file_options = NULL; - const char *file_reference; const char *drvname; Error *local_err = NULL; @@ -1215,17 +1213,11 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, flags |= BDRV_O_ALLOW_RDWR; } - qdict_extract_subqdict(options, &file_options, "file."); - file_reference = qdict_get_try_str(options, "file"); - - if (filename || file_reference || qdict_size(file_options)) { - ret = bdrv_file_open(&file, filename, file_reference, file_options, - bdrv_open_flags(bs, flags | BDRV_O_UNMAP), - &local_err); - qdict_del(options, "file"); - if (ret < 0) { - goto fail; - } + ret = bdrv_open_image(&file, filename, options, "file", + bdrv_open_flags(bs, flags | BDRV_O_UNMAP), true, true, + &local_err); + if (ret < 0) { + goto fail; } /* Find the right image format driver */ |