mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
char: use qemu_chr_fe* functions with CharBackend argument
This also switches from qemu_chr_add_handlers() to qemu_chr_fe_set_handlers(). Note that qemu_chr_fe_set_handlers() now takes the focus when fe_open (qemu_chr_add_handlers() did take the focus) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-16-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
fbf3cc3a67
commit
5345fdb446
47 changed files with 437 additions and 409 deletions
|
@ -42,7 +42,7 @@ static void rng_egd_request_entropy(RngBackend *b, RngRequest *req)
|
|||
|
||||
/* XXX this blocks entire thread. Rewrite to use
|
||||
* qemu_chr_fe_write and background I/O callbacks */
|
||||
qemu_chr_fe_write_all(s->chr.chr, header, sizeof(header));
|
||||
qemu_chr_fe_write_all(&s->chr, header, sizeof(header));
|
||||
|
||||
size -= len;
|
||||
}
|
||||
|
@ -109,8 +109,8 @@ static void rng_egd_opened(RngBackend *b, Error **errp)
|
|||
}
|
||||
|
||||
/* FIXME we should resubmit pending requests when the CDS reconnects. */
|
||||
qemu_chr_add_handlers(s->chr.chr, rng_egd_chr_can_read,
|
||||
rng_egd_chr_read, NULL, s);
|
||||
qemu_chr_fe_set_handlers(&s->chr, rng_egd_chr_can_read,
|
||||
rng_egd_chr_read, NULL, s, NULL);
|
||||
}
|
||||
|
||||
static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)
|
||||
|
@ -129,9 +129,10 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)
|
|||
static char *rng_egd_get_chardev(Object *obj, Error **errp)
|
||||
{
|
||||
RngEgd *s = RNG_EGD(obj);
|
||||
CharDriverState *chr = qemu_chr_fe_get_driver(&s->chr);
|
||||
|
||||
if (s->chr.chr && s->chr.chr->label) {
|
||||
return g_strdup(s->chr.chr->label);
|
||||
if (chr && chr->label) {
|
||||
return g_strdup(chr->label);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -149,7 +150,7 @@ static void rng_egd_finalize(Object *obj)
|
|||
RngEgd *s = RNG_EGD(obj);
|
||||
|
||||
if (s->chr.chr) {
|
||||
qemu_chr_add_handlers(s->chr.chr, NULL, NULL, NULL, NULL);
|
||||
qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL, NULL, NULL);
|
||||
qemu_chr_fe_release(s->chr.chr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue