Re: [Qemu-devel] [PATCH v3 44/50] build-sys: add a target schema
Hi On Thu, Dec 14, 2017 at 5:34 PM, Markus Armbrusterwrote: > Marc-André Lureau writes: > >> This schema is going to contain target-specific commands/events & >> types, that can be conditionnally guarded with poisoned defines. To >> filter it out by default, set the unit name to 'target'. >> >> And new rules to compile this unit generated files per-target. >> >> Use the "-u all" options for the introspection schema, since it is >> generated as a single file and must contain all definitions. >> >> Signed-off-by: Marc-André Lureau >> --- >> qapi-schema.json | 1 + >> qapi/target.json | 3 +++ >> monitor.c| 2 ++ >> Makefile | 29 - >> Makefile.target | 2 ++ >> 5 files changed, 36 insertions(+), 1 deletion(-) >> create mode 100644 qapi/target.json >> >> diff --git a/qapi-schema.json b/qapi-schema.json >> index f3af2cb851..42b6aebddb 100644 >> --- a/qapi-schema.json >> +++ b/qapi-schema.json >> @@ -92,6 +92,7 @@ >> { 'include': 'qapi/transaction.json' } >> { 'include': 'qapi/trace.json' } >> { 'include': 'qapi/introspect.json' } >> +{ 'include': 'qapi/target.json' } >> >> ## >> # = Miscellanea >> diff --git a/qapi/target.json b/qapi/target.json >> new file mode 100644 >> index 00..e9644f52c2 >> --- /dev/null >> +++ b/qapi/target.json >> @@ -0,0 +1,3 @@ >> +# -*- Mode: Python -*- >> + >> +{ 'pragma': { 'unit': 'target' } } >> diff --git a/monitor.c b/monitor.c >> index bf8a7685bf..af4eaeca5e 100644 >> --- a/monitor.c >> +++ b/monitor.c >> @@ -68,6 +68,7 @@ >> #include "exec/exec-all.h" >> #include "qemu/log.h" >> #include "qmp-commands.h" >> +#include "target-qmp-commands.h" >> #include "hmp.h" >> #include "qemu/thread.h" >> #include "block/qapi.h" >> @@ -1003,6 +1004,7 @@ void monitor_init_qmp_commands(void) >> >> QTAILQ_INIT(_commands); >> qmp_init_marshal(_commands); >> +target_qmp_init_marshal(_commands); >> >> qmp_register_command(_commands, "query-qmp-schema", >> qmp_query_qmp_schema, >> diff --git a/Makefile b/Makefile >> index 337a1f6f9b..7356b4e7b7 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -54,6 +54,8 @@ include $(SRC_PATH)/rules.mak >> GENERATED_FILES = qemu-version.h config-host.h qemu-options.def >> GENERATED_FILES += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h >> GENERATED_FILES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c >> +GENERATED_FILES += target-qmp-commands.h target-qapi-types.h >> target-qapi-visit.h target-qapi-event.h >> +GENERATED_FILES += target-qmp-marshal.c target-qapi-types.c >> target-qapi-visit.c target-qapi-event.c >> GENERATED_FILES += qmp-introspect.h >> GENERATED_FILES += qmp-introspect.c >> >> @@ -418,6 +420,7 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json >> $(SRC_PATH)/qapi/common.json \ >> $(SRC_PATH)/qapi/rocker.json \ >> $(SRC_PATH)/qapi/run-state.json \ >> $(SRC_PATH)/qapi/sockets.json \ >> + $(SRC_PATH)/qapi/target.json \ >> $(SRC_PATH)/qapi/tpm.json \ >> $(SRC_PATH)/qapi/trace.json \ >> $(SRC_PATH)/qapi/transaction.json \ >> @@ -443,10 +446,34 @@ $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py >> $(qapi-py) >> $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ >> $(gen-out-type) -o "." $<, \ >> "GEN","$@") >> + >> +target-qapi-types.c target-qapi-types.h :\ >> +$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) >> + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \ >> + -i qapi-types.h \ >> + $(gen-out-type) -p target- -u target $<, \ >> + "GEN","$@") >> +target-qapi-visit.c target-qapi-visit.h :\ >> +$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py) >> + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \ >> + -i qapi-visit.h \ >> + $(gen-out-type) -p target- -u target $<, \ >> + "GEN","$@") >> +target-qapi-event.c target-qapi-event.h :\ >> +$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py) >> + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \ >> + $(gen-out-type) -p target- -u target $<, \ >> + "GEN","$@") >> +target-qmp-commands.h target-qmp-marshal.c :\ >> +$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) >> + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ >> + $(gen-out-type) -p target- -u target $<, \ >> + "GEN","$@") >> + >> qmp-introspect.h qmp-introspect.c :\ >> $(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py) >> $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \ >> - $(gen-out-type) -o "." $<, \ >> + $(gen-out-type) -o "." -u all $<, \ >>
Re: [Qemu-devel] [PATCH v3 44/50] build-sys: add a target schema
Marc-André Lureauwrites: > This schema is going to contain target-specific commands/events & > types, that can be conditionnally guarded with poisoned defines. To > filter it out by default, set the unit name to 'target'. > > And new rules to compile this unit generated files per-target. > > Use the "-u all" options for the introspection schema, since it is > generated as a single file and must contain all definitions. > > Signed-off-by: Marc-André Lureau > --- > qapi-schema.json | 1 + > qapi/target.json | 3 +++ > monitor.c| 2 ++ > Makefile | 29 - > Makefile.target | 2 ++ > 5 files changed, 36 insertions(+), 1 deletion(-) > create mode 100644 qapi/target.json > > diff --git a/qapi-schema.json b/qapi-schema.json > index f3af2cb851..42b6aebddb 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -92,6 +92,7 @@ > { 'include': 'qapi/transaction.json' } > { 'include': 'qapi/trace.json' } > { 'include': 'qapi/introspect.json' } > +{ 'include': 'qapi/target.json' } > > ## > # = Miscellanea > diff --git a/qapi/target.json b/qapi/target.json > new file mode 100644 > index 00..e9644f52c2 > --- /dev/null > +++ b/qapi/target.json > @@ -0,0 +1,3 @@ > +# -*- Mode: Python -*- > + > +{ 'pragma': { 'unit': 'target' } } > diff --git a/monitor.c b/monitor.c > index bf8a7685bf..af4eaeca5e 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -68,6 +68,7 @@ > #include "exec/exec-all.h" > #include "qemu/log.h" > #include "qmp-commands.h" > +#include "target-qmp-commands.h" > #include "hmp.h" > #include "qemu/thread.h" > #include "block/qapi.h" > @@ -1003,6 +1004,7 @@ void monitor_init_qmp_commands(void) > > QTAILQ_INIT(_commands); > qmp_init_marshal(_commands); > +target_qmp_init_marshal(_commands); > > qmp_register_command(_commands, "query-qmp-schema", > qmp_query_qmp_schema, > diff --git a/Makefile b/Makefile > index 337a1f6f9b..7356b4e7b7 100644 > --- a/Makefile > +++ b/Makefile > @@ -54,6 +54,8 @@ include $(SRC_PATH)/rules.mak > GENERATED_FILES = qemu-version.h config-host.h qemu-options.def > GENERATED_FILES += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h > GENERATED_FILES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c > +GENERATED_FILES += target-qmp-commands.h target-qapi-types.h > target-qapi-visit.h target-qapi-event.h > +GENERATED_FILES += target-qmp-marshal.c target-qapi-types.c > target-qapi-visit.c target-qapi-event.c > GENERATED_FILES += qmp-introspect.h > GENERATED_FILES += qmp-introspect.c > > @@ -418,6 +420,7 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json > $(SRC_PATH)/qapi/common.json \ > $(SRC_PATH)/qapi/rocker.json \ > $(SRC_PATH)/qapi/run-state.json \ > $(SRC_PATH)/qapi/sockets.json \ > + $(SRC_PATH)/qapi/target.json \ > $(SRC_PATH)/qapi/tpm.json \ > $(SRC_PATH)/qapi/trace.json \ > $(SRC_PATH)/qapi/transaction.json \ > @@ -443,10 +446,34 @@ $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py > $(qapi-py) > $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ > $(gen-out-type) -o "." $<, \ > "GEN","$@") > + > +target-qapi-types.c target-qapi-types.h :\ > +$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) > + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \ > + -i qapi-types.h \ > + $(gen-out-type) -p target- -u target $<, \ > + "GEN","$@") > +target-qapi-visit.c target-qapi-visit.h :\ > +$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py) > + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \ > + -i qapi-visit.h \ > + $(gen-out-type) -p target- -u target $<, \ > + "GEN","$@") > +target-qapi-event.c target-qapi-event.h :\ > +$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py) > + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \ > + $(gen-out-type) -p target- -u target $<, \ > + "GEN","$@") > +target-qmp-commands.h target-qmp-marshal.c :\ > +$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) > + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ > + $(gen-out-type) -p target- -u target $<, \ > + "GEN","$@") > + > qmp-introspect.h qmp-introspect.c :\ > $(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py) > $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \ > - $(gen-out-type) -o "." $<, \ > + $(gen-out-type) -o "." -u all $<, \ > "GEN","$@") > Let's see whether I understand how this works. Without -u (not fully visible in the diff), we get everything but the target-specific stuff. With -u target, we get