@@ -44,6 +44,13 @@ ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
endif
endif
+GENERATED_BLOCK_HEADERS = block/qapi-generated/qmp-commands.h
+GENERATED_BLOCK_HEADERS += block/qapi-generated/qapi-types.h
+GENERATED_BLOCK_HEADERS += block/qapi-generated/qapi-visit.h
+GENERATED_BLOCK_SOURCES = block/qapi-generated/qmp-marshal.c
+GENERATED_BLOCK_SOURCES += block/qapi-generated/qapi-types.c
+GENERATED_BLOCK_SOURCES += block/qapi-generated/qapi-visit.c
+
GENERATED_HEADERS = config-host.h qemu-options.def
GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
@@ -136,6 +143,7 @@ dummy := $(call unnest-vars,, \
qga-vss-dll-obj-y \
block-obj-y \
block-obj-m \
+ qapi-block-obj-y \
common-obj-y \
common-obj-m)
@@ -212,7 +220,8 @@ util/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)'
qemu-img.o: qemu-img-cmds.h
qemu-img$(EXESUF): qemu-img.o $(block-obj-y) libqemuutil.a libqemustub.a
-qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) libqemuutil.a libqemustub.a
+qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(qapi-block-obj-y) libqemustub.a
+qemu-nbd$(EXESUF): QEMU_CFLAGS += -DBLOCK_COMMAND_MONITOR
qemu-io$(EXESUF): qemu-io.o $(block-obj-y) libqemuutil.a libqemustub.a
qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
@@ -271,6 +280,22 @@ $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
$(gen-out-type) -o "." -m -i $<, \
" GEN $@")
+block/qapi-generated/qapi-types.c block/qapi-generated/qapi-types.h :\
+$(SRC_PATH)/qapi/block-core.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
+ $(gen-out-type) -o block/qapi-generated -b -i $<, \
+ " GEN $@")
+block/qapi-generated/qapi-visit.c block/qapi-generated/qapi-visit.h :\
+$(SRC_PATH)/qapi/block-core.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
+ $(gen-out-type) -o block/qapi-generated -b -i $<, \
+ " GEN $@")
+block/qapi-generated/qmp-commands.h block/qapi-generated/qmp-marshal.c :\
+$(SRC_PATH)/qapi/block-core.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
+ $(gen-out-type) -o block/qapi-generated -m -i $<, \
+ " GEN $@")
+
QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
@@ -291,8 +316,11 @@ clean:
rm -f trace/generated-tracers-dtrace.h*
rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
+ rm -f $(foreach f,$(GENERATED_BLOCK_HEADERS),$(f) $(f)-timestamp)
+ rm -f $(foreach f,$(GENERATED_BLOCK_SOURCES),$(f) $(f)-timestamp)
rm -rf qapi-generated
rm -rf qga/qapi-generated
+ rm -rf block/qapi-generated
for d in $(ALL_SUBDIRS); do \
if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
rm -f $$d/qemu-options.def; \
@@ -550,7 +578,8 @@ endif # CONFIG_WIN
# Add a dependency on the generated files, so that they are always
# rebuilt before other object files
ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
-Makefile: $(GENERATED_HEADERS)
+Makefile: $(GENERATED_HEADERS) $(GENERATED_BLOCK_HEADERS)\
+ $(GENERATED_BLOCK_SOURCES)
endif
# Include automatically generated dependency files
@@ -21,6 +21,16 @@ block-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o
block-obj-m = block/
+qapi-block-obj-y = block/qapi-generated/qmp-marshal.o blockdev.o qmp.o
+qapi-block-obj-y += monitor.o
+qapi-block-obj-y += qemu-char.o
+qapi-block-obj-y += qemu-log.o
+qapi-block-obj-y += qom/
+qapi-block-obj-y += util/
+qapi-block-obj-y += qobject/
+qapi-block-obj-y += block/
+qapi-block-obj-y += qapi/
+qapi-block-obj-y += stubs/
######################################################################
# smartcard
@@ -20,10 +20,13 @@ block-obj-$(CONFIG_GLUSTERFS) += gluster.o
block-obj-$(CONFIG_LIBSSH2) += ssh.o
endif
-common-obj-y += stream.o
-common-obj-y += commit.o
-common-obj-y += mirror.o
-common-obj-y += backup.o
+block-job-obj-y = stream.o
+block-job-obj-y += commit.o
+block-job-obj-y += mirror.o
+block-job-obj-y += backup.o
+
+common-obj-y += $(block-job-obj-y)
+qapi-block-obj-y += $(block-job-obj-y)
iscsi.o-cflags := $(LIBISCSI_CFLAGS)
iscsi.o-libs := $(LIBISCSI_LIBS)
@@ -4,3 +4,5 @@ util-obj-y += string-input-visitor.o string-output-visitor.o
util-obj-y += opts-visitor.o
util-obj-y += qmp-event.o
+
+qapi-block-obj-y += $(util-obj-y)
@@ -1,3 +1,5 @@
util-obj-y = qint.o qstring.o qdict.o qlist.o qfloat.o qbool.o
util-obj-y += qjson.o json-lexer.o json-streamer.o json-parser.o
util-obj-y += qerror.o
+
+qapi-block-obj-y += $(util-obj-y)
@@ -1,3 +1,5 @@
-common-obj-y = object.o container.o qom-qobject.o
-common-obj-y += cpu.o
-common-obj-y += object_interfaces.o
+qom-obj-y = object.o container.o qom-qobject.o
+qom-obj-y += object_interfaces.o
+
+common-obj-y += $(qom-obj-y) cpu.o
+qapi-block-obj-y += $(qom-obj-y)
@@ -40,3 +40,18 @@ stub-obj-$(CONFIG_WIN32) += fd-register.o
stub-obj-y += cpus.o
stub-obj-y += kvm.o
stub-obj-y += qmp_pc_dimm_device_list.o
+
+qapi-block-obj-y += arch-type.o
+qapi-block-obj-y += autostart.o
+qapi-block-obj-y += kvm-allowed.o
+qapi-block-obj-y += cpus-list.o
+qapi-block-obj-y += serial-hds.o
+qapi-block-obj-y += qemu-chr-open-msmouse.o
+qapi-block-obj-y += runstate-is-running.o
+qapi-block-obj-y += kvm-cpu-synchronize-state.o
+qapi-block-obj-y += kvm-cpu-synchronize-post-init.o
+qapi-block-obj-y += qemu-add-machine-init-done-notifier.o
+qapi-block-obj-y += get-double.o
+qapi-block-obj-y += get-expr.o
+qapi-block-obj-y += vmstate-info-buffer.o
+qapi-block-obj-y += vmstate-info-uint32.o
new file mode 100644
@@ -0,0 +1,3 @@
+#include <stdint.h>
+
+const uint32_t arch_type = -1;
new file mode 100644
@@ -0,0 +1 @@
+int autostart;
new file mode 100644
@@ -0,0 +1,3 @@
+#include "sysemu/kvm.h"
+
+struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
new file mode 100644
@@ -0,0 +1,8 @@
+#include <stdint.h>
+#include "monitor/monitor-system.h"
+
+int get_double(Monitor *mon, double *pval, const char **pp)
+{
+ *pval = 0;
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,8 @@
+#include <stdint.h>
+#include "monitor/monitor-system.h"
+
+int get_expr(Monitor *mon, int64_t *pval, const char **pp)
+{
+ *pval = 0;
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,3 @@
+#include <stdbool.h>
+
+bool kvm_allowed;
new file mode 100644
@@ -0,0 +1,5 @@
+#include "sysemu/kvm.h"
+
+void kvm_cpu_synchronize_post_init(CPUState *cpu)
+{
+}
new file mode 100644
@@ -0,0 +1,5 @@
+#include "sysemu/kvm.h"
+
+void kvm_cpu_synchronize_state(CPUState *cpu)
+{
+}
new file mode 100644
@@ -0,0 +1,5 @@
+#include "sysemu/sysemu.h"
+
+void qemu_add_machine_init_done_notifier(Notifier *notify)
+{
+}
new file mode 100644
@@ -0,0 +1,7 @@
+#include "sysemu/char.h"
+#include "ui/console.h"
+
+CharDriverState *qemu_chr_open_msmouse(void)
+{
+ return NULL;
+}
new file mode 100644
@@ -0,0 +1,6 @@
+#include "sysemu/sysemu.h"
+
+int runstate_is_running(void)
+{
+ return 1;
+}
new file mode 100644
@@ -0,0 +1,3 @@
+#include "sysemu/sysemu.h"
+
+CharDriverState *serial_hds[MAX_SERIAL_PORTS];
new file mode 100644
@@ -0,0 +1,8 @@
+#include <qemu-common.h>
+#include "migration/vmstate.h"
+
+const VMStateInfo vmstate_info_buffer = {
+ .name = "buffer",
+ .get = NULL,
+ .put = NULL,
+};
new file mode 100644
@@ -0,0 +1,8 @@
+#include <qemu-common.h>
+#include "migration/vmstate.h"
+
+const VMStateInfo vmstate_info_uint32 = {
+ .name = "uint32",
+ .get = NULL,
+ .put = NULL,
+};
@@ -15,3 +15,5 @@ util-obj-y += throttle.o
util-obj-y += getauxval.o
util-obj-y += readline.o
util-obj-y += rfifolock.o
+
+qapi-block-obj-y += $(util-obj-y)
Compile and link QAPI block core code into qemu-nbd. This patch circle around unwanted dependecies by stubing some functions in the stubs directory. Signed-off-by: Benoît Canet <benoit.canet@nodalink.com> --- Makefile | 33 +++++++++++++++++++++++++++-- Makefile.objs | 10 +++++++++ block/Makefile.objs | 11 ++++++---- qapi/Makefile.objs | 2 ++ qobject/Makefile.objs | 2 ++ qom/Makefile.objs | 8 ++++--- stubs/Makefile.objs | 15 +++++++++++++ stubs/arch-type.c | 3 +++ stubs/autostart.c | 1 + stubs/cpus-list.c | 3 +++ stubs/get-double.c | 8 +++++++ stubs/get-expr.c | 8 +++++++ stubs/kvm-allowed.c | 3 +++ stubs/kvm-cpu-synchronize-post-init.c | 5 +++++ stubs/kvm-cpu-synchronize-state.c | 5 +++++ stubs/qemu-add-machine-init-done-notifier.c | 5 +++++ stubs/qemu-chr-open-msmouse.c | 7 ++++++ stubs/runstate-is-running.c | 6 ++++++ stubs/serial-hds.c | 3 +++ stubs/vmstate-info-buffer.c | 8 +++++++ stubs/vmstate-info-uint32.c | 8 +++++++ util/Makefile.objs | 2 ++ 22 files changed, 147 insertions(+), 9 deletions(-) create mode 100644 stubs/arch-type.c create mode 100644 stubs/autostart.c create mode 100644 stubs/cpus-list.c create mode 100644 stubs/get-double.c create mode 100644 stubs/get-expr.c create mode 100644 stubs/kvm-allowed.c create mode 100644 stubs/kvm-cpu-synchronize-post-init.c create mode 100644 stubs/kvm-cpu-synchronize-state.c create mode 100644 stubs/qemu-add-machine-init-done-notifier.c create mode 100644 stubs/qemu-chr-open-msmouse.c create mode 100644 stubs/runstate-is-running.c create mode 100644 stubs/serial-hds.c create mode 100644 stubs/vmstate-info-buffer.c create mode 100644 stubs/vmstate-info-uint32.c