[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 08/19] chardev: Drop useless ChardevDummy type
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v2 08/19] chardev: Drop useless ChardevDummy type |
Date: |
Thu, 25 Feb 2016 16:38:37 -0700 |
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 <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
---
v2: add R-b
---
backends/baum.c | 2 +-
backends/msmouse.c | 2 +-
qemu-char.c | 6 +++---
qapi-schema.json | 15 ++++++---------
4 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/backends/baum.c b/backends/baum.c
index 374562a..c11320e 100644
--- a/backends/baum.c
+++ b/backends/baum.c
@@ -567,7 +567,7 @@ static CharDriverState *chr_baum_init(const char *id,
ChardevReturn *ret,
Error **errp)
{
- ChardevCommon *common = qapi_ChardevDummy_base(backend->u.braille);
+ ChardevCommon *common = backend->u.braille;
BaumDriverState *baum;
CharDriverState *chr;
brlapi_handle_t *handle;
diff --git a/backends/msmouse.c b/backends/msmouse.c
index 9a82efd..5e1833c 100644
--- a/backends/msmouse.c
+++ b/backends/msmouse.c
@@ -68,7 +68,7 @@ static CharDriverState *qemu_chr_open_msmouse(const char *id,
ChardevReturn *ret,
Error **errp)
{
- ChardevCommon *common = qapi_ChardevDummy_base(backend->u.msmouse);
+ ChardevCommon *common = backend->u.msmouse;
CharDriverState *chr;
chr = qemu_chr_alloc(common, errp);
diff --git a/qemu-char.c b/qemu-char.c
index cfc82bc..6a0fc74 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) {
@@ -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);
diff --git a/qapi-schema.json b/qapi-schema.json
index 7b8f2a1..66cc364 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3323,23 +3323,20 @@
#
# Since: 1.4 (testdev since 2.2)
##
-{ 'struct': 'ChardevDummy', 'data': { },
- 'base': 'ChardevCommon' }
-
{ 'union': 'ChardevBackend', 'data': { 'file' : 'ChardevFile',
'serial' : 'ChardevHostdev',
'parallel': 'ChardevHostdev',
'pipe' : 'ChardevHostdev',
'socket' : 'ChardevSocket',
'udp' : 'ChardevUdp',
- 'pty' : 'ChardevDummy',
- 'null' : 'ChardevDummy',
+ 'pty' : 'ChardevCommon',
+ 'null' : 'ChardevCommon',
'mux' : 'ChardevMux',
- 'msmouse': 'ChardevDummy',
- 'braille': 'ChardevDummy',
- 'testdev': 'ChardevDummy',
+ 'msmouse': 'ChardevCommon',
+ 'braille': 'ChardevCommon',
+ 'testdev': 'ChardevCommon',
'stdio' : 'ChardevStdio',
- 'console': 'ChardevDummy',
+ 'console': 'ChardevCommon',
'spicevmc' : 'ChardevSpiceChannel',
'spiceport' : 'ChardevSpicePort',
'vc' : 'ChardevVC',
--
2.5.0
- [Qemu-devel] [PATCH v2 00/19] easier unboxed visits/qapi implicit types, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 04/19] chardev: Shorten references into ChardevBackend, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 02/19] qapi-visit: Expose visit_type_FOO_members(), Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 01/19] qapi: Rename 'fields' to 'members' in internal interface, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 03/19] qapi: Update docs to match recent generator changes, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 06/19] ui: Shorten references into InputEvent, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 10/19] qapi-visit: Factor out gen_visit_members_call(), Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 07/19] qapi: Avoid use of 'data' member of qapi unions, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 08/19] chardev: Drop useless ChardevDummy type,
Eric Blake <=
- [Qemu-devel] [PATCH v2 09/19] qapi: Drop useless 'data' member of unions, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 05/19] util: Shorten references into SocketAddress, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 12/19] qapi: Fix command with named empty argument type, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 13/19] qapi-visit: Simplify visit of empty branch in union, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 11/19] qapi: Add type.is_empty() helper, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 15/19] qapi-visit: Move error check into gen_visit_members_call(), Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 16/19] qapi: Allow anonymous base for flat union, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 19/19] qapi: Make c_type() more OO-like, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 17/19] qapi: Use anonymous base in SchemaInfo, Eric Blake, 2016/02/25
- [Qemu-devel] [PATCH v2 18/19] qapi: Use anonymous base in CpuInfo, Eric Blake, 2016/02/25