diff mbox

[v4,13/17] qmp: update qmp_query_spice fallback

Message ID 20160810180235.32469-14-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Aug. 10, 2016, 6:02 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

The following "use qmp_dispatch()" commit will use the generated
dispatch command table that is unaware of compile time conditionals.

There are a few commands that are under #ifdef conditions in
qmp-commands.hx. Move the qmp_query_spice fallback in the same location
as the other fallbacks, return an error instead of abort() and update
the comment.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 monitor.c | 14 ++++++++++++++
 qmp.c     | 16 ----------------
 2 files changed, 14 insertions(+), 16 deletions(-)
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index ade11a5..880a4eb 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4350,6 +4350,20 @@  QemuOptsList qemu_mon_opts = {
     },
 };
 
+/*
+ * the QAPI schema is blissfully unaware #ifdef FOO commands, and the
+ * QAPI code generator happily generates a qmp_marshal_foo_cmd() that
+ * calls qmp_foo_cmd(). Provide it one, or else linking fails.
+ * FIXME: Educate the QAPI schema on #ifdef commands.
+ */
+#ifndef CONFIG_SPICE
+SpiceInfo *qmp_query_spice(Error **errp)
+{
+    error_setg(errp, QERR_FEATURE_DISABLED, "spice");
+    return NULL;
+};
+#endif
+
 #ifndef TARGET_I386
 void qmp_rtc_reset_reinjection(Error **errp)
 {
diff --git a/qmp.c b/qmp.c
index ebc3ff6..42eeedf 100644
--- a/qmp.c
+++ b/qmp.c
@@ -151,22 +151,6 @@  VncInfo2List *qmp_query_vnc_servers(Error **errp)
 };
 #endif
 
-#ifndef CONFIG_SPICE
-/*
- * qmp-commands.hx ensures that QMP command query-spice exists only
- * #ifdef CONFIG_SPICE.  Necessary for an accurate query-commands
- * result.  However, the QAPI schema is blissfully unaware of that,
- * and the QAPI code generator happily generates a dead
- * qmp_marshal_query_spice() that calls qmp_query_spice().  Provide it
- * one, or else linking fails.  FIXME Educate the QAPI schema on
- * CONFIG_SPICE.
- */
-SpiceInfo *qmp_query_spice(Error **errp)
-{
-    abort();
-};
-#endif
-
 void qmp_cont(Error **errp)
 {
     Error *local_err = NULL;