char: allocate CharDriverState as a single object

Use a single allocation for CharDriverState, this avoids extra
allocations & pointers, and is a step towards more object-oriented
CharDriver.

Gtk console is a bit peculiar, gd_vc_chr_set_echo() used to have a
temporary VirtualConsole to save the echo bit. Instead now, we consider
whether vcd->console is set or not, and restore the echo bit saved in
VCDriverState when calling gd_vc_vte_init().

The casts added are temporary, they are replaced with QOM type-safe
macros in a later patch in this series.

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:
Marc-André Lureau 2016-10-21 23:44:44 +03:00 committed by Paolo Bonzini
parent 5ebd67030c
commit 41ac54b253
10 changed files with 230 additions and 214 deletions

View file

@ -1733,6 +1733,7 @@ int gdbserver_start(const char *device)
CharDriverState *mon_chr;
ChardevCommon common = { 0 };
static const CharDriver driver = {
.instance_size = sizeof(CharDriverState),
.kind = -1,
.chr_write = gdb_monitor_write,
};