qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, benoit.canet@irqsave.net, armbru@redhat.com,
	mreitz@redhat.com, stefanha@redhat.com,
	xiawenc@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH v3 01/17] qapi-types/visit.py: Pass whole expr dict for structs
Date: Tue,  8 Oct 2013 14:16:18 +0200	[thread overview]
Message-ID: <1381234594-13968-2-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1381234594-13968-1-git-send-email-kwolf@redhat.com>

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 scripts/qapi-types.py | 11 ++++++++---
 scripts/qapi-visit.py |  8 ++++++--
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index 5222463..566fe5e 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -71,7 +71,7 @@ def generate_struct_fields(members):
                          c_name=c_var(argname))
         if structured:
             push_indent()
-            ret += generate_struct("", argname, argentry)
+            ret += generate_struct({ "field": argname, "data": argentry})
             pop_indent()
         else:
             ret += mcgen('''
@@ -81,7 +81,12 @@ def generate_struct_fields(members):
 
     return ret
 
-def generate_struct(structname, fieldname, members):
+def generate_struct(expr):
+
+    structname = expr.get('type', "")
+    fieldname = expr.get('field', "")
+    members = expr['data']
+
     ret = mcgen('''
 struct %(name)s
 {
@@ -417,7 +422,7 @@ if do_builtins:
 for expr in exprs:
     ret = "\n"
     if expr.has_key('type'):
-        ret += generate_struct(expr['type'], "", expr['data']) + "\n"
+        ret += generate_struct(expr) + "\n"
         ret += generate_type_cleanup_decl(expr['type'] + "List")
         fdef.write(generate_type_cleanup(expr['type'] + "List") + "\n")
         ret += generate_type_cleanup_decl(expr['type'])
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 597cca4..1e44004 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -120,7 +120,11 @@ if (!err) {
 ''')
     return ret
 
-def generate_visit_struct(name, members):
+def generate_visit_struct(expr):
+
+    name = expr['type']
+    members = expr['data']
+
     ret = generate_visit_struct_fields(name, "", "", members)
 
     ret += mcgen('''
@@ -472,7 +476,7 @@ if do_builtins:
 
 for expr in exprs:
     if expr.has_key('type'):
-        ret = generate_visit_struct(expr['type'], expr['data'])
+        ret = generate_visit_struct(expr)
         ret += generate_visit_list(expr['type'], expr['data'])
         fdef.write(ret)
 
-- 
1.8.1.4

  reply	other threads:[~2013-10-08 12:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08 12:16 [Qemu-devel] [PATCH v3 00/17] blockdev-add QMP command Kevin Wolf
2013-10-08 12:16 ` Kevin Wolf [this message]
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 02/17] qapi-types/visit.py: Inheritance for structs Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 03/17] blockdev: Introduce DriveInfo.enable_auto_del Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 04/17] blockdev: 'blockdev-add' QMP command Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 05/17] blockdev: Separate ID generation from DriveInfo creation Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 06/17] blockdev: Pass QDict to blockdev_init() Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 07/17] blockdev: Move parsing of 'media' option to drive_init Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 08/17] blockdev: Move parsing of 'if' " Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 09/17] blockdev: Moving parsing of geometry options " Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 10/17] blockdev: Move parsing of 'boot' option " Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 11/17] blockdev: Move bus/unit/index processing " Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 12/17] blockdev: Move virtio-blk device creation " Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 13/17] blockdev: Remove IF_* check for read-only blockdev_init Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 14/17] qemu-iotests: Check autodel behaviour for device_del Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 15/17] blockdev: Remove 'media' parameter from blockdev_init() Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 16/17] blockdev: Don't disable COR automatically with blockdev-add Kevin Wolf
2013-10-08 12:16 ` [Qemu-devel] [PATCH v3 17/17] blockdev: blockdev_init() error conversion Kevin Wolf

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=1381234594-13968-2-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=benoit.canet@irqsave.net \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=xiawenc@linux.vnet.ibm.com \
    /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).