qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: Paolo Bonzini <pbonzini@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 19:04:40 +0800	[thread overview]
Message-ID: <20130716110440.GC743@amosk.info> (raw)
In-Reply-To: <51E52504.5060306@redhat.com>

On Tue, Jul 16, 2013 at 12:48:36PM +0200, Paolo Bonzini wrote:
> Il 16/07/2013 12:37, 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]

        {
            "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"
         >              }
         >          ]
         >      }
            ]
        },

> 
> 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
 
> Paolo
> 
> > Not all the keys in data will be used.
> >  # List: type
> >  # Dict: key, type
> >  # nested List: type, data
> >  # nested Dict: key, type, data
> > 
> > The DataObject is described in docs/qmp-full-introspection.txt in
> > detail.
> > 
> > The following content gives an example of query-tpm-types:
> > 
> >  ## Define example in qapi-schema.json:
> > 
> >  { 'enum': 'TpmType', 'data': [ 'passthrough' ] }
> >  { 'command': 'query-tpm-types', 'returns': ['TpmType'] }
> > 
> >  ## Returned description:
> > 
> >  {
> >      "name": "query-tpm-types",
> >      "type": "Command",
> >      "returns": [
> >          {
> >              "type": "TpmType",
> >              "data": [
> >                  {
> >                      "type": "passthrough"
> >                  }
> >              ]
> >          }
> >      ]
> >  },

-- 
			Amos.

  reply	other threads:[~2013-07-16 11:04 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 [this message]
2013-07-16 11:08       ` Paolo Bonzini
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=20130716110440.GC743@amosk.info \
    --to=akong@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=pbonzini@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).