Skip to contentSkip to conversation

qapi script: support enum as discriminator and other improves

RFC PATCH In review Wenchao Xia 2 participants 21 messages Nov 5, 2013 – Nov 7, 2013

lore
Share & tools
lore
#0 lore raw

cover qapi script: support enum as discriminator and other improves

Patch 1 and 9 fix two memleak issue.
Patch 2-6 add support for enum type as discriminator
Patch 7 add "_base" support which can reduce number of defined structure Patch 8 fix enum name generation issue, now AIOContext->AIO_CONTEXT, X86CPU-> X86_CPU.
Patch 10 are a butch of test cases.

Wenchao Xia (10):
1 qapi: fix memleak by add implict struct functions in dealloc visitor 2 qapi script: remember enum values
3 qapi script: check correctness of discriminator values in union 4 qapi script: code move for generate_enum_name()
5 qapi script: use same function to generate enum string
6 qapi script: not generate hidden enum type for pre-defined enum discriminator 7 qapi script: support direct inheritance for struct
8 qapi script: do not add "_" for every capitalized char in enum
9 tests: fix memleak in error path test for input visitor
10 tests: add cases for inherited struct and union with discriminator

 docs/qapi-code-gen.txt                  |   21 +++
 include/qapi/qmp/qerror.h               |    2 +-
 qapi/qapi-dealloc-visitor.c             |   20 +++
 scripts/qapi-types.py                   |   34 +++---
 scripts/qapi-visit.py                   |   50 +++++--
 scripts/qapi.py                         |   84 ++++++++++-
 target-i386/cpu.c                       |    2 +-
 tests/qapi-schema/comments.out          |    2 +-
 tests/qapi-schema/qapi-schema-test.json |   36 +++++
 tests/qapi-schema/qapi-schema-test.out  |   19 +++-
 tests/test-qmp-input-visitor.c          |  189 ++++++++++++++++++++++++
 tests/test-qmp-output-visitor.c         |  238 +++++++++++++++++++++++++++++++
 12 files changed, 660 insertions(+), 37 deletions(-)
#1 lore raw

RFC PATCH 1/10 qapi: fix memleak by add implict struct functions in dealloc visitor

Otherwise they are leaked in a qap_free_STRUCTURE() call.

---
 qapi/qapi-dealloc-visitor.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
qapi/qapi-dealloc-visitor.c +20 -0
index 1334de3..dc53545 100644
@@ -76,6 +76,24 @@ static void qapi_dealloc_end_struct(Visitor *v, Error **errp)
     }
 }
 
+static void qapi_dealloc_start_implicit_struct(Visitor *v,
+                                               void **obj,
+                                               size_t size,
+                                               Error **errp)
+{
+    QapiDeallocVisitor *qov = to_qov(v);
+    qapi_dealloc_push(qov, obj);
+}
+
+static void qapi_dealloc_end_implicit_struct(Visitor *v, Error **errp)
+{
+    QapiDeallocVisitor *qov = to_qov(v);
+    void **obj = qapi_dealloc_pop(qov);
+    if (obj) {
+        g_free(*obj);
+    }
+}
+
 static void qapi_dealloc_start_list(Visitor *v, const char *name, Error **errp)
 {
     QapiDeallocVisitor *qov = to_qov(v);
@@ -162,6 +180,8 @@ QapiDeallocVisitor *qapi_dealloc_visitor_new(void)
 
     v->visitor.start_struct = qapi_dealloc_start_struct;
     v->visitor.end_struct = qapi_dealloc_end_struct;
+    v->visitor.start_implicit_struct = qapi_dealloc_start_implicit_struct;
+    v->visitor.end_implicit_struct = qapi_dealloc_end_implicit_struct;
     v->visitor.start_list = qapi_dealloc_start_list;
     v->visitor.next_list = qapi_dealloc_next_list;
     v->visitor.end_list = qapi_dealloc_end_list;
Signature · 1 line
1.7.1
Reviewed-by on v1 1/10
#2 lore raw

Re: [Qemu-devel] [PATCH RFC 01/10] qapi: fix memleak by add implict struct functions in dealloc visitor

On 11/04/2013 05:37 PM, Wenchao Xia wrote:

s/add/adding/ in subject

Quoted 1 line

Otherwise they are leaked in a qap_free_STRUCTURE() call.

s/qap/qapi/

Quoted 6 lines
---
 qapi/qapi-dealloc-visitor.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#3 lore raw

RFC PATCH 2/10 qapi script: remember enum values

In reply to Wenchao Xia

Later other script will need to check the enum values.

---
 scripts/qapi.py                        |   18 ++++++++++++++----
 tests/qapi-schema/comments.out         |    2 +-
 tests/qapi-schema/qapi-schema-test.out |    4 +++-
 3 files changed, 18 insertions(+), 6 deletions(-)
scripts/qapi.py +14 -4
index 750e9fb..82f586e 100644
@@ -169,7 +169,7 @@ def parse_schema(fp):
 
     for expr in schema.exprs:
         if expr.has_key('enum'):
-            add_enum(expr['enum'])
+            add_enum(expr['enum'], expr['data'])
         elif expr.has_key('union'):
             add_union(expr)
             add_enum('%sKind' % expr['union'])
@@ -289,13 +289,23 @@ def find_union(name):
             return union
     return None
 
-def add_enum(name):
+def add_enum(name, enum_values = None):
     global enum_types
-    enum_types.append(name)
+    enum_types.append({"enum_name": name, "enum_values": enum_values})
+
+def find_enum(name):
+    global enum_types
+    for enum in enum_types:
+        if enum['enum_name'] == name:
+            return enum
+    return None
 
 def is_enum(name):
     global enum_types
-    return (name in enum_types)
+    for enum in enum_types:
+        if enum['enum_name'] == name:
+            return True
+    return False
 
 def c_type(name):
     if name == 'str':
tests/qapi-schema/comments.out +1 -1
index e3bd904..4ce3dcf 100644
@@ -1,3 +1,3 @@
 [OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])]
-['Status']
+[{'enum_name': 'Status', 'enum_values': ['good', 'bad', 'ugly']}]
 []
tests/qapi-schema/qapi-schema-test.out +3 -1
index 3851880..ad74cdb 100644
@@ -11,7 +11,9 @@
  OrderedDict([('command', 'user_def_cmd1'), ('data', OrderedDict([('ud1a', 'UserDefOne')]))]),
  OrderedDict([('command', 'user_def_cmd2'), ('data', OrderedDict([('ud1a', 'UserDefOne'), ('ud1b', 'UserDefOne')])), ('returns', 'UserDefTwo')]),
  OrderedDict([('type', 'UserDefOptions'), ('data', OrderedDict([('*i64', ['int']), ('*u64', ['uint64']), ('*u16', ['uint16']), ('*i64x', 'int'), ('*u64x', 'uint64')]))])]
-['EnumOne', 'UserDefUnionKind', 'UserDefNativeListUnionKind']
+[{'enum_name': 'EnumOne', 'enum_values': ['value1', 'value2', 'value3']},
+ {'enum_name': 'UserDefUnionKind', 'enum_values': None},
+ {'enum_name': 'UserDefNativeListUnionKind', 'enum_values': None}]
 [OrderedDict([('type', 'NestedEnumsOne'), ('data', OrderedDict([('enum1', 'EnumOne'), ('*enum2', 'EnumOne'), ('enum3', 'EnumOne'), ('*enum4', 'EnumOne')]))]),
  OrderedDict([('type', 'UserDefOne'), ('data', OrderedDict([('integer', 'int'), ('string', 'str'), ('*enum1', 'EnumOne')]))]),
  OrderedDict([('type', 'UserDefTwo'), ('data', OrderedDict([('string', 'str'), ('dict', OrderedDict([('string', 'str'), ('dict', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')])), ('*dict2', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')]))]))]))]),
Signature · 1 line
1.7.1
Reviewed-by on v1 2/10
#4 lore raw

Re: [Qemu-devel] [PATCH RFC 02/10] qapi script: remember enum values

Quoted 1 line · Wenchao Xia

Later other script will need to check the enum values.

s/script/scripts/

Quoted 8 lines
---
 scripts/qapi.py                        |   18 ++++++++++++++----
 tests/qapi-schema/comments.out         |    2 +-
 tests/qapi-schema/qapi-schema-test.out |    4 +++-
 3 files changed, 18 insertions(+), 6 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#5 lore raw

RFC PATCH 3/10 qapi script: check correctness of discriminator values in union

In reply to Wenchao Xia

It will check whether the values specfied are wrotten correctly when discriminator is a pre-defined enum type, which help check whether the schema is in good form.

It is allowed that, not every value in enum is used, so do not check that case.

---
 scripts/qapi-visit.py |   11 +++++++++++
 scripts/qapi.py       |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)
scripts/qapi-visit.py +11 -0
index c39e628..803d3eb 100644
@@ -249,6 +249,17 @@ def generate_visit_union(expr):
         assert not base
         return generate_visit_anon_union(name, members)
 
+    # If discriminator is specified and it is a pre-defined enum in schema,
+    # check its correctness
+    enum_define = descriminator_find_enum_define(expr)
+    if enum_define:
+        for key in members:
+            if not key in enum_define["enum_values"]:
+                sys.stderr.write("Discriminator value '%s' not found in "
+                                 "enum '%s'\n" %
+                                 (key, enum_define["enum_name"]))
+                sys.exit(1)
+
     ret = generate_visit_enum('%sKind' % name, members.keys())
 
     if base:
scripts/qapi.py +33 -0
index 82f586e..235df4f 100644
@@ -383,3 +383,36 @@ def guardend(name):
 
 ''',
                  name=guardname(name))
+
+# This function can be used to check whether "base" is valid
+def find_base_fields(base):
+    base_struct_define = find_struct(base)
+    if not base_struct_define:
+        return None
+    return base_struct_define.get('data')
+
+# Return the descriminator enum define, if discriminator is specified in
+# @expr and it is a pre-defined enum type
+def descriminator_find_enum_define(expr):
+    discriminator = expr.get('discriminator')
+    base = expr.get('base')
+
+    # Only support discriminator when base present
+    if not (discriminator and base):
+        return None
+
+    base_fields = find_base_fields(base)
+
+    if not base_fields:
+        sys.stderr.write("Base '%s' is not a valid type\n"
+                         % base)
+        sys.exit(1)
+
+    descriminator_type = base_fields.get(discriminator)
+
+    if not descriminator_type:
+        sys.stderr.write("Discriminator '%s' not found in schema\n"
+                         % discriminator)
+        sys.exit(1)
+
+    return find_enum(descriminator_type)
Signature · 1 line
1.7.1
#6 lore raw

Re: [Qemu-devel] [PATCH RFC 03/10] qapi script: check correctness of discriminator values in union

Quoted 1 line · Wenchao Xia

It will check whether the values specfied are wrotten correctly when

s/specfied/specified/
s/wrotten/written/

Quoted 4 lines

discriminator is a pre-defined enum type, which help check whether the schema is in good form.

It is allowed that, not every value in enum is used, so do not check

s/that,/that/

Quoted 1 line

that case.

Why do you allow partial coverage? That feels like an accident waiting to happen. Does the user get a sane error message if they request an enum value that wasn't mapped to a union branch? I think it would be wiser to mandate that if the discriminator is an enum, then the union must cover all values of the enum.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+# Return the descriminator enum define, if discriminator is specified in

s/descriminator/discriminator/

scripts/qapi.py def guardend(name): · line 396

Quoted 2 lines
scripts/qapi.py +2 -0
+# @expr and it is a pre-defined enum type
+def descriminator_find_enum_define(expr):

s/descriminator/discriminator/ - and fix all callers

Quoted 5 lines
scripts/qapi.py +5 -0
+    discriminator = expr.get('discriminator')
+    base = expr.get('base')
+
+    # Only support discriminator when base present
+    if not (discriminator and base):

scripts/qapi.py def guardend(name): · line 411

Quoted 10 lines
scripts/qapi.py +10 -0
+        return None
+
+    base_fields = find_base_fields(base)
+
+    if not base_fields:
+        sys.stderr.write("Base '%s' is not a valid type\n"
+                         % base)
+        sys.exit(1)
+
+    descriminator_type = base_fields.get(discriminator)

s/descriminator/discriminator/

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#7 lore raw

Re: [Qemu-devel] [PATCH RFC 03/10] qapi script: check correctness of discriminator values in union

Quoted 13 lines · Eric Blake
Quoted 1 line · Wenchao Xia

It will check whether the values specfied are wrotten correctly when

s/specfied/specified/
s/wrotten/written/

Quoted 4 lines

discriminator is a pre-defined enum type, which help check whether the schema is in good form.

It is allowed that, not every value in enum is used, so do not check

s/that,/that/

Quoted 8 lines
Quoted 1 line

that case.

Why do you allow partial coverage? That feels like an accident waiting to happen. Does the user get a sane error message if they request an enum value that wasn't mapped to a union branch? I think it would be wiser to mandate that if the discriminator is an enum, then the union must cover all values of the enum.

abort() will be called in qapi-visit.c, it is OK for output visitor,
but bad for input visitor since user input may trigger it. I think change abort() to error_set() could solve the problem, then we allow map part of enum value.

Quoted 28 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+# Return the descriminator enum define, if discriminator is specified in

s/descriminator/discriminator/

scripts/qapi.py def guardend(name): · line 396

Quoted 2 lines
scripts/qapi.py +2 -0
+# @expr and it is a pre-defined enum type
+def descriminator_find_enum_define(expr):

s/descriminator/discriminator/ - and fix all callers

Quoted 5 lines
scripts/qapi.py +5 -0
+    discriminator = expr.get('discriminator')
+    base = expr.get('base')
+
+    # Only support discriminator when base present
+    if not (discriminator and base):

scripts/qapi.py def guardend(name): · line 411

Quoted 10 lines
scripts/qapi.py +10 -0
+        return None
+
+    base_fields = find_base_fields(base)
+
+    if not base_fields:
+        sys.stderr.write("Base '%s' is not a valid type\n"
+                         % base)
+        sys.exit(1)
+
+    descriminator_type = base_fields.get(discriminator)

s/descriminator/discriminator/

#8 lore raw

RFC PATCH 4/10 qapi script: code move for generate_enum_name()

In reply to Wenchao Xia

Later both qapi-types.py and qapi-visit.py need a common function for enum name generation.

---
 scripts/qapi-types.py |   10 ----------
 scripts/qapi.py       |   10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)
scripts/qapi-types.py +0 -10
index 4a1652b..88bf76a 100644
@@ -127,16 +127,6 @@ const char *%(name)s_lookup[] = {
 ''')
     return ret
 
-def generate_enum_name(name):
-    if name.isupper():
-        return c_fun(name, False)
-    new_name = ''
-    for c in c_fun(name, False):
-        if c.isupper():
-            new_name += '_'
-        new_name += c
-    return new_name.lstrip('_').upper()
-
 def generate_enum(name, values):
     lookup_decl = mcgen('''
 extern const char *%(name)s_lookup[];
scripts/qapi.py +10 -0
index 235df4f..9e2dd70 100644
@@ -416,3 +416,13 @@ def descriminator_find_enum_define(expr):
         sys.exit(1)
 
     return find_enum(descriminator_type)
+
+def generate_enum_name(name):
+    if name.isupper():
+        return c_fun(name, False)
+    new_name = ''
+    for c in c_fun(name, False):
+        if c.isupper():
+            new_name += '_'
+        new_name += c
+    return new_name.lstrip('_').upper()
Signature · 1 line
1.7.1
#9 lore raw

RFC PATCH 5/10 qapi script: use same function to generate enum string

In reply to Wenchao Xia

One function one rule, so the enum string generating have same behavior for different caller. If multiple caller exist for one enum define in schema, it is for sure the generated string is identical.

Note before the patch qapi-visit.py used custom function to generate the string in union visit, although the patch changes it, the final string generated is not changed. The custom function used before will met problem when capitalized discriminator value is introduced.

---
 scripts/qapi-types.py |    6 +++---
 scripts/qapi-visit.py |    8 +++++---
 scripts/qapi.py       |   15 +++++++++++----
 3 files changed, 19 insertions(+), 10 deletions(-)
scripts/qapi-types.py +3 -3
index 88bf76a..914f055 100644
@@ -144,11 +144,11 @@ typedef enum %(name)s
 
     i = 0
     for value in enum_values:
+        enum_full_value_string = generate_enum_full_value_string(name, value)
         enum_decl += mcgen('''
-    %(abbrev)s_%(value)s = %(i)d,
+    %(enum_full_value_string)s = %(i)d,
 ''',
-                     abbrev=de_camel_case(name).upper(),
-                     value=generate_enum_name(value),
+                     enum_full_value_string=enum_full_value_string,
                      i=i)
         i += 1
 
scripts/qapi-visit.py +5 -3
index 803d3eb..9fc7c4c 100644
@@ -261,6 +261,7 @@ def generate_visit_union(expr):
                 sys.exit(1)
 
     ret = generate_visit_enum('%sKind' % name, members.keys())
+    discriminator_type_name = '%sKind' % (name)
 
     if base:
         base_fields = find_struct(base)['data']
@@ -313,13 +314,14 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **
                     visit_end_implicit_struct(m, &err);
                 }'''
 
+        enum_full_value_string = \
+                  generate_enum_full_value_string(discriminator_type_name, key)
         ret += mcgen('''
-            case %(abbrev)s_KIND_%(enum)s:
+            case %(enum_full_value_string)s:
                 ''' + fmt + '''
                 break;
 ''',
-                abbrev = de_camel_case(name).upper(),
-                enum = c_fun(de_camel_case(key),False).upper(),
+                enum_full_value_string = enum_full_value_string,
                 c_type=type_name(members[key]),
                 c_name=c_fun(key))
 
scripts/qapi.py +11 -4
index 9e2dd70..43a3720 100644
@@ -417,12 +417,19 @@ def descriminator_find_enum_define(expr):
 
     return find_enum(descriminator_type)
 
-def generate_enum_name(name):
-    if name.isupper():
-        return c_fun(name, False)
+def _generate_enum_value_string(value):
+    if value.isupper():
+        return c_fun(value, False)
     new_name = ''
-    for c in c_fun(name, False):
+    for c in c_fun(value, False):
         if c.isupper():
             new_name += '_'
         new_name += c
     return new_name.lstrip('_').upper()
+
+def generate_enum_full_value_string(enum_name, enum_value):
+    # generate abbrev string
+    abbrev_string = de_camel_case(enum_name).upper()
+    # generate value string
+    value_string = _generate_enum_value_string(enum_value)
+    return "%s_%s" % (abbrev_string, value_string)
Signature · 1 line
1.7.1
#10 lore raw

RFC PATCH 6/10 qapi script: not generate hidden enum type for pre-defined enum discriminator

In reply to Wenchao Xia

By default, any union will automatically generate a enum type as "[UnionName]Kind" in C code, and it is duplicated when the discriminator is specified as a pre-defined enum type in schema. After this patch, the pre-defined enum type will be really used as the switch case condition in generated C code.

In short, enum type as discriminator is fully supported now.

---
 scripts/qapi-types.py |   18 ++++++++++++++----
 scripts/qapi-visit.py |   19 ++++++++++++++-----
 scripts/qapi.py       |    4 +++-
 3 files changed, 31 insertions(+), 10 deletions(-)
scripts/qapi-types.py +14 -4
index 914f055..a096c36 100644
@@ -201,14 +201,21 @@ def generate_union(expr):
     base = expr.get('base')
     discriminator = expr.get('discriminator')
 
+    enum_define = descriminator_find_enum_define(expr)
+    if enum_define:
+        discriminator_type_name = enum_define['enum_name']
+    else:
+        discriminator_type_name = '%sKind' % (name)
+
     ret = mcgen('''
 struct %(name)s
 {
-    %(name)sKind kind;
+    %(discriminator_type_name)s kind;
     union {
         void *data;
 ''',
-                name=name)
+                name=name,
+                discriminator_type_name=discriminator_type_name)
 
     for key in typeinfo:
         ret += mcgen('''
@@ -389,8 +396,11 @@ for expr in exprs:
         fdef.write(generate_enum_lookup(expr['enum'], expr['data']))
     elif expr.has_key('union'):
         ret += generate_fwd_struct(expr['union'], expr['data']) + "\n"
-        ret += generate_enum('%sKind' % expr['union'], expr['data'].keys())
-        fdef.write(generate_enum_lookup('%sKind' % expr['union'], expr['data'].keys()))
+        enum_define = descriminator_find_enum_define(expr)
+        if not enum_define:
+            ret += generate_enum('%sKind' % expr['union'], expr['data'].keys())
+            fdef.write(generate_enum_lookup('%sKind' % expr['union'],
+                                            expr['data'].keys()))
         if expr.get('discriminator') == {}:
             fdef.write(generate_anon_union_qtypes(expr))
     else:
scripts/qapi-visit.py +14 -5
index 9fc7c4c..2b13ad0 100644
@@ -260,8 +260,12 @@ def generate_visit_union(expr):
                                  (key, enum_define["enum_name"]))
                 sys.exit(1)
 
-    ret = generate_visit_enum('%sKind' % name, members.keys())
-    discriminator_type_name = '%sKind' % (name)
+        ret = ""
+        discriminator_type_name = enum_define['enum_name']
+    else:
+        ret = generate_visit_enum('%sKind' % name, members.keys())
+        discriminator_type_name = '%sKind' % (name)
+
 
     if base:
         base_fields = find_struct(base)['data']
@@ -296,11 +300,12 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **
 
     pop_indent()
     ret += mcgen('''
-        visit_type_%(name)sKind(m, &(*obj)->kind, "%(type)s", &err);
+        visit_type_%(discriminator_type_name)s(m, &(*obj)->kind, "%(type)s", &err);
         if (!err) {
             switch ((*obj)->kind) {
 ''',
-                 name=name, type="type" if not discriminator else discriminator)
+                 discriminator_type_name=discriminator_type_name,
+                 type="type" if not discriminator else discriminator)
 
     for key in members:
         if not discriminator:
@@ -514,7 +519,11 @@ for expr in exprs:
         ret += generate_visit_list(expr['union'], expr['data'])
         fdef.write(ret)
 
-        ret = generate_decl_enum('%sKind' % expr['union'], expr['data'].keys())
+        enum_define = descriminator_find_enum_define(expr)
+        ret = ""
+        if not enum_define:
+            ret = generate_decl_enum('%sKind' % expr['union'],
+                                     expr['data'].keys())
         ret += generate_declaration(expr['union'], expr['data'])
         fdecl.write(ret)
     elif expr.has_key('enum'):
scripts/qapi.py +3 -1
index 43a3720..8e50015 100644
@@ -172,7 +172,9 @@ def parse_schema(fp):
             add_enum(expr['enum'], expr['data'])
         elif expr.has_key('union'):
             add_union(expr)
-            add_enum('%sKind' % expr['union'])
+            enum_define = descriminator_find_enum_define(expr)
+            if not enum_define:
+                add_enum('%sKind' % expr['union'])
         elif expr.has_key('type'):
             add_struct(expr)
         exprs.append(expr)
Signature · 1 line
1.7.1
#11 lore raw

RFC PATCH 7/10 qapi script: support direct inheritance for struct

In reply to Wenchao Xia

Now it is possible to inherit another struct inside data directly, which saves trouble to define trivial structure.

---
 docs/qapi-code-gen.txt |   21 +++++++++++++++++++++
 scripts/qapi-visit.py  |   14 ++++++++++----
 2 files changed, 31 insertions(+), 4 deletions(-)
docs/qapi-code-gen.txt +21 -0
index 0728f36..3e42ff4 100644
@@ -70,6 +70,27 @@ both fields like this:
  { "file": "/some/place/my-image",
    "backing": "/some/place/my-backing-file" }
 
+It is possible to directly inherit other struct by keyword '_base':
+
+ { 'type': 'NetworkConnectionInfo', 'data': { 'host': 'str', 'service': 'str' } }
+ { 'type': 'VncConnectionInfo',
+   'data': {
+      'server': {
+          '_base': 'NetworkConnectionInfo',
+          '*auth': 'str' },
+      'client': 'NetworkConnectionInfo'
+      } }
+
+Result on the wire could be:
+
+{
+  "server": { "host": "192.168.1.1",
+              "service": "8080",
+              "auth': "none" },
+  "client": { "host": "192.168.1.2",
+              "service": "1223" }
+}
+
 === Enumeration types ===
 
 An enumeration type is a dictionary containing a single key whose value is a
scripts/qapi-visit.py +10 -4
index 2b13ad0..f0f0942 100644
@@ -17,7 +17,7 @@ import os
 import getopt
 import errno
 
-def generate_visit_struct_fields(name, field_prefix, fn_prefix, members, base = None):
+def generate_visit_struct_fields(name, field_prefix, fn_prefix, members, base = None, base_name = 'base'):
     substructs = []
     ret = ''
     full_name = name if not fn_prefix else "%s_%s" % (name, fn_prefix)
@@ -30,8 +30,14 @@ def generate_visit_struct_fields(name, field_prefix, fn_prefix, members, base =
                 nested_fn_prefix = "%s_%s" % (fn_prefix, argname)
 
             nested_field_prefix = "%s%s." % (field_prefix, argname)
+
+            _base = argentry.get('_base')
+            if _base:
+                del argentry['_base']
+
             ret += generate_visit_struct_fields(name, nested_field_prefix,
-                                                nested_fn_prefix, argentry)
+                                                nested_fn_prefix, argentry,
+                                                _base, '_base')
 
     ret += mcgen('''
 
@@ -44,7 +50,7 @@ static void visit_type_%(full_name)s_fields(Visitor *m, %(name)s ** obj, Error *
 
     if base:
         ret += mcgen('''
-visit_start_implicit_struct(m, obj ? (void**) &(*obj)->%(c_name)s : NULL, sizeof(%(type)s), &err);
+visit_start_implicit_struct(m, obj ? (void**) &(*obj)->%(c_prefix)s%(c_name)s : NULL, sizeof(%(type)s), &err);
 if (!err) {
     visit_type_%(type)s_fields(m, obj ? &(*obj)->%(c_prefix)s%(c_name)s : NULL, &err);
     error_propagate(errp, err);
@@ -53,7 +59,7 @@ if (!err) {
 }
 ''',
                      c_prefix=c_var(field_prefix),
-                     type=type_name(base), c_name=c_var('base'))
+                     type=type_name(base), c_name=c_var(base_name))
 
     for argname, argentry, optional, structured in parse_args(members):
         if optional:
Signature · 1 line
1.7.1
#12 lore raw

Re: [Qemu-devel] [PATCH RFC 07/10] qapi script: support direct inheritance for struct

Quoted 14 lines · Wenchao Xia

Now it is possible to inherit another struct inside data directly, which saves trouble to define trivial structure.

---
 docs/qapi-code-gen.txt |   21 +++++++++++++++++++++
 scripts/qapi-visit.py  |   14 ++++++++++----
 2 files changed, 31 insertions(+), 4 deletions(-)
docs/qapi-code-gen.txt +0 -0
index 0728f36..3e42ff4 100644

docs/qapi-code-gen.txt both fields like this: · line 79

Quoted 10 lines
docs/qapi-code-gen.txt +7 -0
@@ -70,6 +70,27 @@ both fields like this:
  { "file": "/some/place/my-image",
    "backing": "/some/place/my-backing-file" }
 
+It is possible to directly inherit other struct by keyword '_base':
+
+ { 'type': 'NetworkConnectionInfo', 'data': { 'host': 'str', 'service': 'str' } }
+ { 'type': 'VncConnectionInfo',
+   'data': {
+      'server': {
+          '_base': 'NetworkConnectionInfo',

Interesting idea for shorthand. However, I would suggest that you pick a different character than '_', since '_' is valid in names. That is, we already have special handling of leading '*' to mark a field as optional, so I suggest something like '^' to mark a base class. By using a non-name character, it becomes more obvious that the leading character has a special meaning to the qapi generator.

I'm also not convinced yet that we want this shorthand; in particular, I'm worried whether it will make the introspection patches harder to write.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#13 lore raw

Re: [Qemu-devel] [PATCH RFC 07/10] qapi script: support direct inheritance for struct

Quoted 33 lines · Eric Blake
Quoted 14 lines · Wenchao Xia

Now it is possible to inherit another struct inside data directly, which saves trouble to define trivial structure.

---
  docs/qapi-code-gen.txt |   21 +++++++++++++++++++++
  scripts/qapi-visit.py  |   14 ++++++++++----
  2 files changed, 31 insertions(+), 4 deletions(-)
docs/qapi-code-gen.txt +0 -0
index 0728f36..3e42ff4 100644

docs/qapi-code-gen.txt both fields like this: · line 79

Quoted 10 lines
docs/qapi-code-gen.txt +7 -0
@@ -70,6 +70,27 @@ both fields like this:
   { "file": "/some/place/my-image",
     "backing": "/some/place/my-backing-file" }
 
+It is possible to directly inherit other struct by keyword '_base':
+
+ { 'type': 'NetworkConnectionInfo', 'data': { 'host': 'str', 'service': 'str' } }
+ { 'type': 'VncConnectionInfo',
+   'data': {
+      'server': {
+          '_base': 'NetworkConnectionInfo',

Interesting idea for shorthand. However, I would suggest that you pick a different character than '_', since '_' is valid in names. That is, we already have special handling of leading '*' to mark a field as optional, so I suggest something like '^' to mark a base class. By using a non-name character, it becomes more obvious that the leading character has a special meaning to the qapi generator.

Quoted 3 lines

I'm also not convinced yet that we want this shorthand; in particular, I'm worried whether it will make the introspection patches harder to write.

I am not sure about this approach either, so put RFC tag on it. The
purpose is allow not to define structures that would be only used once.

What instrospection patch do you mean? Python instrospection
mechnism? You mean there is a python utility which recognize only keyword "base" now?

#14 lore raw

Re: [Qemu-devel] [PATCH RFC 07/10] qapi script: support direct inheritance for struct

Quoted 14 lines · Wenchao Xia
Quoted 10 lines

docs/qapi-code-gen.txt both fields like this: · line 79

Quoted 2 lines
docs/qapi-code-gen.txt +2 -0
+      'server': {
+          '_base': 'NetworkConnectionInfo',

Interesting idea for shorthand. However, I would suggest that you pick a different character than '_', since '_' is valid in names. That is, we already have special handling of leading '*' to mark a field as optional, so I suggest something like '^' to mark a base class. By using a non-name character, it becomes more obvious that the leading character has a special meaning to the qapi generator.

Quoted 4 lines

I'm also not convinced yet that we want this shorthand; in particular, I'm worried whether it will make the introspection patches harder to write.

Quoted 6 lines

I am not sure about this approach either, so put RFC tag on it. The
purpose is allow not to define structures that would be only used once.

What instrospection patch do you mean? Python instrospection
mechnism? You mean there is a python utility which recognize only keyword "base" now?

No, I'm talking about Amos' patches to expose the qapi to the user via a QMP command. Last version proposed was here:
https://lists.gnu.org/archive/html/qemu-devel/2013-07/msg02494.html
although with the addition of discriminated union types in the meantime, my understanding is Amos is planning on posting another version soon for the 1.8 timeframe.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#15 lore raw

Re: [Qemu-devel] [PATCH RFC 07/10] qapi script: support direct inheritance for struct

Quoted 22 lines · Eric Blake
Quoted 14 lines · Wenchao Xia
Quoted 10 lines

docs/qapi-code-gen.txt both fields like this: · line 79

Quoted 2 lines
docs/qapi-code-gen.txt +2 -0
+      'server': {
+          '_base': 'NetworkConnectionInfo',

Interesting idea for shorthand. However, I would suggest that you pick a different character than '_', since '_' is valid in names. That is, we already have special handling of leading '*' to mark a field as optional, so I suggest something like '^' to mark a base class. By using a non-name character, it becomes more obvious that the leading character has a special meaning to the qapi generator.

Quoted 4 lines

I'm also not convinced yet that we want this shorthand; in particular, I'm worried whether it will make the introspection patches harder to write.

Quoted 6 lines

I am not sure about this approach either, so put RFC tag on it. The
purpose is allow not to define structures that would be only used once.

What instrospection patch do you mean? Python instrospection
mechnism? You mean there is a python utility which recognize only keyword "base" now?

Quoted 7 lines

No, I'm talking about Amos' patches to expose the qapi to the user via a QMP command. Last version proposed was here:
https://lists.gnu.org/archive/html/qemu-devel/2013-07/msg02494.html
although with the addition of discriminated union types in the meantime, my understanding is Amos is planning on posting another version soon for the 1.8 timeframe.

I'll drop this patch now.

#16 lore raw

RFC PATCH 8/10 qapi script: do not add "_" for every capitalized char in enum

In reply to Wenchao Xia

Now "enum AIOContext" will generate AIO_CONTEXT instead of A_I_O_CONTEXT, "X86CPU" will generate X86_CPU instead of X86_C_P_U.

---
 include/qapi/qmp/qerror.h |    2 +-
 scripts/qapi.py           |   26 +++++++++++++++++++-------
 target-i386/cpu.c         |    2 +-
 3 files changed, 21 insertions(+), 9 deletions(-)
include/qapi/qmp/qerror.h +1 -1
index c30c2f6..6fa07b4 100644
@@ -160,7 +160,7 @@ void assert_no_error(Error *err);
     ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax"
 
 #define QERR_KVM_MISSING_CAP \
-    ERROR_CLASS_K_V_M_MISSING_CAP, "Using KVM without %s, %s unavailable"
+    ERROR_CLASS_KVM_MISSING_CAP, "Using KVM without %s, %s unavailable"
 
 #define QERR_MIGRATION_ACTIVE \
     ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress"
scripts/qapi.py +19 -7
index 8e50015..9f5b63e 100644
@@ -419,19 +419,31 @@ def descriminator_find_enum_define(expr):
 
     return find_enum(descriminator_type)
 
-def _generate_enum_value_string(value):
+# ENUMName -> ENUM_NAME, EnumName1 -> ENUM_NAME1
+# ENUM_NAME -> ENUM_NAME, ENUM_NAME1 -> ENUM_NAME1, ENUM_Name2 -> ENUM_NAME2
+# ENUM24_Name -> ENUM24_NAME
+def _generate_enum_string(value):
+    c_fun_str = c_fun(value, False)
     if value.isupper():
-        return c_fun(value, False)
+        return c_fun_str
+
     new_name = ''
-    for c in c_fun(value, False):
-        if c.isupper():
-            new_name += '_'
+    l = len(c_fun_str)
+    for i in range(l):
+        c = c_fun_str[i]
+        # When c is upper and no "_" appear before, do more check
+        if c.isupper() and (i > 0) and c_fun_str[i - 1] != "_":
+            # Case 1: Next string is lower
+            # Case 2: previous string is digit
+            if (i < (l - 1) and c_fun_str[i + 1].islower()) or \
+               c_fun_str[i - 1].isdigit():
+                new_name += '_'
         new_name += c
     return new_name.lstrip('_').upper()
 
 def generate_enum_full_value_string(enum_name, enum_value):
     # generate abbrev string
-    abbrev_string = de_camel_case(enum_name).upper()
+    abbrev_string = _generate_enum_string(enum_name)
     # generate value string
-    value_string = _generate_enum_value_string(enum_value)
+    value_string = _generate_enum_string(enum_value)
     return "%s_%s" % (abbrev_string, value_string)
target-i386/cpu.c +1 -1
index 864c80e..6ba1945 100644
@@ -315,7 +315,7 @@ typedef struct X86RegisterInfo32 {
 } X86RegisterInfo32;
 
 #define REGISTER(reg) \
-    [R_##reg] = { .name = #reg, .qapi_enum = X86_C_P_U_REGISTER32_##reg }
+    [R_##reg] = { .name = #reg, .qapi_enum = X86_CPU_REGISTER32_##reg }
 X86RegisterInfo32 x86_reg_info_32[CPU_NB_REGS32] = {
     REGISTER(EAX),
     REGISTER(ECX),
Signature · 1 line
1.7.1
#17 lore raw

RFC PATCH 9/10 tests: fix memleak in error path test for input visitor

In reply to Wenchao Xia
---
 tests/test-qmp-input-visitor.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/test-qmp-input-visitor.c +1 -0
index 0beb8fb..1e1c6fa 100644
@@ -604,6 +604,7 @@ static void test_visitor_in_errors(TestInputVisitorData *data,
     g_assert(error_is_set(&errp));
     g_assert(p->string == NULL);
 
+    error_free(errp);
     g_free(p->string);
     g_free(p);
 }
Signature · 1 line
1.7.1
Reviewed-by on v1 9/10
#18 lore raw

Re: [Qemu-devel] [PATCH RFC 09/10] tests: fix memleak in error path test for input visitor

Quoted 5 lines · Wenchao Xia
---
 tests/test-qmp-input-visitor.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

You should repost your mem-leak patches for qemu-stable as an independent thread marked "for-1.7", without RFC, to ensure that they are applied in a timely manner without waiting for the rest of this series.

Quoted 14 lines
tests/test-qmp-input-visitor.c +1 -0
index 0beb8fb..1e1c6fa 100644
@@ -604,6 +604,7 @@ static void test_visitor_in_errors(TestInputVisitorData *data,
     g_assert(error_is_set(&errp));
     g_assert(p->string == NULL);
 
+    error_free(errp);
     g_free(p->string);
     g_free(p);
 }
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#19 lore raw

Re: [Qemu-devel] [PATCH RFC 09/10] tests: fix memleak in error path test for input visitor

Quoted 7 lines · Eric Blake
Quoted 5 lines · Wenchao Xia
---
  tests/test-qmp-input-visitor.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
Quoted 6 lines

You should repost your mem-leak patches for qemu-stable as an independent thread marked "for-1.7", without RFC, to ensure that they are applied in a timely manner without waiting for the rest of this series.

OK, will resend.

Quoted 15 lines
Quoted 14 lines
tests/test-qmp-input-visitor.c +1 -0
index 0beb8fb..1e1c6fa 100644
@@ -604,6 +604,7 @@ static void test_visitor_in_errors(TestInputVisitorData *data,
      g_assert(error_is_set(&errp));
      g_assert(p->string == NULL);
 
+    error_free(errp);
      g_free(p->string);
      g_free(p);
  }
#20 lore raw

RFC PATCH 10/10 tests: add cases for inherited struct and union with discriminator

In reply to Wenchao Xia

Test for inherit and complex union.

---
 tests/qapi-schema/qapi-schema-test.json |   36 +++++
 tests/qapi-schema/qapi-schema-test.out  |   15 ++
 tests/test-qmp-input-visitor.c          |  188 ++++++++++++++++++++++++
 tests/test-qmp-output-visitor.c         |  238 +++++++++++++++++++++++++++++++
 4 files changed, 477 insertions(+), 0 deletions(-)
tests/qapi-schema/qapi-schema-test.json +36 -0
index fe5af75..b15789d 100644
@@ -21,8 +21,29 @@
             'dict1': { 'string1': 'str',
                        'dict2': { 'userdef1': 'UserDefOne', 'string2': 'str' },
                        '*dict3': { 'userdef2': 'UserDefOne', 'string3': 'str' } } } }
+# for testing base
+{ 'type': 'UserDefBase',
+  'data': { 'string': 'str', 'enum1': 'EnumOne' } }
+
+{ 'type': 'UserDefInherit',
+  'base': 'UserDefBase',
+  'data': { 'boolean': 'bool', 'integer': 'int' } }
+
+{ 'type': 'UserDefDirectInherit',
+  'data': { 'boolean': 'bool',
+            'dict': { '_base': 'UserDefBase',
+                      'integer': 'int' } } }
+
+{ 'type': 'UserDefMixedInherit',
+  'base': 'UserDefBase',
+  'data': { 'boolean': 'bool',
+            'dict': { '_base': 'UserDefBase',
+                      'integer': 'int' } } }
 
 # for testing unions
+{ 'type': 'UserDefBase0',
+  'data': { 'base-string0': 'str', 'base-enum0': 'EnumOne' } }
+
 { 'type': 'UserDefA',
   'data': { 'boolean': 'bool' } }
 
@@ -32,6 +53,21 @@
 { 'union': 'UserDefUnion',
   'data': { 'a' : 'UserDefA', 'b' : 'UserDefB' } }
 
+{ 'union': 'UserDefBaseUnion',
+  'base': 'UserDefBase0',
+  'data': { 'a' : 'UserDefA', 'b' : 'UserDefB' } }
+
+{ 'union': 'UserDefDiscriminatorUnion',
+  'base': 'UserDefBase0',
+  'discriminator' : 'base-string0',
+  'data': { 'a' : 'UserDefA', 'b' : 'UserDefB' } }
+
+# A complex type
+{ 'union': 'UserDefEnumDiscriminatorUnion',
+  'base': 'UserDefBase0',
+  'discriminator' : 'base-enum0',
+  'data': { 'value1' : 'UserDefA', 'value2' : 'UserDefMixedInherit' } }
+
 # for testing native lists
 { 'union': 'UserDefNativeListUnion',
   'data': { 'integer': ['int'],
tests/qapi-schema/qapi-schema-test.out +15 -0
index ad74cdb..55de233 100644
@@ -3,9 +3,17 @@
  OrderedDict([('type', 'UserDefOne'), ('data', OrderedDict([('integer', 'int'), ('string', 'str'), ('*enum1', 'EnumOne')]))]),
  OrderedDict([('type', 'UserDefTwo'), ('data', OrderedDict([('string', 'str'), ('dict', OrderedDict([('string', 'str'), ('dict', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')])), ('*dict2', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')]))]))]))]),
  OrderedDict([('type', 'UserDefNested'), ('data', OrderedDict([('string0', 'str'), ('dict1', OrderedDict([('string1', 'str'), ('dict2', OrderedDict([('userdef1', 'UserDefOne'), ('string2', 'str')])), ('*dict3', OrderedDict([('userdef2', 'UserDefOne'), ('string3', 'str')]))]))]))]),
+ OrderedDict([('type', 'UserDefBase'), ('data', OrderedDict([('string', 'str'), ('enum1', 'EnumOne')]))]),
+ OrderedDict([('type', 'UserDefInherit'), ('base', 'UserDefBase'), ('data', OrderedDict([('boolean', 'bool'), ('integer', 'int')]))]),
+ OrderedDict([('type', 'UserDefDirectInherit'), ('data', OrderedDict([('boolean', 'bool'), ('dict', OrderedDict([('_base', 'UserDefBase'), ('integer', 'int')]))]))]),
+ OrderedDict([('type', 'UserDefMixedInherit'), ('base', 'UserDefBase'), ('data', OrderedDict([('boolean', 'bool'), ('dict', OrderedDict([('_base', 'UserDefBase'), ('integer', 'int')]))]))]),
+ OrderedDict([('type', 'UserDefBase0'), ('data', OrderedDict([('base-string0', 'str'), ('base-enum0', 'EnumOne')]))]),
  OrderedDict([('type', 'UserDefA'), ('data', OrderedDict([('boolean', 'bool')]))]),
  OrderedDict([('type', 'UserDefB'), ('data', OrderedDict([('integer', 'int')]))]),
  OrderedDict([('union', 'UserDefUnion'), ('data', OrderedDict([('a', 'UserDefA'), ('b', 'UserDefB')]))]),
+ OrderedDict([('union', 'UserDefBaseUnion'), ('base', 'UserDefBase0'), ('data', OrderedDict([('a', 'UserDefA'), ('b', 'UserDefB')]))]),
+ OrderedDict([('union', 'UserDefDiscriminatorUnion'), ('base', 'UserDefBase0'), ('discriminator', 'base-string0'), ('data', OrderedDict([('a', 'UserDefA'), ('b', 'UserDefB')]))]),
+ OrderedDict([('union', 'UserDefEnumDiscriminatorUnion'), ('base', 'UserDefBase0'), ('discriminator', 'base-enum0'), ('data', OrderedDict([('value1', 'UserDefA'), ('value2', 'UserDefMixedInherit')]))]),
  OrderedDict([('union', 'UserDefNativeListUnion'), ('data', OrderedDict([('integer', ['int']), ('s8', ['int8']), ('s16', ['int16']), ('s32', ['int32']), ('s64', ['int64']), ('u8', ['uint8']), ('u16', ['uint16']), ('u32', ['uint32']), ('u64', ['uint64']), ('number', ['number']), ('boolean', ['bool']), ('string', ['str'])]))]),
  OrderedDict([('command', 'user_def_cmd'), ('data', OrderedDict())]),
  OrderedDict([('command', 'user_def_cmd1'), ('data', OrderedDict([('ud1a', 'UserDefOne')]))]),
@@ -13,11 +21,18 @@
  OrderedDict([('type', 'UserDefOptions'), ('data', OrderedDict([('*i64', ['int']), ('*u64', ['uint64']), ('*u16', ['uint16']), ('*i64x', 'int'), ('*u64x', 'uint64')]))])]
 [{'enum_name': 'EnumOne', 'enum_values': ['value1', 'value2', 'value3']},
  {'enum_name': 'UserDefUnionKind', 'enum_values': None},
+ {'enum_name': 'UserDefBaseUnionKind', 'enum_values': None},
+ {'enum_name': 'UserDefDiscriminatorUnionKind', 'enum_values': None},
  {'enum_name': 'UserDefNativeListUnionKind', 'enum_values': None}]
 [OrderedDict([('type', 'NestedEnumsOne'), ('data', OrderedDict([('enum1', 'EnumOne'), ('*enum2', 'EnumOne'), ('enum3', 'EnumOne'), ('*enum4', 'EnumOne')]))]),
  OrderedDict([('type', 'UserDefOne'), ('data', OrderedDict([('integer', 'int'), ('string', 'str'), ('*enum1', 'EnumOne')]))]),
  OrderedDict([('type', 'UserDefTwo'), ('data', OrderedDict([('string', 'str'), ('dict', OrderedDict([('string', 'str'), ('dict', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')])), ('*dict2', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')]))]))]))]),
  OrderedDict([('type', 'UserDefNested'), ('data', OrderedDict([('string0', 'str'), ('dict1', OrderedDict([('string1', 'str'), ('dict2', OrderedDict([('userdef1', 'UserDefOne'), ('string2', 'str')])), ('*dict3', OrderedDict([('userdef2', 'UserDefOne'), ('string3', 'str')]))]))]))]),
+ OrderedDict([('type', 'UserDefBase'), ('data', OrderedDict([('string', 'str'), ('enum1', 'EnumOne')]))]),
+ OrderedDict([('type', 'UserDefInherit'), ('base', 'UserDefBase'), ('data', OrderedDict([('boolean', 'bool'), ('integer', 'int')]))]),
+ OrderedDict([('type', 'UserDefDirectInherit'), ('data', OrderedDict([('boolean', 'bool'), ('dict', OrderedDict([('_base', 'UserDefBase'), ('integer', 'int')]))]))]),
+ OrderedDict([('type', 'UserDefMixedInherit'), ('base', 'UserDefBase'), ('data', OrderedDict([('boolean', 'bool'), ('dict', OrderedDict([('_base', 'UserDefBase'), ('integer', 'int')]))]))]),
+ OrderedDict([('type', 'UserDefBase0'), ('data', OrderedDict([('base-string0', 'str'), ('base-enum0', 'EnumOne')]))]),
  OrderedDict([('type', 'UserDefA'), ('data', OrderedDict([('boolean', 'bool')]))]),
  OrderedDict([('type', 'UserDefB'), ('data', OrderedDict([('integer', 'int')]))]),
  OrderedDict([('type', 'UserDefOptions'), ('data', OrderedDict([('*i64', ['int']), ('*u64', ['uint64']), ('*u16', ['uint16']), ('*i64x', 'int'), ('*u64x', 'uint64')]))])]
tests/test-qmp-input-visitor.c +188 -0

208 lines not on this page · raw message

tests/test-qmp-output-visitor.c +238 -0

258 lines not on this page · raw message

Signature · 1 line
1.7.1