input: Convert to new qapi union layout

We have two issues with our qapi union layout:
1) Even though the QMP wire format spells the tag 'type', the
C code spells it 'kind', requiring some hacks in the generator.
2) The C struct uses an anonymous union, which places all tag
values in the same namespace as all non-variant members. This
leads to spurious collisions if a tag value matches a non-variant
member's name.

Make the conversion to the new layout for input-related code.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1445898903-12082-20-git-send-email-eblake@redhat.com>
[Commit message tweaked slightly]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Eric Blake 2015-10-26 16:34:58 -06:00 committed by Markus Armbruster
parent 130257dc44
commit 568c73a478
9 changed files with 125 additions and 123 deletions

View file

@ -2016,7 +2016,7 @@ static VcHandler *vc_handler = text_console_init;
static CharDriverState *vc_init(const char *id, ChardevBackend *backend,
ChardevReturn *ret, Error **errp)
{
return vc_handler(backend->vc, errp);
return vc_handler(backend->u.vc, errp);
}
void register_vc_handler(VcHandler *handler)
@ -2057,30 +2057,30 @@ static void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend,
{
int val;
backend->vc = g_new0(ChardevVC, 1);
backend->u.vc = g_new0(ChardevVC, 1);
val = qemu_opt_get_number(opts, "width", 0);
if (val != 0) {
backend->vc->has_width = true;
backend->vc->width = val;
backend->u.vc->has_width = true;
backend->u.vc->width = val;
}
val = qemu_opt_get_number(opts, "height", 0);
if (val != 0) {
backend->vc->has_height = true;
backend->vc->height = val;
backend->u.vc->has_height = true;
backend->u.vc->height = val;
}
val = qemu_opt_get_number(opts, "cols", 0);
if (val != 0) {
backend->vc->has_cols = true;
backend->vc->cols = val;
backend->u.vc->has_cols = true;
backend->u.vc->cols = val;
}
val = qemu_opt_get_number(opts, "rows", 0);
if (val != 0) {
backend->vc->has_rows = true;
backend->vc->rows = val;
backend->u.vc->has_rows = true;
backend->u.vc->rows = val;
}
}