[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 22/24] qemu-nbd: build QAPI block core into qemu-
From: |
Benoît Canet |
Subject: |
[Qemu-devel] [PATCH v1 22/24] qemu-nbd: build QAPI block core into qemu-nbd |
Date: |
Fri, 1 Aug 2014 07:27:20 +0200 |
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: Benoit Canet <address@hidden>
---
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
diff --git a/Makefile b/Makefile
index d6b9dc1..f56dcaa 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/Makefile.objs b/Makefile.objs
index 0f0f298..6fe81e9 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -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
diff --git a/block/Makefile.objs b/block/Makefile.objs
index fd88c03..a368e98 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -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)
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index d14b769..c67e110 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -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)
diff --git a/qobject/Makefile.objs b/qobject/Makefile.objs
index c9ff59c..96e652d 100644
--- a/qobject/Makefile.objs
+++ b/qobject/Makefile.objs
@@ -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)
diff --git a/qom/Makefile.objs b/qom/Makefile.objs
index 985003b..f388fd3 100644
--- a/qom/Makefile.objs
+++ b/qom/Makefile.objs
@@ -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)
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 528e161..2657984 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -39,3 +39,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
diff --git a/stubs/arch-type.c b/stubs/arch-type.c
new file mode 100644
index 0000000..90b2e80
--- /dev/null
+++ b/stubs/arch-type.c
@@ -0,0 +1,3 @@
+#include <stdint.h>
+
+const uint32_t arch_type = -1;
diff --git a/stubs/autostart.c b/stubs/autostart.c
new file mode 100644
index 0000000..0746d71
--- /dev/null
+++ b/stubs/autostart.c
@@ -0,0 +1 @@
+int autostart;
diff --git a/stubs/cpus-list.c b/stubs/cpus-list.c
new file mode 100644
index 0000000..c1f0455
--- /dev/null
+++ b/stubs/cpus-list.c
@@ -0,0 +1,3 @@
+#include "sysemu/kvm.h"
+
+struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
diff --git a/stubs/get-double.c b/stubs/get-double.c
new file mode 100644
index 0000000..b365266
--- /dev/null
+++ b/stubs/get-double.c
@@ -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;
+}
diff --git a/stubs/get-expr.c b/stubs/get-expr.c
new file mode 100644
index 0000000..e05ad5c
--- /dev/null
+++ b/stubs/get-expr.c
@@ -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;
+}
diff --git a/stubs/kvm-allowed.c b/stubs/kvm-allowed.c
new file mode 100644
index 0000000..74a2fa9
--- /dev/null
+++ b/stubs/kvm-allowed.c
@@ -0,0 +1,3 @@
+#include <stdbool.h>
+
+bool kvm_allowed;
diff --git a/stubs/kvm-cpu-synchronize-post-init.c
b/stubs/kvm-cpu-synchronize-post-init.c
new file mode 100644
index 0000000..f78faa7
--- /dev/null
+++ b/stubs/kvm-cpu-synchronize-post-init.c
@@ -0,0 +1,5 @@
+#include "sysemu/kvm.h"
+
+void kvm_cpu_synchronize_post_init(CPUState *cpu)
+{
+}
diff --git a/stubs/kvm-cpu-synchronize-state.c
b/stubs/kvm-cpu-synchronize-state.c
new file mode 100644
index 0000000..53fd523
--- /dev/null
+++ b/stubs/kvm-cpu-synchronize-state.c
@@ -0,0 +1,5 @@
+#include "sysemu/kvm.h"
+
+void kvm_cpu_synchronize_state(CPUState *cpu)
+{
+}
diff --git a/stubs/qemu-add-machine-init-done-notifier.c
b/stubs/qemu-add-machine-init-done-notifier.c
new file mode 100644
index 0000000..744a6a9
--- /dev/null
+++ b/stubs/qemu-add-machine-init-done-notifier.c
@@ -0,0 +1,5 @@
+#include "sysemu/sysemu.h"
+
+void qemu_add_machine_init_done_notifier(Notifier *notify)
+{
+}
diff --git a/stubs/qemu-chr-open-msmouse.c b/stubs/qemu-chr-open-msmouse.c
new file mode 100644
index 0000000..459f10b
--- /dev/null
+++ b/stubs/qemu-chr-open-msmouse.c
@@ -0,0 +1,7 @@
+#include "sysemu/char.h"
+#include "ui/console.h"
+
+CharDriverState *qemu_chr_open_msmouse(void)
+{
+ return NULL;
+}
diff --git a/stubs/runstate-is-running.c b/stubs/runstate-is-running.c
new file mode 100644
index 0000000..f7e6fc2
--- /dev/null
+++ b/stubs/runstate-is-running.c
@@ -0,0 +1,6 @@
+#include "sysemu/sysemu.h"
+
+int runstate_is_running(void)
+{
+ return 1;
+}
diff --git a/stubs/serial-hds.c b/stubs/serial-hds.c
new file mode 100644
index 0000000..81d539c
--- /dev/null
+++ b/stubs/serial-hds.c
@@ -0,0 +1,3 @@
+#include "sysemu/sysemu.h"
+
+CharDriverState *serial_hds[MAX_SERIAL_PORTS];
diff --git a/stubs/vmstate-info-buffer.c b/stubs/vmstate-info-buffer.c
new file mode 100644
index 0000000..29fcaa0
--- /dev/null
+++ b/stubs/vmstate-info-buffer.c
@@ -0,0 +1,8 @@
+#include <qemu-common.h>
+#include "migration/vmstate.h"
+
+const VMStateInfo vmstate_info_buffer = {
+ .name = "buffer",
+ .get = NULL,
+ .put = NULL,
+};
diff --git a/stubs/vmstate-info-uint32.c b/stubs/vmstate-info-uint32.c
new file mode 100644
index 0000000..1d11233
--- /dev/null
+++ b/stubs/vmstate-info-uint32.c
@@ -0,0 +1,8 @@
+#include <qemu-common.h>
+#include "migration/vmstate.h"
+
+const VMStateInfo vmstate_info_uint32 = {
+ .name = "uint32",
+ .get = NULL,
+ .put = NULL,
+};
diff --git a/util/Makefile.objs b/util/Makefile.objs
index 6b3c83b..20d65c0 100644
--- a/util/Makefile.objs
+++ b/util/Makefile.objs
@@ -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)
--
2.0.1
- Re: [Qemu-devel] [PATCH v1 03/24] monitor: Extract monitor-system.h header, (continued)
- [Qemu-devel] [PATCH v1 04/24] monitor: Make monitor_fprintf public before extracting it, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 09/24] monitor: Make do_info_help public, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 01/24] qmp: Extract system emulation related code from qmp.c into qmp-system.c, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 06/24] monitor: Extract qmp_human_monitor_command into monitor-system.c, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 13/24] monitor: Move do_loadvm from monitor.c to monitor-system.c, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 08/24] monitor: Extract a couple of function to monitor-system.c, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 05/24] monitor: Extract monitor_fprintf to monitor-system.c, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 22/24] qemu-nbd: build QAPI block core into qemu-nbd,
Benoît Canet <=
- [Qemu-devel] [PATCH v1 16/24] monitor: Move more functions from monitor.c to monitor-system.c, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 07/24] monitor: Make some function to extract public, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 12/24] monitor: Make do_loadvm public before moving it to monitor-system.c, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 23/24] qapi: Add a script to filter qmp-commands-old.h to generate a subset of it., Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 24/24] qemu-nbd: Add --qmp option to qemu-nbd., Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 10/24] monitor: Extract do_info_help in monitor-system.c, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 17/24] monitor: Move two net functions from monitor.c to monitor-system.c, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 18/24] monitor: Move qmp_rtc_reset_reinjection from monitor.c to monitor-system.c, Benoît Canet, 2014/08/01
- [Qemu-devel] [PATCH v1 19/24] monitor-system: Switch back functions to static, Benoît Canet, 2014/08/01