summaryrefslogtreecommitdiffstats
path: root/qemu-char.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-03-04 08:42:40 -0700
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:49:12 -0600
commit4c3819b0558c57a94f6d3e356a17fe346cc93510 (patch)
tree01f1b51d3a9dcd14355ec49dc4a4bfdc3cd02f8e /qemu-char.c
parent78c57d0f93495670a12f048dd37cab5b6e11b80c (diff)
downloadhqemu-4c3819b0558c57a94f6d3e356a17fe346cc93510.zip
hqemu-4c3819b0558c57a94f6d3e356a17fe346cc93510.tar.gz
chardev: Drop useless ChardevDummy type
Commit d0d7708b made ChardevDummy be an empty wrapper type around ChardevCommon. But there is no technical reason for this indirection, so simplify the code by directly using the base type. Also change the fallback assignment to assign u.null rather than u.data, since a future patch will remove the data member of the C struct generated for QAPI unions. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1457106160-23614-1-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/qemu-char.c b/qemu-char.c
index af31102..e0147f3 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -420,7 +420,7 @@ static CharDriverState *qemu_chr_open_null(const char *id,
Error **errp)
{
CharDriverState *chr;
- ChardevCommon *common = qapi_ChardevDummy_base(backend->u.null);
+ ChardevCommon *common = backend->u.null;
chr = qemu_chr_alloc(common, errp);
if (!chr) {
@@ -1366,7 +1366,7 @@ static CharDriverState *qemu_chr_open_pty(const char *id,
PtyCharDriver *s;
int master_fd, slave_fd;
char pty_name[PATH_MAX];
- ChardevCommon *common = qapi_ChardevDummy_base(backend->u.pty);
+ ChardevCommon *common = backend->u.pty;
master_fd = qemu_openpty_raw(&slave_fd, pty_name);
if (master_fd < 0) {
@@ -2183,7 +2183,7 @@ static CharDriverState *qemu_chr_open_win_con(const char *id,
ChardevReturn *ret,
Error **errp)
{
- ChardevCommon *common = qapi_ChardevDummy_base(backend->u.console);
+ ChardevCommon *common = backend->u.console;
return qemu_chr_open_win_file(GetStdHandle(STD_OUTPUT_HANDLE),
common, errp);
}
@@ -3817,7 +3817,7 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
} else {
ChardevCommon *cc = g_new0(ChardevCommon, 1);
qemu_chr_parse_common(opts, cc);
- backend->u.data = cc;
+ backend->u.null = cc; /* Any ChardevCommon member would work */
}
ret = qmp_chardev_add(bid ? bid : id, backend, errp);
OpenPOWER on IntegriCloud