[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 8/8] block: Remove bdrv_open_image()'s force_raw
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v4 8/8] block: Remove bdrv_open_image()'s force_raw option |
Date: |
Tue, 18 Feb 2014 18:33:12 +0100 |
This option is now unnecessary since specifying BDRV_O_PROTOCOL as flag
will do exactly the same.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Benoit Canet <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
block.c | 27 ++++-----------------------
block/blkdebug.c | 2 +-
block/blkverify.c | 4 ++--
include/block/block.h | 2 +-
4 files changed, 8 insertions(+), 27 deletions(-)
diff --git a/block.c b/block.c
index 71ed977..80310fe 100644
--- a/block.c
+++ b/block.c
@@ -1109,10 +1109,6 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict
*options, Error **errp)
* Opens a disk image whose options are given as BlockdevRef in another block
* device's options.
*
- * If force_raw is true, bdrv_file_open() will be used, thereby preventing any
- * image format auto-detection. If it is false and a filename is given,
- * bdrv_open() will be used for auto-detection.
- *
* If allow_none is true, no image will be opened if filename is false and no
* BlockdevRef is given. *pbs will remain unchanged and 0 will be returned.
*
@@ -1127,7 +1123,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict
*options, Error **errp)
*/
int bdrv_open_image(BlockDriverState **pbs, const char *filename,
QDict *options, const char *bdref_key, int flags,
- bool force_raw, bool allow_none, Error **errp)
+ bool allow_none, Error **errp)
{
QDict *image_options;
int ret;
@@ -1153,22 +1149,7 @@ int bdrv_open_image(BlockDriverState **pbs, const char
*filename,
goto done;
}
- if (filename && !force_raw) {
- /* If a filename is given and the block driver should be detected
- automatically (instead of using none), use bdrv_open() in order to
do
- that auto-detection. */
- if (reference) {
- error_setg(errp, "Cannot reference an existing block device while "
- "giving a filename");
- ret = -EINVAL;
- goto done;
- }
-
- ret = bdrv_open(pbs, filename, NULL, image_options, flags, NULL, errp);
- } else {
- ret = bdrv_open(pbs, filename, reference, image_options,
- flags | BDRV_O_PROTOCOL, NULL, errp);
- }
+ ret = bdrv_open(pbs, filename, reference, image_options, flags, NULL,
errp);
done:
qdict_del(options, bdref_key);
@@ -1330,8 +1311,8 @@ int bdrv_open(BlockDriverState **pbs, const char
*filename,
assert(file == NULL);
ret = bdrv_open_image(&file, filename, options, "file",
- bdrv_open_flags(bs, flags | BDRV_O_UNMAP), true,
true,
- &local_err);
+ bdrv_open_flags(bs, flags | BDRV_O_UNMAP) |
+ BDRV_O_PROTOCOL, true, &local_err);
if (ret < 0) {
goto fail;
}
diff --git a/block/blkdebug.c b/block/blkdebug.c
index 053fa4c..6707f49 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -412,7 +412,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict
*options, int flags,
/* Open the backing file */
assert(bs->file == NULL);
ret = bdrv_open_image(&bs->file, qemu_opt_get(opts, "x-image"), options,
"image",
- flags, true, false, &local_err);
+ flags | BDRV_O_PROTOCOL, false, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
goto out;
diff --git a/block/blkverify.c b/block/blkverify.c
index 86585e7..b57da59 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -137,7 +137,7 @@ static int blkverify_open(BlockDriverState *bs, QDict
*options, int flags,
/* Open the raw file */
assert(bs->file == NULL);
ret = bdrv_open_image(&bs->file, qemu_opt_get(opts, "x-raw"), options,
- "raw", flags, true, false, &local_err);
+ "raw", flags | BDRV_O_PROTOCOL, false, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
goto fail;
@@ -146,7 +146,7 @@ static int blkverify_open(BlockDriverState *bs, QDict
*options, int flags,
/* Open the test file */
assert(s->test_file == NULL);
ret = bdrv_open_image(&s->test_file, qemu_opt_get(opts, "x-image"),
options,
- "test", flags, false, false, &local_err);
+ "test", flags, false, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
s->test_file = NULL;
diff --git a/include/block/block.h b/include/block/block.h
index bf78db5..780f48b 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -188,7 +188,7 @@ int bdrv_parse_cache_flags(const char *mode, int *flags);
int bdrv_parse_discard_flags(const char *mode, int *flags);
int bdrv_open_image(BlockDriverState **pbs, const char *filename,
QDict *options, const char *bdref_key, int flags,
- bool force_raw, bool allow_none, Error **errp);
+ bool allow_none, Error **errp);
int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp);
int bdrv_open(BlockDriverState **pbs, const char *filename,
const char *reference, QDict *options, int flags,
--
1.8.5.4
- [Qemu-devel] [PATCH v4 0/8] block: Integrate bdrv_file_open() into bdrv_open(), Max Reitz, 2014/02/18
- [Qemu-devel] [PATCH v4 1/8] block: Change BDS parameter of bdrv_open() to **, Max Reitz, 2014/02/18
- [Qemu-devel] [PATCH v4 2/8] block: Add reference parameter to bdrv_open(), Max Reitz, 2014/02/18
- [Qemu-devel] [PATCH v4 3/8] block: Make bdrv_file_open() static, Max Reitz, 2014/02/18
- [Qemu-devel] [PATCH v4 4/8] block: Reuse reference handling from bdrv_open(), Max Reitz, 2014/02/18
- [Qemu-devel] [PATCH v4 5/8] block: Remove bdrv_new() from bdrv_file_open(), Max Reitz, 2014/02/18
- [Qemu-devel] [PATCH v4 8/8] block: Remove bdrv_open_image()'s force_raw option,
Max Reitz <=
- [Qemu-devel] [PATCH v4 6/8] block: Handle bs->options in bdrv_open() only, Max Reitz, 2014/02/18
- [Qemu-devel] [PATCH v4 7/8] block: Reuse success path from bdrv_open(), Max Reitz, 2014/02/18
- Re: [Qemu-devel] [PATCH v4 0/8] block: Integrate bdrv_file_open() into bdrv_open(), Kevin Wolf, 2014/02/19