All of lore.kernel.org
 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 20:04:22 +0800	[thread overview]
Message-ID: <20130716120422.GA14541@amosk.info> (raw)
In-Reply-To: <51E529C7.4060108@redhat.com>

On Tue, Jul 16, 2013 at 01:08:55PM +0200, Paolo Bonzini wrote:
> 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).

I thought we can identify the kind by some judgment.
 if the dict has key 'key', it's a dict
 if no 'key', have 'type', it's a list
 if only have 'type', it's a buildin type (or extended type that
   doesn't need to be extended)
 if no 'key', have 'type' & 'data', it's extended list type
 if have 'key', 'type', 'data', it's extended dict type

I will added a 'kind' field to make it clearer.

KIND enum:
  list
  dict
  str

scalar(bool):   Or just simplely check if have 'data' key?
  true/false

Amos

> Paolo

  reply	other threads:[~2013-07-16 12: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
2013-07-16 11:08       ` Paolo Bonzini
2013-07-16 12:04         ` Amos Kong [this message]
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=20130716120422.GA14541@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.