summaryrefslogtreecommitdiff
path: root/ui/gtk.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-21 20:49:37 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2017-01-27 18:07:58 +0100
commitb68e956abe2ad0a1ecf53868e0bf1a61b418ded8 (patch)
tree2d25f219ee74ed5671959e92f9018ccd408cd35a /ui/gtk.c
parenta1698bf183a2fc05ff980e06c798408d5898bc48 (diff)
downloadqemu-b68e956abe2ad0a1ecf53868e0bf1a61b418ded8.tar.gz
char: move callbacks in CharDriver
This makes the code more declarative, and avoids duplicating the information on all instances. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'ui/gtk.c')
-rw-r--r--ui/gtk.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index 86368e38b7..608400b56d 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1703,6 +1703,12 @@ static CharDriverState *vcs[MAX_VCS];
static CharDriverState *gd_vc_handler(ChardevVC *vc, Error **errp)
{
+ static const CharDriver gd_vc_driver = {
+ .kind = CHARDEV_BACKEND_KIND_VC,
+ .chr_write = gd_vc_chr_write,
+ .chr_set_echo = gd_vc_chr_set_echo,
+ };
+
ChardevCommon *common = qapi_ChardevVC_base(vc);
CharDriverState *chr;
@@ -1711,14 +1717,11 @@ static CharDriverState *gd_vc_handler(ChardevVC *vc, Error **errp)
return NULL;
}
- chr = qemu_chr_alloc(common, errp);
+ chr = qemu_chr_alloc(&gd_vc_driver, common, errp);
if (!chr) {
return NULL;
}
- chr->chr_write = gd_vc_chr_write;
- chr->chr_set_echo = gd_vc_chr_set_echo;
-
/* Temporary, until gd_vc_vte_init runs. */
chr->opaque = g_new0(VirtualConsole, 1);