mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
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:
parent
313e45b5fe
commit
81517ba37a
48 changed files with 77 additions and 58 deletions
|
@ -543,7 +543,7 @@ static void compare_pri_chr_in(void *opaque, const uint8_t *buf, int size)
|
|||
|
||||
ret = net_fill_rstate(&s->pri_rs, buf, size);
|
||||
if (ret == -1) {
|
||||
qemu_chr_fe_set_handlers(&s->chr_pri_in, NULL, NULL, NULL,
|
||||
qemu_chr_fe_set_handlers(&s->chr_pri_in, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, true);
|
||||
error_report("colo-compare primary_in error");
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ static void compare_sec_chr_in(void *opaque, const uint8_t *buf, int size)
|
|||
|
||||
ret = net_fill_rstate(&s->sec_rs, buf, size);
|
||||
if (ret == -1) {
|
||||
qemu_chr_fe_set_handlers(&s->chr_sec_in, NULL, NULL, NULL,
|
||||
qemu_chr_fe_set_handlers(&s->chr_sec_in, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, true);
|
||||
error_report("colo-compare secondary_in error");
|
||||
}
|
||||
|
@ -588,9 +588,11 @@ static void *colo_compare_thread(void *opaque)
|
|||
s->worker_context = g_main_context_new();
|
||||
|
||||
qemu_chr_fe_set_handlers(&s->chr_pri_in, compare_chr_can_read,
|
||||
compare_pri_chr_in, NULL, s, s->worker_context, true);
|
||||
compare_pri_chr_in, NULL, NULL,
|
||||
s, s->worker_context, true);
|
||||
qemu_chr_fe_set_handlers(&s->chr_sec_in, compare_chr_can_read,
|
||||
compare_sec_chr_in, NULL, s, s->worker_context, true);
|
||||
compare_sec_chr_in, NULL, NULL,
|
||||
s, s->worker_context, true);
|
||||
|
||||
s->compare_loop = g_main_loop_new(s->worker_context, FALSE);
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ static void redirector_chr_read(void *opaque, const uint8_t *buf, int size)
|
|||
|
||||
if (ret == -1) {
|
||||
qemu_chr_fe_set_handlers(&s->chr_in, NULL, NULL, NULL,
|
||||
NULL, NULL, true);
|
||||
NULL, NULL, NULL, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ static void redirector_chr_event(void *opaque, int event)
|
|||
switch (event) {
|
||||
case CHR_EVENT_CLOSED:
|
||||
qemu_chr_fe_set_handlers(&s->chr_in, NULL, NULL, NULL,
|
||||
NULL, NULL, true);
|
||||
NULL, NULL, NULL, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -245,7 +245,7 @@ static void filter_redirector_setup(NetFilterState *nf, Error **errp)
|
|||
|
||||
qemu_chr_fe_set_handlers(&s->chr_in, redirector_chr_can_read,
|
||||
redirector_chr_read, redirector_chr_event,
|
||||
nf, NULL, true);
|
||||
NULL, nf, NULL, true);
|
||||
}
|
||||
|
||||
if (s->outdev) {
|
||||
|
|
|
@ -778,7 +778,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str,
|
|||
fwd->slirp = s->slirp;
|
||||
|
||||
qemu_chr_fe_set_handlers(&fwd->hd, guestfwd_can_read, guestfwd_read,
|
||||
NULL, fwd, NULL, true);
|
||||
NULL, NULL, fwd, NULL, true);
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue