[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/22] qemu-io: Clean up openfile() after commit 2e40
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 03/22] qemu-io: Clean up openfile() after commit 2e40134 |
Date: |
Fri, 12 Sep 2014 17:56:47 +0200 |
From: Markus Armbruster <address@hidden>
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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-io.c | 36 +++++++++++++-----------------------
1 file changed, 13 insertions(+), 23 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);
-
- 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;
- }
+ 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;
}
return 0;
--
1.8.3.1
- [Qemu-devel] [PULL 00/22] Block patches, Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 02/22] Fix improper usage of cpu_to_be32 in vpc, Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 03/22] qemu-io: Clean up openfile() after commit 2e40134,
Kevin Wolf <=
- [Qemu-devel] [PULL 04/22] xen_disk: Plug memory leak on error path, Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 05/22] xen: Drop redundant bdrv_close() from pci_piix3_xen_ide_unplug(), Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 09/22] block: Extract the block accounting code, Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 01/22] block: extend BLOCK_IO_ERROR event with nospace indicator, Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 07/22] IDE: MMIO IDE device control should be little endian, Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 10/22] block: rename BlockAcctType members to start with BLOCK_ instead of BDRV_, Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 11/22] block: Make the block accounting functions operate on BlockAcctStats, Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 06/22] thread-pool: Drop unnecessary includes, Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 08/22] block: Extract the BlockAcctStats structure, Kevin Wolf, 2014/09/12
- [Qemu-devel] [PULL 12/22] block/archipelago: Implement bdrv_truncate(), Kevin Wolf, 2014/09/12