From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2Ys1-00079S-KB for qemu-devel@nongnu.org; Thu, 25 Jul 2013 23:39:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2Ys0-0002Tq-MN for qemu-devel@nongnu.org; Thu, 25 Jul 2013 23:39:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2Ys0-0002Sm-F5 for qemu-devel@nongnu.org; Thu, 25 Jul 2013 23:39:08 -0400 Date: Fri, 26 Jul 2013 11:39:04 +0800 From: Amos Kong Message-ID: <20130726033904.GA9320@amosk.info> References: <1373971062-28909-1-git-send-email-akong@redhat.com> <1373971062-28909-2-git-send-email-akong@redhat.com> <20130717160932.7dd328b3@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130717160932.7dd328b3@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 1/2] qapi: change qapi to convert schema json List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com On Wed, Jul 17, 2013 at 04:09:32PM -0400, Luiz Capitulino wrote: > On Tue, 16 Jul 2013 18:37:41 +0800 > Amos Kong wrote: > > > QMP schema is defined in a json file, it will be parsed by > > qapi scripts and generate C files. > > > > We want to return the schema information to management, > > this patch converts the json file to a string table in a > > C head file, then we can use the json content. > > > > eg: > > const char *const qmp_schema_table[] = { > > "{ 'type': 'NameInfo', 'data': {'*name': 'str'} }", > > "{ 'command': 'query-name', 'returns': 'NameInfo' }", > > ... > > } > > > > Signed-off-by: Amos Kong > > --- > > Makefile | 5 ++++- > > scripts/qapi-commands.py | 2 +- > > scripts/qapi-types.py | 47 ++++++++++++++++++++++++++++++++++++++++++++--- > > scripts/qapi-visit.py | 2 +- > > scripts/qapi.py | 4 +++- > > 5 files changed, 53 insertions(+), 7 deletions(-) > > > > diff --git a/Makefile b/Makefile > > index c06bfab..2348bce 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -38,7 +38,7 @@ endif > > endif > > > > GENERATED_HEADERS = config-host.h qemu-options.def > > -GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h > > +GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h qmp-schema.h > > GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c > > > > GENERATED_HEADERS += trace/generated-events.h > > @@ -223,6 +223,9 @@ $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py) > > qmp-commands.h qmp-marshal.c :\ > > $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) > > $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, " GEN $@") > > +qmp-schema.h:\ > > +$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) > > + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." -i "$@" < $<, " GEN $@") > > What about qemu-ga? We hadn't confirm with this implement way. It's easy to add a new command to query qga schema info. I can do it in next version.