From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W079z-00011z-JG for qemu-devel@nongnu.org; Mon, 06 Jan 2014 05:11:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W079v-0007UB-2j for qemu-devel@nongnu.org; Mon, 06 Jan 2014 05:11:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W079u-0007U5-Q3 for qemu-devel@nongnu.org; Mon, 06 Jan 2014 05:11:47 -0500 Message-ID: <52CA814F.40406@redhat.com> Date: Mon, 06 Jan 2014 18:11:27 +0800 From: Fam Zheng MIME-Version: 1.0 References: <1388923351-10556-1-git-send-email-akong@redhat.com> <1388923351-10556-3-git-send-email-akong@redhat.com> In-Reply-To: <1388923351-10556-3-git-send-email-akong@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 2/3] qapi: change qapi to convert schema json List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong , qemu-devel@nongnu.org Cc: qiaonuohan@cn.fujitsu.com, lcapitulino@redhat.com, mdroth@linux.vnet.ibm.com, xiawenc@linux.vnet.ibm.com On 2014=E5=B9=B401=E6=9C=8805=E6=97=A5 20:02, 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 in QEMU code. > > eg: (qmp-schema.h) > const char *const qmp_schema_table[] =3D { > "{ '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 | 48 +++++++++++++++++++++++++++++++++++++++= ++++++--- > scripts/qapi-visit.py | 2 +- > scripts/qapi.py | 20 +++++++++++++++----- > 5 files changed, 66 insertions(+), 11 deletions(-) > > diff --git a/Makefile b/Makefile > index bdff4e4..2c29755 100644 > --- a/Makefile > +++ b/Makefile > @@ -45,7 +45,7 @@ endif > endif > > GENERATED_HEADERS =3D config-host.h qemu-options.def > -GENERATED_HEADERS +=3D qmp-commands.h qapi-types.h qapi-visit.h > +GENERATED_HEADERS +=3D qmp-commands.h qapi-types.h qapi-visit.h qmp-sc= hema.h > GENERATED_SOURCES +=3D qmp-marshal.c qapi-types.c qapi-visit.c > > GENERATED_HEADERS +=3D trace/generated-events.h > @@ -229,6 +229,9 @@ $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qa= pi-visit.py $(qapi-py) > qmp-commands.h qmp-marshal.c :\ > $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(q= api-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 $(ge= n-out-type) -o "." -s "$@" < $<, " GEN $@") > It would be nice to also add this file to .gitignore together with this=20 patch. Fam