From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH 1/4] qemu-io: Clean up openfile() after commit 2e40134
Date: Mon, 8 Sep 2014 18:50:58 +0200 [thread overview]
Message-ID: <1410195061-8267-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1410195061-8267-1-git-send-email-armbru@redhat.com>
Commit 6db9560 split off the growable case so it can use
bdrv_file_open() instead of bdrv_open() then. Growable BDSes become
anonymous. Weird.
Commit 2e40134 folded bdrv_file_open() back into bdrv_open() with new
flag BDRV_O_PROTOCOL. We still have two bdrv_open() calls, and
growable BDSes remain anonymous.
Circle back to before commit 6db9560: just one call, not anonymous.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
qemu-io.c | 34 ++++++++++++----------------------
1 file changed, 12 insertions(+), 22 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index 33c96c4..d2ab694 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -58,30 +58,20 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
return 1;
}
+ qemuio_bs = bdrv_new("hda", &error_abort);
+
if (growable) {
- if (bdrv_open(&qemuio_bs, name, NULL, opts, flags | BDRV_O_PROTOCOL,
- NULL, &local_err))
- {
- fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
- name ? " device " : "", name ?: "",
- error_get_pretty(local_err));
- error_free(local_err);
- return 1;
- }
- } else {
- qemuio_bs = bdrv_new("hda", &error_abort);
+ flags |= BDRV_O_PROTOCOL;
+ }
- if (bdrv_open(&qemuio_bs, name, NULL, opts, flags, NULL, &local_err)
- < 0)
- {
- fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
- name ? " device " : "", name ?: "",
- error_get_pretty(local_err));
- error_free(local_err);
- bdrv_unref(qemuio_bs);
- qemuio_bs = NULL;
- return 1;
- }
+ if (bdrv_open(&qemuio_bs, name, NULL, opts, flags, NULL, &local_err) < 0) {
+ fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
+ name ? " device " : "", name ?: "",
+ error_get_pretty(local_err));
+ error_free(local_err);
+ bdrv_unref(qemuio_bs);
+ qemuio_bs = NULL;
+ return 1;
}
return 0;
--
1.9.3
next prev parent reply other threads:[~2014-09-08 16:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-08 16:50 [Qemu-devel] [PATCH 0/4] Block-related miscellaneous cleanups Markus Armbruster
2014-09-08 16:50 ` Markus Armbruster [this message]
2014-09-08 16:50 ` [Qemu-devel] [PATCH 2/4] xen_disk: Plug memory leak on error path Markus Armbruster
2014-09-08 16:51 ` [Qemu-devel] [PATCH 3/4] xen: Drop redundant bdrv_close() from pci_piix3_xen_ide_unplug() Markus Armbruster
2014-09-08 16:51 ` [Qemu-devel] [PATCH 4/4] thread-pool: Drop unnecessary includes Markus Armbruster
2014-09-09 8:53 ` [Qemu-devel] [PATCH 0/4] Block-related miscellaneous cleanups Kevin Wolf
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=1410195061-8267-2-git-send-email-armbru@redhat.com \
--to=armbru@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).