From: John Snow <jsnow@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH v4 0/8] qapi: Add support for aliases
Date: Tue, 26 Oct 2021 17:23:07 -0400 [thread overview]
Message-ID: <CAFn=p-ahKc+EjkUAPnSODQNY808z-qyc-DQUsseAobmB8A8NwA@mail.gmail.com> (raw)
In-Reply-To: <20210917161320.201086-1-kwolf@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 11380 bytes --]
On Fri, Sep 17, 2021 at 12:13 PM Kevin Wolf <kwolf@redhat.com> wrote:
> This series introduces alias definitions for QAPI object types (structs
> and unions).
>
> This allows using the same QAPI type and visitor even when the syntax
> has some variations between different external interfaces such as QMP
> and the command line.
>
>
I'm absurdly late to the party here, and I'm afraid my involvement may only
stall your progress even further, but ... can you fill me in on the
slightly-less-higher-level details here?
I'm curious as to the nature of "has some variations" and how the aliases
help alleviate them. Do you accomplish that compatibility by using
different names for different fields of the struct?
so e.g. x.foo can be used as an alias for x.bar, but both map ultimately
onto 'x.foo'? Or does this series provide for some more fundamental
mechanical changes to map one type onto another?
> It also provides a new tool for evolving the schema while maintaining
> backwards compatibility (possibly during a deprecation period).
>
> The first user is intended to be a QAPIfied -chardev command line
> option, for which I'll send a separate series. A git tag is available
> that contains both this series and the chardev changes that make use of
> it:
>
> https://repo.or.cz/qemu/kevin.git qapi-alias-chardev-v4
>
>
v4:
> - Make sure to keep a defined order of aliases in StackObject.aliases
> - Added patch 4 to allow for better error messages when wildcard aliases
> provide a second value for a member, which may or may not be consumed
> elsewhere.
> - Resolve chained aliases only once instead of just checking that they
> can be resolved while looking for matching aliases, and actually
> resolving them at the end. This is not only a code simplification, but
> actually necessary for correct error messages on conflicts.
> - Separate schema.py cleanup patch by Markus ('qapi: Revert an
> accidental change from list to view object')
> - Fixed alias name checks in the QAPI generator
> - Changed check_path() to avoid modifying its 'path' parameter
> - Some more test cases
> - Coding style fixes
> - Documentation improvements
>
> v3:
> - Mention the new functions in the big comment in visitor.h. However,
> since the comment is about users of the visitor rather than the
> generated code, it seems like to wrong place to go into details.
> - Updated commit message for patch 3 ('Simplify full_name_nth() ...')
> - Patch 4 ('qapi: Apply aliases in qobject-input-visitor'):
> - Multiple matching wildcard aliases are considered conflicting now
> - Improved comments for several functions
> - Renamed bool *implicit_object into *is_alias_prefix, which
> describes better what it is rather than what it is used for
> - Simplified alias_present() into input_present()
> - Fixed potential use of wrong StackObject in error message
> - Patch 5 ('qapi: Add support for aliases'):
> - Made QAPISchemaAlias a QAPISchemaMember
> - Check validity of alias source paths (must exist in at least one
> variant, no optional objects in the path of a wildcard alias, no
> alias loops)
> - Many new tests cases, both positive and negative, including unit tests
> of the generated visit functions
> - Coding style changes
> - Rebased documentation (.txt -> .rst conversion in master)
>
> v2:
> - Renamed 'alias' to 'name' in all data structures describing aliases
> - Tons of new or changed comments and other documentation
> - Be more explicit that empty 'source' is invalid and assert it
> - Fixed full_name_so() for lists (added a parameter to tell the function
> whether the name of a list member or the list itself is meant)
> - Changed some QAPI generator error messages
> - Assert the type of parameters in QAPISchemaAlias.__init__()
>
> Kevin Wolf (7):
> qapi: Add interfaces for alias support to Visitor
> qapi: Remember alias definitions in qobject-input-visitor
> qapi: Simplify full_name_nth() in qobject-input-visitor
> qapi: Store Error in StackObject.h for qobject-input-visitor
> qapi: Apply aliases in qobject-input-visitor
> qapi: Add support for aliases
> tests/qapi-schema: Test cases for aliases
>
> Markus Armbruster (1):
> qapi: Revert an accidental change from list to view object
>
> docs/devel/qapi-code-gen.rst | 109 ++++-
> docs/sphinx/qapidoc.py | 2 +-
> include/qapi/visitor-impl.h | 12 +
> include/qapi/visitor.h | 59 ++-
> qapi/qapi-visit-core.c | 22 +
> qapi/qobject-input-visitor.c | 452 ++++++++++++++++--
> tests/unit/test-qmp-cmds.c | 10 +
> tests/unit/test-qobject-input-visitor.c | 271 +++++++++++
> scripts/qapi/expr.py | 54 ++-
> scripts/qapi/schema.py | 117 ++++-
> scripts/qapi/types.py | 4 +-
> scripts/qapi/visit.py | 34 +-
> tests/qapi-schema/test-qapi.py | 7 +-
> tests/qapi-schema/alias-bad-type.err | 2 +
> tests/qapi-schema/alias-bad-type.json | 3 +
> tests/qapi-schema/alias-bad-type.out | 0
> tests/qapi-schema/alias-missing-source.err | 2 +
> tests/qapi-schema/alias-missing-source.json | 3 +
> tests/qapi-schema/alias-missing-source.out | 0
> tests/qapi-schema/alias-name-bad-type.err | 2 +
> tests/qapi-schema/alias-name-bad-type.json | 3 +
> tests/qapi-schema/alias-name-bad-type.out | 0
> tests/qapi-schema/alias-name-conflict.err | 2 +
> tests/qapi-schema/alias-name-conflict.json | 4 +
> tests/qapi-schema/alias-name-conflict.out | 0
> tests/qapi-schema/alias-recursive.err | 2 +
> tests/qapi-schema/alias-recursive.json | 4 +
> tests/qapi-schema/alias-recursive.out | 0
> tests/qapi-schema/alias-source-bad-type.err | 2 +
> tests/qapi-schema/alias-source-bad-type.json | 3 +
> tests/qapi-schema/alias-source-bad-type.out | 0
> .../alias-source-elem-bad-type.err | 2 +
> .../alias-source-elem-bad-type.json | 3 +
> .../alias-source-elem-bad-type.out | 0
> tests/qapi-schema/alias-source-empty.err | 2 +
> tests/qapi-schema/alias-source-empty.json | 3 +
> tests/qapi-schema/alias-source-empty.out | 0
> .../alias-source-inexistent-variants.err | 2 +
> .../alias-source-inexistent-variants.json | 12 +
> .../alias-source-inexistent-variants.out | 0
> tests/qapi-schema/alias-source-inexistent.err | 2 +
> .../qapi-schema/alias-source-inexistent.json | 3 +
> tests/qapi-schema/alias-source-inexistent.out | 0
> .../alias-source-non-object-path.err | 2 +
> .../alias-source-non-object-path.json | 3 +
> .../alias-source-non-object-path.out | 0
> .../alias-source-non-object-wildcard.err | 2 +
> .../alias-source-non-object-wildcard.json | 3 +
> .../alias-source-non-object-wildcard.out | 0
> ...lias-source-optional-wildcard-indirect.err | 2 +
> ...ias-source-optional-wildcard-indirect.json | 6 +
> ...lias-source-optional-wildcard-indirect.out | 0
> .../alias-source-optional-wildcard.err | 2 +
> .../alias-source-optional-wildcard.json | 5 +
> .../alias-source-optional-wildcard.out | 0
> tests/qapi-schema/alias-unknown-key.err | 3 +
> tests/qapi-schema/alias-unknown-key.json | 3 +
> tests/qapi-schema/alias-unknown-key.out | 0
> tests/qapi-schema/aliases-bad-type.err | 2 +
> tests/qapi-schema/aliases-bad-type.json | 3 +
> tests/qapi-schema/aliases-bad-type.out | 0
> tests/qapi-schema/meson.build | 16 +
> tests/qapi-schema/qapi-schema-test.json | 35 ++
> tests/qapi-schema/qapi-schema-test.out | 44 ++
> tests/qapi-schema/unknown-expr-key.err | 2 +-
> 65 files changed, 1290 insertions(+), 57 deletions(-)
> create mode 100644 tests/qapi-schema/alias-bad-type.err
> create mode 100644 tests/qapi-schema/alias-bad-type.json
> create mode 100644 tests/qapi-schema/alias-bad-type.out
> create mode 100644 tests/qapi-schema/alias-missing-source.err
> create mode 100644 tests/qapi-schema/alias-missing-source.json
> create mode 100644 tests/qapi-schema/alias-missing-source.out
> create mode 100644 tests/qapi-schema/alias-name-bad-type.err
> create mode 100644 tests/qapi-schema/alias-name-bad-type.json
> create mode 100644 tests/qapi-schema/alias-name-bad-type.out
> create mode 100644 tests/qapi-schema/alias-name-conflict.err
> create mode 100644 tests/qapi-schema/alias-name-conflict.json
> create mode 100644 tests/qapi-schema/alias-name-conflict.out
> create mode 100644 tests/qapi-schema/alias-recursive.err
> create mode 100644 tests/qapi-schema/alias-recursive.json
> create mode 100644 tests/qapi-schema/alias-recursive.out
> create mode 100644 tests/qapi-schema/alias-source-bad-type.err
> create mode 100644 tests/qapi-schema/alias-source-bad-type.json
> create mode 100644 tests/qapi-schema/alias-source-bad-type.out
> create mode 100644 tests/qapi-schema/alias-source-elem-bad-type.err
> create mode 100644 tests/qapi-schema/alias-source-elem-bad-type.json
> create mode 100644 tests/qapi-schema/alias-source-elem-bad-type.out
> create mode 100644 tests/qapi-schema/alias-source-empty.err
> create mode 100644 tests/qapi-schema/alias-source-empty.json
> create mode 100644 tests/qapi-schema/alias-source-empty.out
> create mode 100644 tests/qapi-schema/alias-source-inexistent-variants.err
> create mode 100644 tests/qapi-schema/alias-source-inexistent-variants.json
> create mode 100644 tests/qapi-schema/alias-source-inexistent-variants.out
> create mode 100644 tests/qapi-schema/alias-source-inexistent.err
> create mode 100644 tests/qapi-schema/alias-source-inexistent.json
> create mode 100644 tests/qapi-schema/alias-source-inexistent.out
> create mode 100644 tests/qapi-schema/alias-source-non-object-path.err
> create mode 100644 tests/qapi-schema/alias-source-non-object-path.json
> create mode 100644 tests/qapi-schema/alias-source-non-object-path.out
> create mode 100644 tests/qapi-schema/alias-source-non-object-wildcard.err
> create mode 100644 tests/qapi-schema/alias-source-non-object-wildcard.json
> create mode 100644 tests/qapi-schema/alias-source-non-object-wildcard.out
> create mode 100644
> tests/qapi-schema/alias-source-optional-wildcard-indirect.err
> create mode 100644
> tests/qapi-schema/alias-source-optional-wildcard-indirect.json
> create mode 100644
> tests/qapi-schema/alias-source-optional-wildcard-indirect.out
> create mode 100644 tests/qapi-schema/alias-source-optional-wildcard.err
> create mode 100644 tests/qapi-schema/alias-source-optional-wildcard.json
> create mode 100644 tests/qapi-schema/alias-source-optional-wildcard.out
> create mode 100644 tests/qapi-schema/alias-unknown-key.err
> create mode 100644 tests/qapi-schema/alias-unknown-key.json
> create mode 100644 tests/qapi-schema/alias-unknown-key.out
> create mode 100644 tests/qapi-schema/aliases-bad-type.err
> create mode 100644 tests/qapi-schema/aliases-bad-type.json
> create mode 100644 tests/qapi-schema/aliases-bad-type.out
>
> --
> 2.31.1
>
>
[-- Attachment #2: Type: text/html, Size: 13414 bytes --]
next prev parent reply other threads:[~2021-10-26 21:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 16:13 [PATCH v4 0/8] qapi: Add support for aliases Kevin Wolf
2021-09-17 16:13 ` [PATCH v4 1/8] qapi: Add interfaces for alias support to Visitor Kevin Wolf
2021-09-17 16:13 ` [PATCH v4 2/8] qapi: Remember alias definitions in qobject-input-visitor Kevin Wolf
2021-09-17 16:13 ` [PATCH v4 3/8] qapi: Simplify full_name_nth() " Kevin Wolf
2021-09-17 16:13 ` [PATCH v4 4/8] qapi: Store Error in StackObject.h for qobject-input-visitor Kevin Wolf
2021-09-17 16:13 ` [PATCH v4 5/8] qapi: Apply aliases in qobject-input-visitor Kevin Wolf
2021-09-17 16:13 ` [PATCH v4 6/8] qapi: Revert an accidental change from list to view object Kevin Wolf
2021-09-17 16:13 ` [PATCH v4 7/8] qapi: Add support for aliases Kevin Wolf
2021-09-17 16:13 ` [PATCH v4 8/8] tests/qapi-schema: Test cases " Kevin Wolf
2021-10-01 9:28 ` [PATCH v4 0/8] qapi: Add support " Kevin Wolf
2021-10-26 21:23 ` John Snow [this message]
2021-10-27 10:31 ` Kevin Wolf
2021-10-27 15:34 ` John Snow
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='CAFn=p-ahKc+EjkUAPnSODQNY808z-qyc-DQUsseAobmB8A8NwA@mail.gmail.com' \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=kwolf@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).