From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba4AR-0005BB-AM for qemu-devel@nongnu.org; Wed, 17 Aug 2016 12:58:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ba4AO-0002ND-9O for qemu-devel@nongnu.org; Wed, 17 Aug 2016 12:58:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47992) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba4AO-0002N3-0v for qemu-devel@nongnu.org; Wed, 17 Aug 2016 12:58:12 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A17543A34 for ; Wed, 17 Aug 2016 16:58:11 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 17 Aug 2016 20:57:40 +0400 Message-Id: <20160817165757.23486-4-marcandre.lureau@redhat.com> In-Reply-To: <20160817165757.23486-1-marcandre.lureau@redhat.com> References: <20160817165757.23486-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v5 03/20] build-sys: make qemu qapi per-target List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: eblake@redhat.com, armbru@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= The qapi schema has per-target definitions. Generate the marshaller, events and introspection per target. Keep the types, visitors and headers generic to keep common code unaware. However, having per-target events requires block events stubs. The following patch will use config headers to conditionally remove disabled features from the schema. Signed-off-by: Marc-Andr=C3=A9 Lureau --- stubs/qapi-event.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++= ++++++ Makefile | 54 +++++++++++++++----------------------- Makefile.objs | 7 +---- Makefile.target | 23 +++++++++++++++++ stubs/Makefile.objs | 1 + qapi.mak | 14 ++++++++++ 6 files changed, 133 insertions(+), 40 deletions(-) create mode 100644 stubs/qapi-event.c create mode 100644 qapi.mak diff --git a/stubs/qapi-event.c b/stubs/qapi-event.c new file mode 100644 index 0000000..73b5424 --- /dev/null +++ b/stubs/qapi-event.c @@ -0,0 +1,74 @@ +#include "qemu/osdep.h" +#include "qapi-event.h" + +void qapi_event_send_device_tray_moved(const char *device, bool tray_ope= n, + Error **errp) +{ +} + +void qapi_event_send_quorum_report_bad(QuorumOpType type, bool has_error= , + const char *error, const char *no= de_name, + int64_t sector_num, + int64_t sectors_count, Error **er= rp) +{ +} + +void qapi_event_send_quorum_failure(const char *reference, int64_t secto= r_num, + int64_t sectors_count, Error **errp) +{ +} + +void qapi_event_send_block_job_cancelled(BlockJobType type, const char *= device, + int64_t len, int64_t offset, + int64_t speed, Error **errp) +{ +} + +void qapi_event_send_block_job_completed(BlockJobType type, const char *= device, + int64_t len, int64_t offset, + int64_t speed, bool has_error, + const char *error, Error **errp= ) +{ +} + +void qapi_event_send_block_job_error(const char *device, + IoOperationType operation, + BlockErrorAction action, Error **er= rp) +{ +} + +void qapi_event_send_block_job_ready(BlockJobType type, const char *devi= ce, + int64_t len, int64_t offset, int64_= t speed, + Error **errp) +{ +} + +void qapi_event_send_block_io_error(const char *device, + IoOperationType operation, + BlockErrorAction action, bool has_no= space, + bool nospace, const char *reason, + Error **errp) +{ +} + +void qapi_event_send_block_image_corrupted(const char *device, + bool has_node_name, + const char *node_name, + const char *msg, bool has_off= set, + int64_t offset, bool has_size= , + int64_t size, bool fatal, + Error **errp) +{ +} + +void qapi_event_send_block_write_threshold(const char *node_name, + uint64_t amount_exceeded, + uint64_t write_threshold, + Error **errp) +{ +} + +void qapi_event_send_device_deleted(bool has_device, const char *device, + const char *path, Error **errp) +{ +} diff --git a/Makefile b/Makefile index 50b4b3a..83d27fb 100644 --- a/Makefile +++ b/Makefile @@ -49,12 +49,11 @@ endif endif =20 include $(SRC_PATH)/rules.mak +include $(SRC_PATH)/qapi.mak =20 GENERATED_HEADERS =3D qemu-version.h config-host.h qemu-options.def GENERATED_HEADERS +=3D qmp-commands.h qapi-types.h qapi-visit.h qapi-eve= nt.h -GENERATED_SOURCES +=3D qmp-marshal.c qapi-types.c qapi-visit.c qapi-even= t.c -GENERATED_HEADERS +=3D qmp-introspect.h -GENERATED_SOURCES +=3D qmp-introspect.c +GENERATED_SOURCES +=3D qapi-types.c qapi-visit.c =20 GENERATED_HEADERS +=3D trace/generated-events.h GENERATED_SOURCES +=3D trace/generated-events.c @@ -268,56 +267,43 @@ qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC= _PATH)/scripts/hxtool qemu-ga$(EXESUF): LIBS =3D $(LIBS_QGA) qemu-ga$(EXESUF): QEMU_CFLAGS +=3D -I qga/qapi-generated =20 -gen-out-type =3D $(subst .,-,$(suffix $@)) - -qapi-py =3D $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.= py - qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h = :\ -$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qap= i-py) +$(SRC_PATH)/qga/qapi-schema.json $(qapi-types-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \ - $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \ + $(qapi-gen-type) -o qga/qapi-generated -p "qga-" $<, \ " GEN $@") qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h = :\ -$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qap= i-py) +$(SRC_PATH)/qga/qapi-schema.json $(qapi-visit-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \ - $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \ + $(qapi-gen-type) -o qga/qapi-generated -p "qga-" $<, \ " GEN $@") qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal= .c :\ -$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(= qapi-py) +$(SRC_PATH)/qga/qapi-schema.json $(qapi-commands-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ - $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \ + $(qapi-gen-type) -o qga/qapi-generated -p "qga-" $<, \ " GEN $@") =20 -qapi-modules =3D $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.js= on \ - $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.j= son \ - $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.j= son \ - $(SRC_PATH)/qapi/crypto.json $(SRC_PATH)/qapi/rocker.json= \ - $(SRC_PATH)/qapi/trace.json - qapi-types.c qapi-types.h :\ -$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) +$(qapi-modules) $(qapi-types-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \ - $(gen-out-type) -o "." -b $<, \ + $(qapi-gen-type) -o "." -b $<, \ " GEN $@") qapi-visit.c qapi-visit.h :\ -$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py) +$(qapi-modules) $(qapi-visit-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \ - $(gen-out-type) -o "." -b $<, \ + $(qapi-gen-type) -o "." -b $<, \ " GEN $@") -qapi-event.c qapi-event.h :\ -$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py) + +qapi-event.h :\ +$(qapi-modules) $(qapi-event-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \ - $(gen-out-type) -o "." $<, \ + $(qapi-gen-type) -o "." $<, \ " GEN $@") -qmp-commands.h qmp-marshal.c :\ -$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) + +qmp-commands.h :\ +$(qapi-modules) $(qapi-commands-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ - $(gen-out-type) -o "." -m $<, \ - " 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 "." $<, \ + $(qapi-gen-type) -o "." -m $<, \ " GEN $@") =20 QGALIB_GEN=3D$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-= visit.h qga-qmp-commands.h) diff --git a/Makefile.objs b/Makefile.objs index 6d5ddcf..7addab8 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -2,7 +2,7 @@ # Common libraries for tools and emulators stub-obj-y =3D stubs/ crypto/ util-obj-y =3D util/ qobject/ qapi/ -util-obj-y +=3D qmp-introspect.o qapi-types.o qapi-visit.o qapi-event.o +util-obj-y +=3D qapi-types.o qapi-visit.o =20 ####################################################################### # block-obj-y is code used by both qemu system emulation and qemu-img @@ -78,11 +78,6 @@ common-obj-$(CONFIG_SECCOMP) +=3D qemu-seccomp.o =20 common-obj-$(CONFIG_FDT) +=3D device_tree.o =20 -###################################################################### -# qapi - -common-obj-y +=3D qmp-marshal.o -common-obj-y +=3D qmp-introspect.o common-obj-y +=3D qmp.o hmp.o endif =20 diff --git a/Makefile.target b/Makefile.target index a440bcb..6b672eb 100644 --- a/Makefile.target +++ b/Makefile.target @@ -6,6 +6,7 @@ include ../config-host.mak include config-target.mak include config-devices.mak include $(SRC_PATH)/rules.mak +include $(SRC_PATH)/qapi.mak =20 $(call set-vpath, $(SRC_PATH):$(BUILD_DIR)) ifdef CONFIG_LINUX @@ -157,6 +158,28 @@ obj-y +=3D hw/$(TARGET_BASE_ARCH)/ endif =20 GENERATED_HEADERS +=3D hmp-commands.h hmp-commands-info.h qmp-commands-o= ld.h +GENERATED_HEADERS +=3D qmp-introspect.h +GENERATED_SOURCES +=3D qmp-introspect.c qmp-marshal.c qapi-event.c + +qmp-marshal.c :\ +$(qapi-modules) $(qapi-commands-py) + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ + $(qapi-gen-type) -o "." -m $<, \ + " GEN $(TARGET_DIR)$@") + +qapi-event.c :\ +$(qapi-modules) $(qapi-event-py) + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \ + $(qapi-gen-type) -o "." $<, \ + " GEN $@") + +qmp-introspect.h qmp-introspect.c :\ +$(qapi-modules) $(qapi-introspect-py) + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \ + $(qapi-gen-type) -o "." $<, \ + " GEN $(TARGET_DIR)$@") + +obj-y +=3D qmp-marshal.o qmp-introspect.o qapi-event.o =20 endif # CONFIG_SOFTMMU =20 diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 55edd15..aa2cbef 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -45,3 +45,4 @@ stub-obj-y +=3D iohandler.o stub-obj-y +=3D smbios_type_38.o stub-obj-y +=3D ipmi.o stub-obj-y +=3D pc_madt_cpu_entry.o +stub-obj-y +=3D qapi-event.o diff --git a/qapi.mak b/qapi.mak new file mode 100644 index 0000000..4e26714 --- /dev/null +++ b/qapi.mak @@ -0,0 +1,14 @@ +qapi-gen-type =3D $(subst .,-,$(suffix $@)) + +qapi-modules =3D $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.js= on \ + $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \ + $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.json \ + $(SRC_PATH)/qapi/crypto.json $(SRC_PATH)/qapi/rocker.json \ + $(SRC_PATH)/qapi/trace.json + +qapi-py =3D $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.= py + +qapi-types-py =3D $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) +qapi-visit-py =3D $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py) +qapi-commands-py =3D $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) +qapi-introspect-py =3D $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py) --=20 2.9.0