qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] a4bcb2: qapi: Rename class QAPISchema to QAPI


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] a4bcb2: qapi: Rename class QAPISchema to QAPISchemaParser
Date: Mon, 21 Sep 2015 17:00:05 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: a4bcb2080d5c1d08bab512d76fb260296e2cae74
      
https://github.com/qemu/qemu/commit/a4bcb2080d5c1d08bab512d76fb260296e2cae74
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: Rename class QAPISchema to QAPISchemaParser

I want to name a new class QAPISchema.

While there, make it a new-style class.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: ac88219a6c78302c693fb60fe6cf04358540fbce
      
https://github.com/qemu/qemu/commit/ac88219a6c78302c693fb60fe6cf04358540fbce
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi-commands.py
    M scripts/qapi-event.py
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py
    M tests/qapi-schema/test-qapi.py

  Log Message:
  -----------
  qapi: New QAPISchema intermediate reperesentation

The QAPI code generators work with a syntax tree (nested dictionaries)
plus a few symbol tables (also dictionaries) on the side.

They have clearly outgrown these simple data structures.  There's lots
of rummaging around in dictionaries, and information is recomputed on
the fly.  For the work I'm going to do, I want more clearly defined
and more convenient interfaces.

Going forward, I also want less coupling between the back-ends and the
syntax tree, to make messing with the syntax easier.

Create a bunch of classes to represent QAPI schemata.

Have the QAPISchema initializer call the parser, then walk the syntax
tree to create the new internal representation, and finally perform
semantic analysis.

Shortcut: the semantic analysis still relies on existing check_exprs()
to do the actual semantic checking.  All this code needs to move into
the classes.  Mark as TODO.

Simple unions are lowered to flat unions.  Flat unions and structs are
represented as a more general object type.

Catching name collisions in generated code would be nice.  Mark as
TODO.

We generate array types eagerly, even though most of them aren't used.
Mark as TODO.

Nothing uses the new intermediate representation just yet, thus no
change to generated files.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: f51d8c3db11b0f3052b3bb4b8b0c7f0bc76f7136
      
https://github.com/qemu/qemu/commit/f51d8c3db11b0f3052b3bb4b8b0c7f0bc76f7136
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: QAPISchema code generation helper methods

New methods c_name(), c_type(), c_null(), json_type(),
alternate_qtype().

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 3f7dc21bee1e930d5cccf607b8f83831c3bbdb09
      
https://github.com/qemu/qemu/commit/3f7dc21bee1e930d5cccf607b8f83831c3bbdb09
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: New QAPISchemaVisitor

The visitor will help keeping the code generation code simple and
reasonably separated from QAPISchema details.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 156402e5042193c45e70c378a93ccafd3832d8ff
      
https://github.com/qemu/qemu/commit/156402e5042193c45e70c378a93ccafd3832d8ff
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M tests/qapi-schema/alternate-good.out
    M tests/qapi-schema/args-member-array.out
    M tests/qapi-schema/comments.out
    M tests/qapi-schema/empty.out
    M tests/qapi-schema/enum-empty.out
    M tests/qapi-schema/event-case.out
    M tests/qapi-schema/flat-union-reverse-define.out
    M tests/qapi-schema/ident-with-escape.out
    M tests/qapi-schema/include-relpath.out
    M tests/qapi-schema/include-repetition.out
    M tests/qapi-schema/include-simple.out
    M tests/qapi-schema/indented-expr.out
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/returns-int.out
    M tests/qapi-schema/test-qapi.py
    M tests/qapi-schema/type-bypass.out

  Log Message:
  -----------
  tests/qapi-schema: Convert test harness to QAPISchemaVisitor

The old code prints the result of parsing (list of expression
dictionaries), and partial results of semantic analysis (list of enum
dictionaries, list of struct dictionaries).

The new code prints a trace of a schema visit, i.e. what the back-ends
are going to use.  Built-in and array types are omitted, because
they're boring.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 2b162ccbe875e5323fc04c1009addbdea4d35220
      
https://github.com/qemu/qemu/commit/2b162ccbe875e5323fc04c1009addbdea4d35220
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M scripts/qapi-types.py
    M scripts/qapi.py
    M tests/qapi-schema/qapi-schema-test.json

  Log Message:
  -----------
  qapi-types: Convert to QAPISchemaVisitor, fixing flat unions

Fixes flat unions to get the base's base members.  Test case is from
commit 2fc0043, in qapi-schema-test.json:

    { 'union': 'UserDefFlatUnion',
      'base': 'UserDefUnionBase',
      'discriminator': 'enum1',
      'data': { 'value1' : 'UserDefA',
          'value2' : 'UserDefB',
          'value3' : 'UserDefB' } }

    { 'struct': 'UserDefUnionBase',
      'base': 'UserDefZero',
      'data': { 'string': 'str', 'enum1': 'EnumOne' } }

    { 'struct': 'UserDefZero',
      'data': { 'integer': 'int' } }

Patch's effect on UserDefFlatUnion:

     struct UserDefFlatUnion {
   /* Members inherited from UserDefUnionBase: */
    +    int64_t integer;
   char *string;
   EnumOne enum1;
   /* Own members: */
   union { /* union tag is @enum1 */
       void *data;
       UserDefA *value1;
       UserDefB *value2;
       UserDefB *value3;
   };
     };

Flat union visitors remain broken.  They'll be fixed next.

Code is generated in a different order now, but that doesn't matter.

The two guards QAPI_TYPES_BUILTIN_STRUCT_DECL and
QAPI_TYPES_BUILTIN_CLEANUP_DECL are replaced by just
QAPI_TYPES_BUILTIN.

Two ugly special cases for simple unions now stand out like sore
thumbs:

1. The type tag is named 'type' everywhere, except in generated C,
   where it's 'kind'.

2. QAPISchema lowers simple unions to semantically equivalent flat
   unions.  However, the C generated for a simple unions differs from
   the C generated for its equivalent flat union, and we therefore
   need special code to preserve that pointless difference for now.

Mark both TODO.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 441cbac0c7e641780decbc674a9a68c6a5200f71
      
https://github.com/qemu/qemu/commit/441cbac0c7e641780decbc674a9a68c6a5200f71
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi-visit.py
    M tests/qapi-schema/qapi-schema-test.json
    M tests/test-qmp-input-strict.c
    M tests/test-qmp-input-visitor.c

  Log Message:
  -----------
  qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

Fixes flat unions to visit the base's base members (the previous
commit merely added them to the struct).  Same test case.

Patch's effect on visit_type_UserDefFlatUnion():

     static void visit_type_UserDefFlatUnion_fields(Visitor *m, 
UserDefFlatUnion **obj, Error **errp)
     {
   Error *err = NULL;

    +    visit_type_int(m, &(*obj)->integer, "integer", &err);
    +    if (err) {
    +        goto out;
    +    }
   visit_type_str(m, &(*obj)->string, "string", &err);
   if (err) {
       goto out;

Test cases updated for the bug fix.

Fixes alternates to generate a visitor for their implicit enumeration
type.  None of them are currently used, obviously.  Example:
block-core.json's BlockdevRef now generates
visit_type_BlockdevRefKind().

Code is generated in a different order now, and therefore has got a
few new forward declarations.  Doesn't matter.

The guard QAPI_VISIT_BUILTIN_VISITOR_DECL is renamed to
QAPI_VISIT_BUILTIN.

The previous commit's two ugly special cases exist here, too.  Mark
both TODO.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: ee44602857660e79f46547de02e26d65bcaf1519
      
https://github.com/qemu/qemu/commit/ee44602857660e79f46547de02e26d65bcaf1519
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi-commands.py
    M scripts/qapi.py

  Log Message:
  -----------
  qapi-commands: Convert to QAPISchemaVisitor

Output unchanged apart from reordering and white-space.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>


  Commit: efd2eaa6c2992c214a13f102b6ddd4dca4697fb3
      
https://github.com/qemu/qemu/commit/efd2eaa6c2992c214a13f102b6ddd4dca4697fb3
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M scripts/qapi-event.py
    M scripts/qapi-types.py
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: De-duplicate enum code generation

Duplicated in commit 21cd70d.  Yes, we can't import qapi-types, but
that's no excuse.  Move the helpers from qapi-types.py to qapi.py, and
replace the duplicates in qapi-event.py.

The generated event enumeration type's lookup table becomes
const-correct (see commit 2e4450f), and uses explicit indexes instead
of relying on order (see commit 912ae9c).

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 7b24626cd019ed5084c8e3370999176a1ebd44be
      
https://github.com/qemu/qemu/commit/7b24626cd019ed5084c8e3370999176a1ebd44be
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi-event.py

  Log Message:
  -----------
  qapi-event: Eliminate global variable event_enum_value

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: 05f43a960877cf941635324b2d0a74c0d0f7128e
      
https://github.com/qemu/qemu/commit/05f43a960877cf941635324b2d0a74c0d0f7128e
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi-event.py
    M tests/qapi-schema/qapi-schema-test.json

  Log Message:
  -----------
  qapi-event: Convert to QAPISchemaVisitor, fixing data with base

Fixes events whose data is struct with base to include the struct's
base members.  Test case is qapi-schema-test.json's event
__org.qemu_x-command:

    { 'event': '__ORG.QEMU_X-EVENT', 'data': '__org.qemu_x-Struct' }

    { 'struct': '__org.qemu_x-Struct', 'base': '__org.qemu_x-Base',
      'data': { '__org.qemu_x-member2': 'str' } }

    { 'struct': '__org.qemu_x-Base',
      'data': { '__org.qemu_x-member1': '__org.qemu_x-Enum' } }

Patch's effect on generated qapi_event_send___org_qemu_x_event():

    -void qapi_event_send___org_qemu_x_event(const char *__org_qemu_x_member2,
    +void qapi_event_send___org_qemu_x_event(__org_qemu_x_Enum 
__org_qemu_x_member1,
    +                                        const char *__org_qemu_x_member2,
                                       Error **errp)
     {
   QDict *qmp;
    @@ -224,6 +225,10 @@ void qapi_event_send___org_qemu_x_event(
       goto clean;
   }

    +    visit_type___org_qemu_x_Enum(v, &__org_qemu_x_member1, 
"__org.qemu_x-member1", &local_err);
    +    if (local_err) {
    +        goto clean;
    +    }
   visit_type_str(v, (char **)&__org_qemu_x_member2, "__org.qemu_x-member2", 
&local_err);
   if (local_err) {
       goto clean;

Code is generated in a different order now, but that doesn't matter.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>


  Commit: 5710153e7310995b5d4127af267e36d8529b3b30
      
https://github.com/qemu/qemu/commit/5710153e7310995b5d4127af267e36d8529b3b30
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi-commands.py
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: Replace dirty is_c_ptr() by method c_null()

is_c_ptr() looks whether the end of the C text for the type looks like
a pointer.  Works, but is fragile.

We now have a better tool: use QAPISchemaType method c_null().  The
initializers for non-pointers become prettier: 0, false or the
enumeration constant with the value 0 instead of {0}.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: e98859a9b96d71dea8f9af43325edd43c7effe66
      
https://github.com/qemu/qemu/commit/e98859a9b96d71dea8f9af43325edd43c7effe66
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M scripts/qapi-commands.py
    M scripts/qapi-event.py
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: Clean up after recent conversions to QAPISchemaVisitor

Generate just 'FOO' instead of 'struct FOO' when possible.

Drop helper functions that are now unused.

Make pep8 and pylint reasonably happy.

Rename generate_FOO() functions to gen_FOO() for consistency.

Use more consistent and sensible variable names.

Consistently use c_ for mapping keys when their value is a C
identifier or type.

Simplify gen_enum() and gen_visit_union()

Consistently use single quotes for C text string literals.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 60f8546acd113e636bf2ba8af991ebe0f6e8ad66
      
https://github.com/qemu/qemu/commit/60f8546acd113e636bf2ba8af991ebe0f6e8ad66
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi-visit.py

  Log Message:
  -----------
  qapi-visit: Rearrange code a bit

Move gen_visit_decl() to a better place.  Inline
generate_visit_struct_body().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: f15380190a6e635e6c579ca24d672aa4aa068632
      
https://github.com/qemu/qemu/commit/f15380190a6e635e6c579ca24d672aa4aa068632
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi-commands.py

  Log Message:
  -----------
  qapi-commands: Rearrange code

Rename gen_marshal_input() to gen_marshal(), because the generated
function marshals both arguments and results.

Rename gen_visitor_input_containers_decl() to gen_marshal_vars(), and
move the other variable declarations there, too.

Rename gen_visitor_input_block() to gen_marshal_input_visit(), and
rearrange its code slightly.

Rename gen_marshal_input_decl() to gen_marshal_proto(), because the
result isn't a full declaration, unlike gen_command_decl()'s.

New gen_marshal_decl() actually returns a full declaration.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: 7fad30f06eb6aa57aaa8f3d264288f24ae7646f0
      
https://github.com/qemu/qemu/commit/7fad30f06eb6aa57aaa8f3d264288f24ae7646f0
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M docs/writing-qmp-commands.txt
    M monitor.c
    M qmp-commands.hx
    M qmp.c
    M scripts/qapi-commands.py

  Log Message:
  -----------
  qapi: Rename qmp_marshal_input_FOO() to qmp_marshal_FOO()

These functions marshal both input and output.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: 03b4367a556179e3e59affa535493427bd009e9d
      
https://github.com/qemu/qemu/commit/03b4367a556179e3e59affa535493427bd009e9d
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M scripts/qapi-commands.py
    M scripts/qapi-event.py
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: De-duplicate parameter list generation

Generated qapi-event.[ch] lose line breaks.  No change otherwise.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: 56d92b003a223585980df5403ee9e3a55de90adf
      
https://github.com/qemu/qemu/commit/56d92b003a223585980df5403ee9e3a55de90adf
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M scripts/qapi-commands.py

  Log Message:
  -----------
  qapi-commands: De-duplicate output marshaling functions

gen_marshal_output() uses its parameter name only for name of the
generated function.  Name it after the type being marshaled instead of
its caller, and drop duplicates.

Saves 7 copies of qmp_marshal_output_int() in qemu-ga, and one copy of
qmp_marshal_output_str() in qemu-system-*.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: f133f2db1eedd409d3c1b0892f65b99f83c74754
      
https://github.com/qemu/qemu/commit/f133f2db1eedd409d3c1b0892f65b99f83c74754
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M docs/qapi-code-gen.txt

  Log Message:
  -----------
  qapi: Improve built-in type documentation

Clarify how they map to JSON.  Add how they map to C.  Fix the
reference to StringInputVisitor.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: 6c2f9a15dfc8c18ba94defb0f819109902a817cb
      
https://github.com/qemu/qemu/commit/6c2f9a15dfc8c18ba94defb0f819109902a817cb
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M qapi/qmp-output-visitor.c
    M tests/test-qmp-output-visitor.c

  Log Message:
  -----------
  qapi: Make output visitor return qnull() instead of NULL

Before commit 1d10b44, it crashed.  Since then, it returns NULL, with
a FIXME comment.  The FIXME is valid: code that assumes QObject *
can't be null exists.  I'm not aware of a way to feed this problematic
return value to code that actually chokes on null in the current code,
but the next few commits will create one, failing "make check".

Commit 481b002 solved a very similar problem by introducing a special
null QObject.  Using this special null QObject is clearly the right
way to resolve this FIXME, so do that, and update the test
accordingly.

However, the patch isn't quite right: it messes up the reference
counting.  After about SIZE_MAX visits, the reference counter
overflows, failing the assertion in qnull_destroy_obj().  Because
that's many orders of magnitude more visits of nulls than we expect,
we take this patch despite its flaws, to get the QMP introspection
stuff in without further delay.  We'll want to fix it for real before
the release.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: 28770e057f265a4e70bcbdfc2447cce7b5f2dc19
      
https://github.com/qemu/qemu/commit/28770e057f265a4e70bcbdfc2447cce7b5f2dc19
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M include/qapi/visitor-impl.h
    M include/qapi/visitor.h
    M qapi/qapi-dealloc-visitor.c
    M qapi/qapi-visit-core.c
    M qapi/qmp-input-visitor.c
    M qapi/qmp-output-visitor.c
    M scripts/qapi-types.py
    M scripts/qapi.py
    M tests/Makefile
    A tests/qapi-schema/args-any.err
    A tests/qapi-schema/args-any.exit
    A tests/qapi-schema/args-any.json
    A tests/qapi-schema/args-any.out
    A tests/qapi-schema/flat-union-base-any.err
    A tests/qapi-schema/flat-union-base-any.exit
    A tests/qapi-schema/flat-union-base-any.json
    A tests/qapi-schema/flat-union-base-any.out
    R tests/qapi-schema/flat-union-base-star.err
    R tests/qapi-schema/flat-union-base-star.exit
    R tests/qapi-schema/flat-union-base-star.json
    R tests/qapi-schema/flat-union-base-star.out
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/type-bypass.out
    M tests/test-qmp-commands.c
    M tests/test-qmp-input-visitor.c
    M tests/test-qmp-output-visitor.c

  Log Message:
  -----------
  qapi: Introduce a first class 'any' type

It's first class, because unlike '**', it actually works, i.e. doesn't
require 'gen': false.

'**' will go away next.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>


  Commit: 6eb3937e9b20319e1c4f4d53e906fda8f5ccda10
      
https://github.com/qemu/qemu/commit/6eb3937e9b20319e1c4f4d53e906fda8f5ccda10
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M include/monitor/monitor.h
    M qapi-schema.json
    M qmp-commands.hx
    M qmp.c
    M scripts/qapi.py

  Log Message:
  -----------
  qom: Don't use 'gen': false for qom-get, qom-set, object-add

With the previous commit, the generated marshalers just work, and save
us a bit of handwritten code.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: b8a98326d565516bfcaa6582781605d167471b48
      
https://github.com/qemu/qemu/commit/b8a98326d565516bfcaa6582781605d167471b48
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M qapi-schema.json
    M qmp-commands.hx

  Log Message:
  -----------
  qapi-schema: Fix up misleading specification of netdev_add

It doesn't take a 'props' argument, let alone one in the format
"NAME=VALUE,..."

The bogus arguments specification doesn't matter due to 'gen': false.
Clean it up to be incomplete rather than wrong, and document the
incompleteness.

While there, improve netdev_add usage example in the manual: add a
device option to show how it's done.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: 2d21291ae645955fcc4652ebfec81ad338169ac6
      
https://github.com/qemu/qemu/commit/2d21291ae645955fcc4652ebfec81ad338169ac6
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M scripts/qapi.py
    M tests/Makefile
    R tests/qapi-schema/type-bypass-no-gen.err
    R tests/qapi-schema/type-bypass-no-gen.exit
    R tests/qapi-schema/type-bypass-no-gen.json
    R tests/qapi-schema/type-bypass-no-gen.out
    R tests/qapi-schema/type-bypass.err
    R tests/qapi-schema/type-bypass.exit
    R tests/qapi-schema/type-bypass.json
    R tests/qapi-schema/type-bypass.out

  Log Message:
  -----------
  qapi: Pseudo-type '**' is now unused, drop it

'gen': false needs to stay for now, because netdev_add is still using
it.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>


  Commit: 39a181581650f4d50f4445bc6276d9716cece050
      
https://github.com/qemu/qemu/commit/39a181581650f4d50f4445bc6276d9716cece050
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M .gitignore
    M Makefile
    M Makefile.objs
    M docs/qapi-code-gen.txt
    M monitor.c
    M qapi-schema.json
    A qapi/introspect.json
    M qmp-commands.hx
    A scripts/qapi-introspect.py
    M scripts/qapi.py
    M tests/.gitignore
    M tests/Makefile
    M tests/qapi-schema/alternate-good.out
    M tests/qapi-schema/args-member-array.out
    M tests/qapi-schema/comments.out
    M tests/qapi-schema/empty.out
    M tests/qapi-schema/enum-empty.out
    M tests/qapi-schema/event-case.out
    M tests/qapi-schema/flat-union-reverse-define.out
    M tests/qapi-schema/ident-with-escape.out
    M tests/qapi-schema/include-relpath.out
    M tests/qapi-schema/include-repetition.out
    M tests/qapi-schema/include-simple.out
    M tests/qapi-schema/indented-expr.out
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/returns-int.out
    M tests/test-qmp-input-strict.c

  Log Message:
  -----------
  qapi: New QMP command query-qmp-schema for QMP introspection

qapi/introspect.json defines the introspection schema.  It's designed
for QMP introspection, but should do for similar uses, such as QGA.

The introspection schema does not reflect all the rules and
restrictions that apply to QAPI schemata.  A valid QAPI schema has an
introspection value conforming to the introspection schema, but the
converse is not true.

Introspection lowers away a number of schema details, and makes
implicit things explicit:

* The built-in types are declared with their JSON type.

  All integer types are mapped to 'int', because how many bits we use
  internally is an implementation detail.  It could be pressed into
  external interface service as very approximate range information,
  but that's a bad idea.  If we need range information, we better do
  it properly.

* Implicit type definitions are made explicit, and given
  auto-generated names:

  - Array types, named by appending "List" to the name of their
    element type, like in generated C.

  - The enumeration types implicitly defined by simple union types,
    named by appending "Kind" to the name of their simple union type,
    like in generated C.

  - Types that don't occur in generated C.  Their names start with ':'
    so they don't clash with the user's names.

* All type references are by name.

* The struct and union types are generalized into an object type.

* Base types are flattened.

* Commands take a single argument and return a single result.

  Dictionary argument or list result is an implicit type definition.

  The empty object type is used when a command takes no arguments or
  produces no results.

  The argument is always of object type, but the introspection schema
  doesn't reflect that.

  The 'gen': false directive is omitted as implementation detail.

  The 'success-response' directive is omitted as well for now, even
  though it's not an implementation detail, because it's not used by
  QMP.

* Events carry a single data value.

  Implicit type definition and empty object type use, just like for
  commands.

  The value is of object type, but the introspection schema doesn't
  reflect that.

* Types not used by commands or events are omitted.

  Indirect use counts as use.

* Optional members have a default, which can only be null right now

  Instead of a mandatory "optional" flag, we have an optional default.
  No default means mandatory, default null means optional without
  default value.  Non-null is available for optional with default
  (possible future extension).

* Clients should *not* look up types by name, because type names are
  not ABI.  Look up the command or event you're interested in, then
  follow the references.

  TODO Should we hide the type names to eliminate the temptation?

New generator scripts/qapi-introspect.py computes an introspection
value for its input, and generates a C variable holding it.

It can generate awfully long lines.  Marked TODO.

A new test-qmp-input-visitor test case feeds its result for both
tests/qapi-schema/qapi-schema-test.json and qapi-schema.json to a
QmpInputVisitor to verify it actually conforms to the schema.

New QMP command query-qmp-schema takes its return value from that
variable.  Its reply is some 85KiBytes for me right now.

If this turns out to be too much, we have a couple of options:

* We can use shorter names in the JSON.  Not the QMP style.

* Optionally return the sub-schema for commands and events given as
  arguments.

  Right now qmp_query_schema() sends the string literal computed by
  qmp-introspect.py.  To compute sub-schema at run time, we'd have to
  duplicate parts of qapi-introspect.py in C.  Unattractive.

* Let clients cache the output of query-qmp-schema.

  It changes only on QEMU upgrades, i.e. rarely.  Provide a command
  query-qmp-schema-hash.  Clients can have a cache indexed by hash,
  and re-query the schema only when they don't have it cached.  Even
  simpler: put the hash in the QMP greeting.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 1a9a507b2e3e90aa719c96b4c092e7fad7215f21
      
https://github.com/qemu/qemu/commit/1a9a507b2e3e90aa719c96b4c092e7fad7215f21
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M qapi/introspect.json
    M scripts/qapi-introspect.py

  Log Message:
  -----------
  qapi-introspect: Hide type names

To eliminate the temptation for clients to look up types by name
(which are not ABI), replace all type names by meaningless strings.

Reduces output of query-schema by 13 out of 85KiB.

As a debugging aid, provide option -u to suppress the hiding.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>


  Commit: 9e72681d16792d0ffc42bab634b1753ff299bdfd
      
https://github.com/qemu/qemu/commit/9e72681d16792d0ffc42bab634b1753ff299bdfd
  Author: Peter Maydell <address@hidden>
  Date:   2015-09-21 (Mon, 21 Sep 2015)

  Changed paths:
    M .gitignore
    M Makefile
    M Makefile.objs
    M docs/qapi-code-gen.txt
    M docs/writing-qmp-commands.txt
    M include/monitor/monitor.h
    M include/qapi/visitor-impl.h
    M include/qapi/visitor.h
    M monitor.c
    M qapi-schema.json
    A qapi/introspect.json
    M qapi/qapi-dealloc-visitor.c
    M qapi/qapi-visit-core.c
    M qapi/qmp-input-visitor.c
    M qapi/qmp-output-visitor.c
    M qmp-commands.hx
    M qmp.c
    M scripts/qapi-commands.py
    M scripts/qapi-event.py
    A scripts/qapi-introspect.py
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py
    M tests/.gitignore
    M tests/Makefile
    M tests/qapi-schema/alternate-good.out
    A tests/qapi-schema/args-any.err
    A tests/qapi-schema/args-any.exit
    A tests/qapi-schema/args-any.json
    A tests/qapi-schema/args-any.out
    M tests/qapi-schema/args-member-array.out
    M tests/qapi-schema/comments.out
    M tests/qapi-schema/empty.out
    M tests/qapi-schema/enum-empty.out
    M tests/qapi-schema/event-case.out
    A tests/qapi-schema/flat-union-base-any.err
    A tests/qapi-schema/flat-union-base-any.exit
    A tests/qapi-schema/flat-union-base-any.json
    A tests/qapi-schema/flat-union-base-any.out
    R tests/qapi-schema/flat-union-base-star.err
    R tests/qapi-schema/flat-union-base-star.exit
    R tests/qapi-schema/flat-union-base-star.json
    R tests/qapi-schema/flat-union-base-star.out
    M tests/qapi-schema/flat-union-reverse-define.out
    M tests/qapi-schema/ident-with-escape.out
    M tests/qapi-schema/include-relpath.out
    M tests/qapi-schema/include-repetition.out
    M tests/qapi-schema/include-simple.out
    M tests/qapi-schema/indented-expr.out
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/returns-int.out
    M tests/qapi-schema/test-qapi.py
    R tests/qapi-schema/type-bypass-no-gen.err
    R tests/qapi-schema/type-bypass-no-gen.exit
    R tests/qapi-schema/type-bypass-no-gen.json
    R tests/qapi-schema/type-bypass-no-gen.out
    R tests/qapi-schema/type-bypass.err
    R tests/qapi-schema/type-bypass.exit
    R tests/qapi-schema/type-bypass.json
    R tests/qapi-schema/type-bypass.out
    M tests/test-qmp-commands.c
    M tests/test-qmp-input-strict.c
    M tests/test-qmp-input-visitor.c
    M tests/test-qmp-output-visitor.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-09-21' into 
staging

qapi: QMP introspection

# gpg: Signature made Mon 21 Sep 2015 08:59:17 BST using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <address@hidden>"
# gpg:                 aka "Markus Armbruster <address@hidden>"

* remotes/armbru/tags/pull-qapi-2015-09-21: (26 commits)
  qapi-introspect: Hide type names
  qapi: New QMP command query-qmp-schema for QMP introspection
  qapi: Pseudo-type '**' is now unused, drop it
  qapi-schema: Fix up misleading specification of netdev_add
  qom: Don't use 'gen': false for qom-get, qom-set, object-add
  qapi: Introduce a first class 'any' type
  qapi: Make output visitor return qnull() instead of NULL
  qapi: Improve built-in type documentation
  qapi-commands: De-duplicate output marshaling functions
  qapi: De-duplicate parameter list generation
  qapi: Rename qmp_marshal_input_FOO() to qmp_marshal_FOO()
  qapi-commands: Rearrange code
  qapi-visit: Rearrange code a bit
  qapi: Clean up after recent conversions to QAPISchemaVisitor
  qapi: Replace dirty is_c_ptr() by method c_null()
  qapi-event: Convert to QAPISchemaVisitor, fixing data with base
  qapi-event: Eliminate global variable event_enum_value
  qapi: De-duplicate enum code generation
  qapi-commands: Convert to QAPISchemaVisitor
  qapi-visit: Convert to QAPISchemaVisitor, fixing bugs
  ...

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/75ebcd7f080f...9e72681d1679

reply via email to

[Prev in Thread] Current Thread [Next in Thread]