From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 10/10] block: Remove bdrv_open_image()'s force_raw option
Date: Sun, 26 Jan 2014 20:02:43 +0100 [thread overview]
Message-ID: <1390762963-25538-11-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1390762963-25538-1-git-send-email-mreitz@redhat.com>
This option is now unnecessary since specifying BDRV_O_PROTOCOL as flag
will do exactly the same.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block.c | 30 +++++-------------------------
block/blkdebug.c | 2 +-
block/blkverify.c | 4 ++--
include/block/block.h | 2 +-
4 files changed, 9 insertions(+), 29 deletions(-)
diff --git a/block.c b/block.c
index b1bae23..7f02ff1 100644
--- a/block.c
+++ b/block.c
@@ -1096,10 +1096,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.
*
@@ -1112,7 +1108,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;
@@ -1135,24 +1131,8 @@ 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;
- }
-
- *pbs = NULL;
- ret = bdrv_open(pbs, filename, NULL, image_options, flags, NULL, errp);
- } else {
- *pbs = NULL;
- ret = bdrv_open(pbs, filename, reference, image_options,
- flags | BDRV_O_PROTOCOL, NULL, errp);
- }
+ *pbs = NULL;
+ ret = bdrv_open(pbs, filename, reference, image_options, flags, NULL, errp);
done:
qdict_del(options, bdref_key);
@@ -1308,8 +1288,8 @@ int bdrv_open(BlockDriverState **pbs, const char *filename,
}
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 56c4cd0..5696ef6 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -411,7 +411,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
/* Open the backing file */
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 fail;
diff --git a/block/blkverify.c b/block/blkverify.c
index cfcbcf4..fe94b59 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -136,7 +136,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
/* Open the raw file */
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;
@@ -144,7 +144,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
/* Open the test file */
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 396f9ed..9bf8ef1 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -187,7 +187,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.3
prev parent reply other threads:[~2014-01-26 19:01 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-26 19:02 [Qemu-devel] [PATCH 00/10] block: Integrate bdrv_file_open() into bdrv_open() Max Reitz
2014-01-26 19:02 ` [Qemu-devel] [PATCH 01/10] block: Change BDS parameter of bdrv_open() to ** Max Reitz
2014-01-27 2:38 ` Benoît Canet
2014-01-27 18:51 ` Max Reitz
2014-01-27 19:31 ` Jeff Cody
2014-01-27 19:35 ` Max Reitz
2014-01-29 11:50 ` Kevin Wolf
2014-01-31 20:07 ` Max Reitz
2014-02-03 9:49 ` Kevin Wolf
2014-01-26 19:02 ` [Qemu-devel] [PATCH 02/10] block: Add reference parameter to bdrv_open() Max Reitz
2014-01-26 19:02 ` [Qemu-devel] [PATCH 03/10] block: Make bdrv_file_open() static Max Reitz
2014-01-27 2:51 ` Benoît Canet
2014-01-29 13:26 ` Kevin Wolf
2014-01-31 20:20 ` Max Reitz
2014-02-03 10:05 ` Kevin Wolf
2014-01-26 19:02 ` [Qemu-devel] [PATCH 04/10] block: Reuse NULL options check from bdrv_open() Max Reitz
2014-01-27 2:52 ` Benoît Canet
2014-01-26 19:02 ` [Qemu-devel] [PATCH 05/10] block: Reuse reference handling " Max Reitz
2014-01-27 2:56 ` Benoît Canet
2014-01-26 19:02 ` [Qemu-devel] [PATCH 06/10] block: Remove bdrv_new() from bdrv_file_open() Max Reitz
2014-01-27 3:04 ` Benoît Canet
2014-01-29 13:35 ` Kevin Wolf
2014-01-31 20:21 ` Max Reitz
2014-01-26 19:02 ` [Qemu-devel] [PATCH 07/10] block: Reuse fail path from bdrv_open() Max Reitz
2014-01-27 3:10 ` Benoît Canet
2014-01-27 18:58 ` Max Reitz
2014-01-29 13:40 ` Kevin Wolf
2014-01-26 19:02 ` [Qemu-devel] [PATCH 08/10] block: Reuse bs->options setting " Max Reitz
2014-01-27 3:13 ` Benoît Canet
2014-01-29 13:45 ` Kevin Wolf
2014-01-31 20:25 ` Max Reitz
2014-01-26 19:02 ` [Qemu-devel] [PATCH 09/10] block: Reuse success path " Max Reitz
2014-01-27 17:44 ` Jeff Cody
2014-01-27 19:06 ` Max Reitz
2014-01-26 19:02 ` Max Reitz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1390762963-25538-11-git-send-email-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).