mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
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 <armbru@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
8fb3c76c94
commit
9ba10c95a4
6 changed files with 7 additions and 53 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue