From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/2] numa: Turn simple union NumaOptions into a flat union
Date: Wed, 8 Feb 2017 17:04:23 +0100 [thread overview]
Message-ID: <1486569864-17005-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1486569864-17005-1-git-send-email-armbru@redhat.com>
Simple unions are simpler than flat unions in the schema, but more
complicated in C and on the QMP wire: there's extra indirection in C
and extra nesting on the wire, both pointless. They're best avoided
in new code.
NumaOptions isn't new, but it's only used internally, not in QMP.
Convert it to a flat union.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
numa.c | 4 ++--
qapi-schema.json | 8 ++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/numa.c b/numa.c
index 9f56be9..e01cb54 100644
--- a/numa.c
+++ b/numa.c
@@ -228,8 +228,8 @@ static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
}
switch (object->type) {
- case NUMA_OPTIONS_KIND_NODE:
- numa_node_parse(object->u.node.data, opts, &err);
+ case NUMA_OPTIONS_TYPE_NODE:
+ numa_node_parse(&object->u.node, opts, &err);
if (err) {
goto end;
}
diff --git a/qapi-schema.json b/qapi-schema.json
index cbdffdd..f9a9941 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -5545,6 +5545,12 @@
'events' : [ 'InputEvent' ] } }
##
+# @NumaOptionsType:
+##
+{ 'enum': 'NumaOptionsType',
+ 'data': [ 'node' ] }
+
+##
# @NumaOptions:
#
# A discriminated record of NUMA options. (for OptsVisitor)
@@ -5552,6 +5558,8 @@
# Since: 2.1
##
{ 'union': 'NumaOptions',
+ 'base': { 'type': 'NumaOptionsType' },
+ 'discriminator': 'type',
'data': {
'node': 'NumaNodeOptions' }}
--
2.7.4
next prev parent reply other threads:[~2017-02-08 16:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 16:04 [Qemu-devel] [PATCH 0/2] Flatten simple unions where we still can Markus Armbruster
2017-02-08 16:04 ` Markus Armbruster [this message]
2017-02-08 19:21 ` [Qemu-devel] [PATCH 1/2] numa: Turn simple union NumaOptions into a flat union Eric Blake
2017-02-09 7:26 ` Markus Armbruster
2017-02-08 16:04 ` [Qemu-devel] [PATCH 2/2] net: Turn simple union NetLegacyOptions " Markus Armbruster
2017-02-08 19:22 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1486569864-17005-2-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).