char: add backend hotswap handler

Frontends should have an interface to setup the handler of a backend change.
The interface will be used in the next commits

Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1499342940-56739-3-git-send-email-anton.nefedov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Anton Nefedov 2017-07-06 15:08:49 +03:00 committed by Paolo Bonzini
parent 313e45b5fe
commit 81517ba37a
48 changed files with 77 additions and 58 deletions

View file

@ -211,7 +211,7 @@ static void chr_closed_bh(void *opaque)
vhost_user_stop(queues, ncs);
qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event,
opaque, NULL, true);
NULL, opaque, NULL, true);
if (err) {
error_report_err(err);
@ -257,7 +257,7 @@ static void net_vhost_user_event(void *opaque, int event)
g_source_remove(s->watch);
s->watch = 0;
qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL,
qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL, NULL,
NULL, NULL, false);
aio_bh_schedule_oneshot(ctx, chr_closed_bh, opaque);
@ -305,7 +305,8 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
return -1;
}
qemu_chr_fe_set_handlers(&s->chr, NULL, NULL,
net_vhost_user_event, nc0->name, NULL, true);
net_vhost_user_event, NULL, nc0->name, NULL,
true);
} while (!s->started);
assert(s->vhost_net);