aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-22 12:52:55 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 15:27:21 +0200
commit5345fdb4467816c44f6752b3a1f4e73aa25919f9 (patch)
tree9930cf4370d2325d113408f7b314cd77aa43f8a3 /backends
parentfbf3cc3a67a7131e258764aa1f19d5324e9e9f7a (diff)
downloadqemu-arm-5345fdb4467816c44f6752b3a1f4e73aa25919f9.tar.gz
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>
Diffstat (limited to 'backends')
-rw-r--r--backends/rng-egd.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index e2f8189d62..d9e50bb085 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -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);
}