From 9ba10c95a4a63ef453893ba16bf1c8e11a1d3c39 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 7 Oct 2014 13:59:08 +0200 Subject: block: Make BlockBackend own its BlockDriverState On BlockBackend destruction, unref its BlockDriverState. Replaces the callers' unrefs. This turns the pointer from BlockBackend to BlockDriverState into a strong reference, managed with bdrv_ref() / bdrv_unref(). The back-pointer remains weak. Signed-off-by: Markus Armbruster Reviewed-by: Max Reitz Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- qemu-io.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'qemu-io.c') diff --git a/qemu-io.c b/qemu-io.c index 8380734b08..60f84dd72a 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -38,7 +38,6 @@ 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; @@ -74,7 +73,6 @@ 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; @@ -488,9 +486,6 @@ 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; -- cgit v1.2.1