summaryrefslogtreecommitdiffstats
path: root/qemu-io.c
diff options
context:
space:
mode:
authorPeter Maydell2014-10-22 17:39:49 +0200
committerPeter Maydell2014-10-22 17:39:49 +0200
commit8f4699d873bef81cec95db6da53d4c33f8caf4b9 (patch)
tree249e2a7bb71c26b66643162f98e2659d83c79d4d /qemu-io.c
parentMerge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20141015-2' into s... (diff)
parentblock: Make device model's references to BlockBackend strong (diff)
downloadqemu-8f4699d873bef81cec95db6da53d4c33f8caf4b9.tar.gz
qemu-8f4699d873bef81cec95db6da53d4c33f8caf4b9.tar.xz
qemu-8f4699d873bef81cec95db6da53d4c33f8caf4b9.zip
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block patches # gpg: Signature made Mon 20 Oct 2014 13:04:09 BST using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (28 commits) block: Make device model's references to BlockBackend strong block: Lift device model API into BlockBackend blockdev: Convert qmp_eject(), qmp_change_blockdev() to BlockBackend block/qapi: Convert qmp_query_block() to BlockBackend blockdev: Fix blockdev-add not to create DriveInfo blockdev: Drop superfluous DriveInfo member id pc87312: Drop unused members of PC87312State ide: Complete conversion from BlockDriverState to BlockBackend hw: Convert from BlockDriverState to BlockBackend, mostly virtio-blk: Rename VirtIOBlkConf variables to conf virtio-blk: Drop redundant VirtIOBlock member conf block: Rename BlockDriverCompletionFunc to BlockCompletionFunc block: Rename BlockDriverAIOCB* to BlockAIOCB* block: Eliminate DriveInfo member bdrv, use blk_by_legacy_dinfo() block: Merge BlockBackend and BlockDriverState name spaces block: Eliminate BlockDriverState member device_name[] block: Eliminate bdrv_iterate(), use bdrv_next() blockdev: Eliminate drive_del() block: Make BlockBackend own its BlockDriverState block: Code motion to get rid of stubs/blockdev.c ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/qemu-io.c b/qemu-io.c
index 66cf3ef4be..60f84dd72a 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -19,6 +19,7 @@
#include "qemu/option.h"
#include "qemu/config-file.h"
#include "qemu/readline.h"
+#include "sysemu/block-backend.h"
#include "block/block_int.h"
#include "trace/control.h"
@@ -26,6 +27,7 @@
static char *progname;
+static BlockBackend *qemuio_blk;
static BlockDriverState *qemuio_bs;
/* qemu-io commands passed using -c */
@@ -36,8 +38,9 @@ static ReadLineState *readline_state;
static int close_f(BlockDriverState *bs, int argc, char **argv)
{
- bdrv_unref(bs);
+ blk_unref(qemuio_blk);
qemuio_bs = NULL;
+ qemuio_blk = NULL;
return 0;
}
@@ -58,7 +61,8 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
return 1;
}
- qemuio_bs = bdrv_new("hda", &error_abort);
+ qemuio_blk = blk_new_with_bs("hda", &error_abort);
+ qemuio_bs = blk_bs(qemuio_blk);
if (growable) {
flags |= BDRV_O_PROTOCOL;
@@ -69,8 +73,9 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
name ? " device " : "", name ?: "",
error_get_pretty(local_err));
error_free(local_err);
- bdrv_unref(qemuio_bs);
+ blk_unref(qemuio_blk);
qemuio_bs = NULL;
+ qemuio_blk = NULL;
return 1;
}
@@ -481,9 +486,7 @@ int main(int argc, char **argv)
*/
bdrv_drain_all();
- if (qemuio_bs) {
- bdrv_unref(qemuio_bs);
- }
+ blk_unref(qemuio_blk);
g_free(readline_state);
return 0;
}