[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 12/24] block: Use bdrv_open_image() in bdrv_open(
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v7 12/24] block: Use bdrv_open_image() in bdrv_open() |
Date: |
Fri, 20 Dec 2013 19:28:12 +0100 |
Using bdrv_open_image() instead of bdrv_file_open() directly in
bdrv_open() is easier.
Signed-off-by: Max Reitz <address@hidden>
---
block.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/block.c b/block.c
index 76b6c25..9e4e85f 100644
--- a/block.c
+++ b/block.c
@@ -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 */
--
1.8.5.1
- [Qemu-devel] [PATCH v7 03/24] qdict: Add qdict_array_split(), (continued)
- [Qemu-devel] [PATCH v7 03/24] qdict: Add qdict_array_split(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 04/24] qapi: extend qdict_flatten() for QLists, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 05/24] qemu-option: Add qemu_config_parse_qdict(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 06/24] blkdebug: Always call read_config(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 07/24] blkdebug: Use command-line in read_config(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 08/24] block: Allow reference for bdrv_file_open(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 09/24] block: Pass reference to bdrv_file_open(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 10/24] block: Allow block devices without files, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 11/24] block: Add bdrv_open_image(), Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 12/24] block: Use bdrv_open_image() in bdrv_open(),
Max Reitz <=
- [Qemu-devel] [PATCH v7 13/24] block: Allow recursive "file"s, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 15/24] blkdebug: Allow command-line file configuration, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 14/24] blockdev: Move "file" to legacy_opts, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 16/24] blkverify: Allow command-line configuration, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 17/24] blkverify: Don't require protocol filename, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 18/24] qapi: Add "errno" to the list of polluted words, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 19/24] qapi: QMP interface for blkdebug and blkverify, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 20/24] qemu-io: Make filename optional, Max Reitz, 2013/12/20
- [Qemu-devel] [PATCH v7 21/24] tests: Add test for qdict_array_split(), Max Reitz, 2013/12/20