From: Paolo Bonzini <pbonzini@redhat.com>
To: Amos Kong <akong@redhat.com>
Cc: armbru@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org,
lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP
Date: Tue, 16 Jul 2013 13:08:55 +0200 [thread overview]
Message-ID: <51E529C7.4060108@redhat.com> (raw)
In-Reply-To: <20130716110440.GC743@amosk.info>
Il 16/07/2013 13:04, Amos Kong ha scritto:
>>> > > So here I defined a 'DataObject' type in qapi-schema.json,
>>> > > it's used to describe the dynamical dictionary/list/string.
>>> > >
>>> > > { 'type': 'DataObject',
>>> > > 'data': { '*key': 'str', '*type': 'str', '*data': ['DataObject'] } }
>
> Hi Paolo,
>
>> > This is missing '*optional': 'bool'. Also, how do you distinguish these:
>> >
>> > { 'command': 'query-tpm-types', 'returns': 'TpmType] }
> do you mean 'TpmType' ? not 'TpmType]
Yes.
> {
> "name": "query-tpm-types",
> "type": "Command",
> "returns": [
> > {
> > "type": "passthrough"
> > }
> ]
> },
>
>> > { 'command': 'query-tpm-types', 'returns': ['TpmType'] }
> {
> "name": "query-tpm-types",
> "type": "Command",
> "returns": [
> > {
> > "type": "TpmType",
> > "data": [
> > {
> > "type": "passthrough"
> > }
> > ]
> > }
> ]
> },
Thanks. I see this is unique, but it is also not too intuitive.
So, could you add a "kind" field to DataObject that is an enum
(list/dict/scalar, or something like that)? This would make it easier
to parse (for humans at least, but I guess also for programs).
Paolo
>> >
>> > Could it have to be like this?
>> >
>> > 'data': { '*key': 'str', '*type': 'str', '*list': 'bool',
>> > '*optional': 'bool',
>> > '*data': ['DataObject'] } }
> there are three conditions:
> 1) list
> 2) dict
> 3) string
>
>> > Can you document, in the commit message or the code,
>
> I added a document for QMP introspection support.
> (docs/qmp-full-introspection.txt)
>
> The DataObject is described in docs/qmp-full-introspection.txt in
> detail.
>
>> > how you avoid infinite loops (possible with optional or list fields)?
>
> +We have four types (ImageInfo, BlockStats, PciDeviceInfo, SchemaData)
> +that uses themself in their own define data directly or indirectly,
> +we will not repeatedly extend them to avoid dead loop.
>
> +/*
> + * Use a string to record the visit path, type index of each node
> + * will be saved to the string, indexes are split by ':'.
> + */
>
> related functions:
> pop_id()
> push_id()
>
> The detail needs to be added to qmp-full-introspection.txt
>
next prev parent reply other threads:[~2013-07-16 11:09 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-16 10:37 [Qemu-devel] [PATCH v2 0/2] QMP full introspection Amos Kong
2013-07-16 10:37 ` [Qemu-devel] [PATCH v2 1/2] qapi: change qapi to convert schema json Amos Kong
2013-07-17 20:09 ` Luiz Capitulino
2013-07-26 3:39 ` Amos Kong
2013-07-19 12:27 ` Eric Blake
2013-07-26 6:53 ` Amos Kong
2013-07-16 10:37 ` [Qemu-devel] [PATCH v2 2/2] full introspection support for QMP Amos Kong
2013-07-16 10:48 ` Paolo Bonzini
2013-07-16 11:04 ` Amos Kong
2013-07-16 11:08 ` Paolo Bonzini [this message]
2013-07-16 12:04 ` Amos Kong
2013-07-16 12:18 ` Paolo Bonzini
2013-07-26 7:03 ` Amos Kong
2013-07-17 20:36 ` Luiz Capitulino
2013-07-19 20:26 ` Eric Blake
2013-07-26 7:21 ` Amos Kong
2013-07-19 22:05 ` Eric Blake
2013-07-26 7:51 ` Amos Kong
2013-07-26 11:52 ` Eric Blake
2013-11-27 2:32 ` Amos Kong
2013-11-27 9:51 ` Kevin Wolf
[not found] ` <20131220110001.GC2890@amosk.info>
2013-12-20 11:57 ` Amos Kong
2013-12-20 18:03 ` Paolo Bonzini
2013-12-23 8:11 ` Amos Kong
2013-12-23 6:32 ` Wenchao Xia
2013-12-23 7:15 ` Amos Kong
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=51E529C7.4060108@redhat.com \
--to=pbonzini@redhat.com \
--cc=akong@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@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).