From fa19d02539a56ac20d03b2eef775be7ffcdd695a Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 Sep 2015 15:49:06 +0200 Subject: qemu-char: convert vc backend to data-driven creation Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- ui/console.c | 10 ++++++---- ui/gtk.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'ui') diff --git a/ui/console.c b/ui/console.c index aee6f21..cf649b2 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1962,7 +1962,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds) chr->init(chr); } -static CharDriverState *text_console_init(ChardevVC *vc) +static CharDriverState *text_console_init(ChardevVC *vc, Error **errp) { CharDriverState *chr; QemuConsole *s; @@ -1993,6 +1993,7 @@ static CharDriverState *text_console_init(ChardevVC *vc) if (!s) { g_free(chr); + error_setg(errp, "cannot create text console"); return NULL; } @@ -2012,9 +2013,10 @@ static CharDriverState *text_console_init(ChardevVC *vc) static VcHandler *vc_handler = text_console_init; -CharDriverState *vc_init(ChardevVC *vc) +static CharDriverState *vc_init(const char *id, ChardevBackend *backend, + ChardevReturn *ret, Error **errp) { - return vc_handler(vc); + return vc_handler(backend->vc, errp); } void register_vc_handler(VcHandler *handler) @@ -2094,7 +2096,7 @@ static void register_types(void) { type_register_static(&qemu_console_info); register_char_driver("vc", CHARDEV_BACKEND_KIND_VC, qemu_chr_parse_vc, - NULL); + vc_init); } type_init(register_types); diff --git a/ui/gtk.c b/ui/gtk.c index 2947838..47b37e1 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1591,7 +1591,7 @@ static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len) static int nb_vcs; static CharDriverState *vcs[MAX_VCS]; -static CharDriverState *gd_vc_handler(ChardevVC *unused) +static CharDriverState *gd_vc_handler(ChardevVC *unused, Error **errp) { CharDriverState *chr; -- cgit v1.1