[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 05/20] qapi: configure the schema
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v5 05/20] qapi: configure the schema |
Date: |
Wed, 17 Aug 2016 20:57:42 +0400 |
Make parts of the qapi schema conditional based on host and target
config. Remove the no longer needed fallback commands implementations.
Signed-off-by: Marc-André Lureau <address@hidden>
---
hmp.c | 2 ++
monitor.c | 22 ----------------------
qmp.c | 32 --------------------------------
hmp-commands-info.hx | 2 ++
qapi-schema.json | 30 ++++++++++++++++++++++++++++++
qapi/event.json | 8 ++++++++
qmp-commands.hx | 7 ++++---
7 files changed, 46 insertions(+), 57 deletions(-)
diff --git a/hmp.c b/hmp.c
index cc2056e..339f5c6 100644
--- a/hmp.c
+++ b/hmp.c
@@ -570,6 +570,7 @@ void hmp_info_blockstats(Monitor *mon, const QDict *qdict)
qapi_free_BlockStatsList(stats_list);
}
+#ifdef CONFIG_VNC
void hmp_info_vnc(Monitor *mon, const QDict *qdict)
{
VncInfo *info;
@@ -615,6 +616,7 @@ void hmp_info_vnc(Monitor *mon, const QDict *qdict)
out:
qapi_free_VncInfo(info);
}
+#endif
#ifdef CONFIG_SPICE
void hmp_info_spice(Monitor *mon, const QDict *qdict)
diff --git a/monitor.c b/monitor.c
index 5c00373..289fa5e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4306,28 +4306,6 @@ QemuOptsList qemu_mon_opts = {
},
};
-#ifndef TARGET_I386
-void qmp_rtc_reset_reinjection(Error **errp)
-{
- error_setg(errp, QERR_FEATURE_DISABLED, "rtc-reset-reinjection");
-}
-#endif
-
-#ifndef TARGET_S390X
-void qmp_dump_skeys(const char *filename, Error **errp)
-{
- error_setg(errp, QERR_FEATURE_DISABLED, "dump-skeys");
-}
-#endif
-
-#ifndef TARGET_ARM
-GICCapabilityList *qmp_query_gic_capabilities(Error **errp)
-{
- error_setg(errp, QERR_FEATURE_DISABLED, "query-gic-capabilities");
- return NULL;
-}
-#endif
-
HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp)
{
MachineState *ms = MACHINE(qdev_get_machine());
diff --git a/qmp.c b/qmp.c
index b6d531e..01671ad 100644
--- a/qmp.c
+++ b/qmp.c
@@ -145,38 +145,6 @@ void qmp_cpu_add(int64_t id, Error **errp)
}
}
-#ifndef CONFIG_VNC
-/* If VNC support is enabled, the "true" query-vnc command is
- defined in the VNC subsystem */
-VncInfo *qmp_query_vnc(Error **errp)
-{
- error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
- return NULL;
-};
-
-VncInfo2List *qmp_query_vnc_servers(Error **errp)
-{
- error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
- return NULL;
-};
-#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;
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 74446c6..be6e13a 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -430,6 +430,7 @@ STEXI
Show which guest mouse is receiving events.
ETEXI
+#if defined(CONFIG_VNC)
{
.name = "vnc",
.args_type = "",
@@ -437,6 +438,7 @@ ETEXI
.help = "show the vnc server status",
.mhandler.cmd = hmp_info_vnc,
},
+#endif
STEXI
@item info vnc
diff --git a/qapi-schema.json b/qapi-schema.json
index 5658723..caad127 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -973,6 +973,8 @@
{ 'enum': 'NetworkAddressFamily',
'data': [ 'ipv4', 'ipv6', 'unix', 'unknown' ] }
+#ifdef CONFIG_VNC
+
##
# @VncBasicInfo
#
@@ -1146,6 +1148,10 @@
##
{ 'command': 'query-vnc-servers', 'returns': ['VncInfo2'] }
+#endif CONFIG_VNC
+
+#ifdef CONFIG_SPICE
+
##
# @SpiceBasicInfo
#
@@ -1271,6 +1277,8 @@
##
{ 'command': 'query-spice', 'returns': 'SpiceInfo' }
+#endif CONFIG_SPICE
+
##
# @BalloonInfo:
#
@@ -2000,6 +2008,8 @@
##
{ 'command': 'expire_password', 'data': {'protocol': 'str', 'time': 'str'} }
+#ifdef CONFIG_VNC
+
##
# @change-vnc-password:
#
@@ -2014,6 +2024,8 @@
##
{ 'command': 'change-vnc-password', 'data': {'password': 'str'} }
+#endif
+
##
# @change:
#
@@ -2343,6 +2355,8 @@
{ 'command': 'query-dump-guest-memory-capability',
'returns': 'DumpGuestMemoryCapability' }
+#ifdef TARGET_S390X
+
##
# @dump-skeys
#
@@ -2357,6 +2371,8 @@
{ 'command': 'dump-skeys',
'data': { 'filename': 'str' } }
+#endif TARGET_S390X
+
##
# @netdev_add:
#
@@ -3371,6 +3387,8 @@
'base': 'ChardevCommon' }
+#ifdef CONFIG_SPICE
+
##
# @ChardevSpiceChannel:
#
@@ -3395,6 +3413,8 @@
{ 'struct': 'ChardevSpicePort', 'data': { 'fqdn' : 'str' },
'base': 'ChardevCommon' }
+#endif CONFIG_SPICE
+
##
# @ChardevVC:
#
@@ -3446,8 +3466,10 @@
'testdev': 'ChardevCommon',
'stdio' : 'ChardevStdio',
'console': 'ChardevCommon',
+#ifdef CONFIG_SPICE
'spicevmc' : 'ChardevSpiceChannel',
'spiceport' : 'ChardevSpicePort',
+#endif
'vc' : 'ChardevVC',
'ringbuf': 'ChardevRingbuf',
# next one is just for compatibility
@@ -4200,6 +4222,8 @@
{ 'enum': 'GuestPanicAction',
'data': [ 'pause' ] }
+#ifdef TARGET_I386
+
##
# @rtc-reset-reinjection
#
@@ -4212,6 +4236,8 @@
##
{ 'command': 'rtc-reset-reinjection' }
+#endif TARGET_I386
+
# Rocker ethernet network switch
{ 'include': 'qapi/rocker.json' }
@@ -4271,6 +4297,8 @@
'emulated': 'bool',
'kernel': 'bool' } }
+#ifdef TARGET_ARM
+
##
# @query-gic-capabilities:
#
@@ -4283,6 +4311,8 @@
##
{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'] }
+#endif TARGET_ARM
+
##
# CpuInstanceProperties
#
diff --git a/qapi/event.json b/qapi/event.json
index 8642052..712045f 100644
--- a/qapi/event.json
+++ b/qapi/event.json
@@ -138,6 +138,8 @@
{ 'event': 'NIC_RX_FILTER_CHANGED',
'data': { '*name': 'str', 'path': 'str' } }
+#ifdef CONFIG_VNC
+
##
# @VNC_CONNECTED
#
@@ -187,6 +189,10 @@
'data': { 'server': 'VncServerInfo',
'client': 'VncClientInfo' } }
+#endif CONFIG_VNC
+
+#ifdef CONFIG_SPICE
+
##
# @SPICE_CONNECTED
#
@@ -242,6 +248,8 @@
##
{ 'event': 'SPICE_MIGRATE_COMPLETED' }
+#endif
+
##
# @MIGRATION
#
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 6866264..0eb0d9c 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3347,7 +3347,7 @@ Example:
}
EQMP
-
+#if defined(CONFIG_VNC)
{
.name = "query-vnc",
.args_type = "",
@@ -3358,7 +3358,7 @@ EQMP
.args_type = "",
.mhandler.cmd_new = qmp_marshal_query_vnc_servers,
},
-
+#endif
SQMP
query-spice
-----------
@@ -3911,12 +3911,13 @@ EQMP
.args_type = "",
.mhandler.cmd_new = qmp_marshal_nbd_server_stop,
},
-
+#if defined(CONFIG_VNC)
{
.name = "change-vnc-password",
.args_type = "password:s",
.mhandler.cmd_new = qmp_marshal_change_vnc_password,
},
+#endif
{
.name = "qom-list-types",
.args_type = "implements:s?,abstract:b?",
--
2.9.0
- [Qemu-devel] [PATCH v5 00/20] qapi: remove the 'middle' mode, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 02/20] qapi.py: add a simple #ifdef conditional, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 01/20] tests: do qmp introspect validation per target, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 03/20] build-sys: make qemu qapi per-target, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 05/20] qapi: configure the schema,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v5 04/20] build-sys: use config headers to generate qapi, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 06/20] build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO}, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 08/20] qapi-schema: add 'device_add', Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 07/20] qapi-schema: use generated marshaller for 'qmp_capabilities', Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 09/20] monitor: simplify invalid_qmp_mode(), Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 11/20] qapi: export the marshallers, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 10/20] monitor: register gen:false commands manually, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 13/20] monitor: implement 'qmp_query_commands' without qmp_cmds, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 12/20] monitor: use qmp_find_command() (using generated qapi code), Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 15/20] qapi: remove the "middle" mode, Marc-André Lureau, 2016/08/17