[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 36/49] qapi: add conditions to SPICE type/command
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v3 36/49] qapi: add conditions to SPICE type/commands/events on the schema |
Date: |
Wed, 21 Mar 2018 12:51:58 +0100 |
Add #if defined(CONFIG_SPICE) in generated code, and adjust the
qmp/hmp code accordingly.
query-qmp-schema no longer reports the command/events etc as
available when disabled at compile time.
Commands made conditional:
* query-spice
Before the patch, the command for !CONFIG_SPICE is unregistered. It
will fail with the same error.
Events made conditional:
* SPICE_CONNECTED, SPICE_INITIALIZED, SPICE_DISCONNECTED,
SPICE_MIGRATE_COMPLETED
Chardev made conditional:
* spiceport, spicevmc
Before and after the patch for !CONFIG_SPICE, the error is the
same ('spiceport' is not a valid char driver name).
No HMP change, the code was already conditional.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Gerd Hoffmann <address@hidden>
---
qapi/char.json | 10 ++++++----
qapi/ui.json | 30 ++++++++++++++++++++----------
monitor.c | 3 ---
qmp.c | 16 ----------------
4 files changed, 26 insertions(+), 33 deletions(-)
diff --git a/qapi/char.json b/qapi/char.json
index ae19dcd1ed..7fa1762ae5 100644
--- a/qapi/char.json
+++ b/qapi/char.json
@@ -318,7 +318,8 @@
# Since: 1.5
##
{ 'struct': 'ChardevSpiceChannel', 'data': { 'type' : 'str' },
- 'base': 'ChardevCommon' }
+ 'base': 'ChardevCommon',
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @ChardevSpicePort:
@@ -330,7 +331,8 @@
# Since: 1.5
##
{ 'struct': 'ChardevSpicePort', 'data': { 'fqdn' : 'str' },
- 'base': 'ChardevCommon' }
+ 'base': 'ChardevCommon',
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @ChardevVC:
@@ -384,8 +386,8 @@
'testdev': 'ChardevCommon',
'stdio' : 'ChardevStdio',
'console': 'ChardevCommon',
- 'spicevmc' : 'ChardevSpiceChannel',
- 'spiceport' : 'ChardevSpicePort',
+ 'spicevmc' : { 'type':
'ChardevSpiceChannel', 'if': 'defined(CONFIG_SPICE)' },
+ 'spiceport' : { 'type':
'ChardevSpicePort', 'if': 'defined(CONFIG_SPICE)' },
'vc' : 'ChardevVC',
'ringbuf': 'ChardevRingbuf',
# next one is just for compatibility
diff --git a/qapi/ui.json b/qapi/ui.json
index 4b96509446..e47fae2e90 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -118,7 +118,8 @@
{ 'struct': 'SpiceBasicInfo',
'data': { 'host': 'str',
'port': 'str',
- 'family': 'NetworkAddressFamily' } }
+ 'family': 'NetworkAddressFamily' },
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @SpiceServerInfo:
@@ -131,7 +132,8 @@
##
{ 'struct': 'SpiceServerInfo',
'base': 'SpiceBasicInfo',
- 'data': { '*auth': 'str' } }
+ 'data': { '*auth': 'str' },
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @SpiceChannel:
@@ -156,7 +158,8 @@
{ 'struct': 'SpiceChannel',
'base': 'SpiceBasicInfo',
'data': {'connection-id': 'int', 'channel-type': 'int', 'channel-id': 'int',
- 'tls': 'bool'} }
+ 'tls': 'bool'},
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @SpiceQueryMouseMode:
@@ -175,7 +178,8 @@
# Since: 1.1
##
{ 'enum': 'SpiceQueryMouseMode',
- 'data': [ 'client', 'server', 'unknown' ] }
+ 'data': [ 'client', 'server', 'unknown' ],
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @SpiceInfo:
@@ -212,7 +216,8 @@
{ 'struct': 'SpiceInfo',
'data': {'enabled': 'bool', 'migrated': 'bool', '*host': 'str', '*port':
'int',
'*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str',
- 'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']}
}
+ 'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']},
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @query-spice:
@@ -257,7 +262,8 @@
# }
#
##
-{ 'command': 'query-spice', 'returns': 'SpiceInfo' }
+{ 'command': 'query-spice', 'returns': 'SpiceInfo',
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @SPICE_CONNECTED:
@@ -282,7 +288,8 @@
##
{ 'event': 'SPICE_CONNECTED',
'data': { 'server': 'SpiceBasicInfo',
- 'client': 'SpiceBasicInfo' } }
+ 'client': 'SpiceBasicInfo' },
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @SPICE_INITIALIZED:
@@ -310,7 +317,8 @@
##
{ 'event': 'SPICE_INITIALIZED',
'data': { 'server': 'SpiceServerInfo',
- 'client': 'SpiceChannel' } }
+ 'client': 'SpiceChannel' },
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @SPICE_DISCONNECTED:
@@ -335,7 +343,8 @@
##
{ 'event': 'SPICE_DISCONNECTED',
'data': { 'server': 'SpiceBasicInfo',
- 'client': 'SpiceBasicInfo' } }
+ 'client': 'SpiceBasicInfo' },
+ 'if': 'defined(CONFIG_SPICE)' }
##
# @SPICE_MIGRATE_COMPLETED:
@@ -350,7 +359,8 @@
# "event": "SPICE_MIGRATE_COMPLETED" }
#
##
-{ 'event': 'SPICE_MIGRATE_COMPLETED' }
+{ 'event': 'SPICE_MIGRATE_COMPLETED',
+ 'if': 'defined(CONFIG_SPICE)' }
##
# == VNC
diff --git a/monitor.c b/monitor.c
index 6ccd2fc089..8a5539579b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1087,9 +1087,6 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject
**ret_data,
*/
static void qmp_unregister_commands_hack(void)
{
-#ifndef CONFIG_SPICE
- qmp_unregister_command(&qmp_commands, "query-spice");
-#endif
#ifndef CONFIG_REPLICATION
qmp_unregister_command(&qmp_commands, "xen-set-replication");
qmp_unregister_command(&qmp_commands, "query-xen-replication-status");
diff --git a/qmp.c b/qmp.c
index ee1a816a42..d8f80cb04e 100644
--- a/qmp.c
+++ b/qmp.c
@@ -129,22 +129,6 @@ void qmp_cpu_add(int64_t id, Error **errp)
}
}
-#ifndef CONFIG_SPICE
-/*
- * qmp_unregister_commands_hack() 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)
{
BlockBackend *blk;
--
2.16.2.521.g9aa15f885a
- [Qemu-devel] [PATCH v3 26/49] qapi: add an error in case a discriminator is conditionnal, (continued)
- [Qemu-devel] [PATCH v3 26/49] qapi: add an error in case a discriminator is conditionnal, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 27/49] qapi: add 'if' on union members, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 28/49] qapi: add 'if' to alternate members, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 29/49] qapi: add #if conditions to generated code members, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 32/49] qapi2texi: add 'If:' condition to enum values, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 30/49] docs: document schema configuration, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 31/49] qapi2texi: add 'If:' section to generated documentation, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 33/49] qapi2texi: add 'If:' condition to struct members, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 35/49] qapi: add conditions to VNC type/commands/events on the schema, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 34/49] qapi2texi: add condition to variants, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 36/49] qapi: add conditions to SPICE type/commands/events on the schema,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v3 37/49] qapi: add conditions to REPLICATION type/commands on the schema, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 38/49] build-sys: move qmp-introspect per target, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 39/49] qapi-commands: don't initialize command list in qmp_init_marshall(), Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 40/49] RFC: qapi: learn to split schema by 'top-unit', Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 41/49] qapi: add a top-unit 'target' schema, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 44/49] target.json: add a note about query-cpu* not being s390x-specific, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 42/49] qapi: make rtc-reset-reinjection and SEV depend on TARGET_I386, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 43/49] qapi: make s390 commands depend on TARGET_S390X, Marc-André Lureau, 2018/03/21