qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/3] qapi: change qapi to convert schema json


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH v3 2/3] qapi: change qapi to convert schema json
Date: Mon, 06 Jan 2014 18:11:27 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 2014年01月05日 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[] = {
     "{ 'type': 'NameInfo', 'data': {'*name': 'str'} }",
     "{ 'command': 'query-name', 'returns': 'NameInfo' }",
     ...
   }

Signed-off-by: Amos Kong <address@hidden>
---
  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 = 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
@@ -229,6 +229,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 "." -s 
"$@" < $<, "  GEN   $@")


It would be nice to also add this file to .gitignore together with this patch.

Fam



reply via email to

[Prev in Thread] Current Thread [Next in Thread]