new file mode 100644
@@ -0,0 +1,74 @@
+#include "qemu/osdep.h"
+#include "qapi-event.h"
+
+void qapi_event_send_device_tray_moved(const char *device, const char *id,
+ bool tray_open, Error **errp)
+{
+}
+
+void qapi_event_send_quorum_report_bad(QuorumOpType type, bool has_error,
+ const char *error, const char *node_name,
+ int64_t sector_num,
+ int64_t sectors_count, Error **errp)
+{
+}
+
+void qapi_event_send_quorum_failure(const char *reference, int64_t sector_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 **errp)
+{
+}
+
+void qapi_event_send_block_job_ready(BlockJobType type, const char *device,
+ int64_t len, int64_t offset, int64_t speed,
+ Error **errp)
+{
+}
+
+void qapi_event_send_block_io_error(const char *device, const char *node_name,
+ IoOperationType operation,
+ BlockErrorAction action, bool has_nospace,
+ 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_offset,
+ 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)
+{
+}
@@ -1267,7 +1267,6 @@ static void test_visitor_in_qmp_introspect(TestInputVisitorData *data,
const void *unused)
{
do_test_visitor_in_qmp_introspect(data, &test_qmp_schema_qlit);
- do_test_visitor_in_qmp_introspect(data, &qmp_schema_qlit);
}
int main(int argc, char **argv)
@@ -2,7 +2,7 @@
# Common libraries for tools and emulators
stub-obj-y = stubs/ crypto/
util-obj-y = util/ qobject/ qapi/
-util-obj-y += qmp-introspect.o qapi-types.o qapi-visit.o qapi-event.o
+util-obj-y += qapi-types.o qapi-visit.o
chardev-obj-y = chardev/
@@ -72,13 +72,6 @@ common-obj-y += chardev/
common-obj-$(CONFIG_SECCOMP) += qemu-seccomp.o
common-obj-$(CONFIG_FDT) += device_tree.o
-
-######################################################################
-# qapi
-
-common-obj-y += qmp-marshal.o
-common-obj-y += qmp-introspect.o
-common-obj-y += qmp.o hmp.o
endif
#######################################################################
@@ -157,6 +157,10 @@ endif
GENERATED_FILES += hmp-commands.h hmp-commands-info.h
+obj-y += qmp-introspect.o qapi-types.o qapi-visit.o qapi-event.o
+obj-y += qmp-marshal.o qmp-introspect.o
+obj-y += qmp.o hmp.o
+
endif # CONFIG_SOFTMMU
# Workaround for http://gcc.gnu.org/PR55489, see configure.
@@ -22,6 +22,7 @@ stub-obj-y += migr-blocker.o
stub-obj-y += change-state-handler.o
stub-obj-y += monitor.o
stub-obj-y += notify-event.o
+stub-obj-y += qapi-event.o
stub-obj-y += qtest.o
stub-obj-y += replay.o
stub-obj-y += runstate-check.o
@@ -56,4 +56,4 @@ util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
util-obj-$(CONFIG_TRACE_FTRACE) += ftrace.o
util-obj-y += control.o
target-obj-y += control-target.o
-util-obj-y += qmp.o
+target-obj-y += qmp.o
QAPI can't do target-specific conditionals (the symbols are poisoned), and the work-around is to pretend the target-specific stuff is target-independent, with stubs for the other targets. Makes the target-specifity invisible in introspection. To unpoison the symbols, we need to move the generated QAPI code to the per-target build. Keep qapi-types.o qapi-visit.o in util-obj as they are necessary for common code, but they will be overwritten during the target link. Add some stubs for block events, in code shared by tools & qemu. The following patches will configure the schema to conditionally remove per-target disabled features. Drop "do_test_visitor_in_qmp_introspect(&&qmp_schema_qlit)" since it is no longer in a common object, and covered by "query-qmp-schema test" instead. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- stubs/qapi-event.c | 74 ++++++++++++++++++++++++++++++++++++++ tests/test-qobject-input-visitor.c | 1 - Makefile.objs | 9 +---- Makefile.target | 4 +++ stubs/Makefile.objs | 1 + trace/Makefile.objs | 2 +- 6 files changed, 81 insertions(+), 10 deletions(-) create mode 100644 stubs/qapi-event.c