aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-01-27 00:49:13 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-02 11:33:53 +0400
commit1ce2610c106d925387669b3133fc18ea986f0476 (patch)
treebd08c41941ea2235cabde4c02739f6ca52ff07d7 /net
parenta9b1ca38c2b1f062f22d4847e3b4c848d0fb84c3 (diff)
char: make chr_fe_deinit() optionaly delete backend
This simplifies removing a backend for a frontend user (no need to retrieve the associated driver and separate delete call etc). NB: many frontends have questionable handling of ending a chardev. They should probably delete the backend to prevent broken reusage. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'net')
-rw-r--r--net/colo-compare.c8
-rw-r--r--net/filter-mirror.c6
-rw-r--r--net/vhost-user.c5
3 files changed, 7 insertions, 12 deletions
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 2fb75bcca4..6d500e1dc4 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -801,11 +801,9 @@ static void colo_compare_finalize(Object *obj)
{
CompareState *s = COLO_COMPARE(obj);
- qemu_chr_fe_set_handlers(&s->chr_pri_in, NULL, NULL, NULL, NULL,
- s->worker_context, true);
- qemu_chr_fe_set_handlers(&s->chr_sec_in, NULL, NULL, NULL, NULL,
- s->worker_context, true);
- qemu_chr_fe_deinit(&s->chr_out);
+ qemu_chr_fe_deinit(&s->chr_pri_in, false);
+ qemu_chr_fe_deinit(&s->chr_sec_in, false);
+ qemu_chr_fe_deinit(&s->chr_out, false);
g_main_loop_quit(s->compare_loop);
qemu_thread_join(&s->thread);
diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index a20330475c..52d978fce2 100644
--- a/net/filter-mirror.c
+++ b/net/filter-mirror.c
@@ -178,15 +178,15 @@ static void filter_mirror_cleanup(NetFilterState *nf)
{
MirrorState *s = FILTER_MIRROR(nf);
- qemu_chr_fe_deinit(&s->chr_out);
+ qemu_chr_fe_deinit(&s->chr_out, false);
}
static void filter_redirector_cleanup(NetFilterState *nf)
{
MirrorState *s = FILTER_REDIRECTOR(nf);
- qemu_chr_fe_deinit(&s->chr_in);
- qemu_chr_fe_deinit(&s->chr_out);
+ qemu_chr_fe_deinit(&s->chr_in, false);
+ qemu_chr_fe_deinit(&s->chr_out, false);
}
static void filter_mirror_setup(NetFilterState *nf, Error **errp)
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 526290d8c1..a042ec6a34 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -151,10 +151,7 @@ static void vhost_user_cleanup(NetClientState *nc)
s->vhost_net = NULL;
}
if (nc->queue_index == 0) {
- Chardev *chr = qemu_chr_fe_get_driver(&s->chr);
-
- qemu_chr_fe_deinit(&s->chr);
- object_unparent(OBJECT(chr));
+ qemu_chr_fe_deinit(&s->chr, true);
}
qemu_purge_queued_packets(nc);