mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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>
This commit is contained in:
parent
a1698bf183
commit
b68e956abe
10 changed files with 381 additions and 260 deletions
11
ui/gtk.c
11
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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue