[{"id":1821523,"web_url":"http://patchwork.ozlabs.org/comment/1821523/","msgid":"<87indaaf0j.fsf@dusky.pond.sub.org>","list_archive_url":null,"date":"2017-12-13T14:17:32","subject":"Re: [Qemu-devel] [PATCH v3 37/50] qapi: add conditions to SPICE\n\ttype/commands/events on the schema","submitter":{"id":2645,"url":"http://patchwork.ozlabs.org/api/people/2645/","name":"Markus Armbruster","email":"armbru@redhat.com"},"content":"Marc-André Lureau <marcandre.lureau@redhat.com> writes:\n\n> Add #if defined(CONFIG_SPICE) in generated code, and adjust the\n> qmp/hmp code accordingly.\n\nI'd like to see a description of how this affects QMP and HMP, like the\none in the previous patch.\n\nAre there any occurrences of SPICE in the schema that aren't made\nconditional by this patch?\n\n> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n> ---\n>  qapi/char.json | 10 ++++++----\n>  qapi/ui.json   | 30 ++++++++++++++++++++----------\n>  monitor.c      |  3 ---\n>  qmp.c          | 16 ----------------\n>  4 files changed, 26 insertions(+), 33 deletions(-)\n>\n> diff --git a/qapi/char.json b/qapi/char.json\n> index ae19dcd1ed..7fa1762ae5 100644\n> --- a/qapi/char.json\n> +++ b/qapi/char.json\n> @@ -318,7 +318,8 @@\n>  # Since: 1.5\n>  ##\n>  { 'struct': 'ChardevSpiceChannel', 'data': { 'type'  : 'str' },\n> -  'base': 'ChardevCommon' }\n> +  'base': 'ChardevCommon',\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @ChardevSpicePort:\n> @@ -330,7 +331,8 @@\n>  # Since: 1.5\n>  ##\n>  { 'struct': 'ChardevSpicePort', 'data': { 'fqdn'  : 'str' },\n> -  'base': 'ChardevCommon' }\n> +  'base': 'ChardevCommon',\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @ChardevVC:\n> @@ -384,8 +386,8 @@\n>                                         'testdev': 'ChardevCommon',\n>                                         'stdio'  : 'ChardevStdio',\n>                                         'console': 'ChardevCommon',\n> -                                       'spicevmc' : 'ChardevSpiceChannel',\n> -                                       'spiceport' : 'ChardevSpicePort',\n> +                                       'spicevmc' : { 'type': 'ChardevSpiceChannel', 'if': 'defined(CONFIG_SPICE)' },\n> +                                       'spiceport' : { 'type': 'ChardevSpicePort', 'if': 'defined(CONFIG_SPICE)' },\n>                                         'vc'     : 'ChardevVC',\n>                                         'ringbuf': 'ChardevRingbuf',\n>                                         # next one is just for compatibility\n> diff --git a/qapi/ui.json b/qapi/ui.json\n> index 4b573d214b..daa4168c14 100644\n> --- a/qapi/ui.json\n> +++ b/qapi/ui.json\n> @@ -110,7 +110,8 @@\n>  { 'struct': 'SpiceBasicInfo',\n>    'data': { 'host': 'str',\n>              'port': 'str',\n> -            'family': 'NetworkAddressFamily' } }\n> +            'family': 'NetworkAddressFamily' },\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @SpiceServerInfo:\n> @@ -123,7 +124,8 @@\n>  ##\n>  { 'struct': 'SpiceServerInfo',\n>    'base': 'SpiceBasicInfo',\n> -  'data': { '*auth': 'str' } }\n> +  'data': { '*auth': 'str' },\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @SpiceChannel:\n> @@ -148,7 +150,8 @@\n>  { 'struct': 'SpiceChannel',\n>    'base': 'SpiceBasicInfo',\n>    'data': {'connection-id': 'int', 'channel-type': 'int', 'channel-id': 'int',\n> -           'tls': 'bool'} }\n> +           'tls': 'bool'},\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @SpiceQueryMouseMode:\n> @@ -167,7 +170,8 @@\n>  # Since: 1.1\n>  ##\n>  { 'enum': 'SpiceQueryMouseMode',\n> -  'data': [ 'client', 'server', 'unknown' ] }\n> +  'data': [ 'client', 'server', 'unknown' ],\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @SpiceInfo:\n> @@ -204,7 +208,8 @@\n>  { 'struct': 'SpiceInfo',\n>    'data': {'enabled': 'bool', 'migrated': 'bool', '*host': 'str', '*port': 'int',\n>             '*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str',\n> -           'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']} }\n> +           'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']},\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @query-spice:\n> @@ -249,7 +254,8 @@\n>  #    }\n>  #\n>  ##\n> -{ 'command': 'query-spice', 'returns': 'SpiceInfo' }\n> +{ 'command': 'query-spice', 'returns': 'SpiceInfo',\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @SPICE_CONNECTED:\n> @@ -274,7 +280,8 @@\n>  ##\n>  { 'event': 'SPICE_CONNECTED',\n>    'data': { 'server': 'SpiceBasicInfo',\n> -            'client': 'SpiceBasicInfo' } }\n> +            'client': 'SpiceBasicInfo' },\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @SPICE_INITIALIZED:\n> @@ -302,7 +309,8 @@\n>  ##\n>  { 'event': 'SPICE_INITIALIZED',\n>    'data': { 'server': 'SpiceServerInfo',\n> -            'client': 'SpiceChannel' } }\n> +            'client': 'SpiceChannel' },\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @SPICE_DISCONNECTED:\n> @@ -327,7 +335,8 @@\n>  ##\n>  { 'event': 'SPICE_DISCONNECTED',\n>    'data': { 'server': 'SpiceBasicInfo',\n> -            'client': 'SpiceBasicInfo' } }\n> +            'client': 'SpiceBasicInfo' },\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # @SPICE_MIGRATE_COMPLETED:\n> @@ -342,7 +351,8 @@\n>  #      \"event\": \"SPICE_MIGRATE_COMPLETED\" }\n>  #\n>  ##\n> -{ 'event': 'SPICE_MIGRATE_COMPLETED' }\n> +{ 'event': 'SPICE_MIGRATE_COMPLETED',\n> +  'if': 'defined(CONFIG_SPICE)' }\n>  \n>  ##\n>  # == VNC\n> diff --git a/monitor.c b/monitor.c\n> index 5685697f59..135a1e0821 100644\n> --- a/monitor.c\n> +++ b/monitor.c\n> @@ -970,9 +970,6 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data,\n>   */\n>  static void qmp_unregister_commands_hack(void)\n>  {\n> -#ifndef CONFIG_SPICE\n> -    qmp_unregister_command(&qmp_commands, \"query-spice\");\n> -#endif\n>  #ifndef CONFIG_REPLICATION\n>      qmp_unregister_command(&qmp_commands, \"xen-set-replication\");\n>      qmp_unregister_command(&qmp_commands, \"query-xen-replication-status\");\n> diff --git a/qmp.c b/qmp.c\n> index 2c90dacb56..90816ba283 100644\n> --- a/qmp.c\n> +++ b/qmp.c\n> @@ -130,22 +130,6 @@ void qmp_cpu_add(int64_t id, Error **errp)\n>      }\n>  }\n>  \n> -#ifndef CONFIG_SPICE\n> -/*\n> - * qmp-commands.hx ensures that QMP command query-spice exists only\n> - * #ifdef CONFIG_SPICE.  Necessary for an accurate query-commands\n> - * result.  However, the QAPI schema is blissfully unaware of that,\n> - * and the QAPI code generator happily generates a dead\n> - * qmp_marshal_query_spice() that calls qmp_query_spice().  Provide it\n> - * one, or else linking fails.  FIXME Educate the QAPI schema on\n> - * CONFIG_SPICE.\n> - */\n> -SpiceInfo *qmp_query_spice(Error **errp)\n> -{\n> -    abort();\n> -};\n> -#endif\n> -\n>  void qmp_cont(Error **errp)\n>  {\n>      BlockBackend *blk;\n\nHmm, shouldn't you compile out \"info spice\", like you did for \"info vnc\"\nin the previous patch?","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yxf1T2RrCz9sBZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Dec 2017 01:18:20 +1100 (AEDT)","from localhost ([::1]:35754 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1eP7rU-0001hd-QU\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Dec 2017 09:18:16 -0500","from eggs.gnu.org ([2001:4830:134:3::10]:52732)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1eP7qz-0001hE-9Q\n\tfor qemu-devel@nongnu.org; Wed, 13 Dec 2017 09:17:50 -0500","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1eP7qw-0003zf-2m\n\tfor qemu-devel@nongnu.org; Wed, 13 Dec 2017 09:17:45 -0500","from mx1.redhat.com ([209.132.183.28]:51538)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <armbru@redhat.com>) id 1eP7qv-0003z6-Qq\n\tfor qemu-devel@nongnu.org; Wed, 13 Dec 2017 09:17:42 -0500","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 180FB356F7\n\tfor <qemu-devel@nongnu.org>; Wed, 13 Dec 2017 14:17:41 +0000 (UTC)","from blackfin.pond.sub.org (ovpn-116-74.ams2.redhat.com\n\t[10.36.116.74])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id C18337C65B;\n\tWed, 13 Dec 2017 14:17:33 +0000 (UTC)","by blackfin.pond.sub.org (Postfix, from userid 1000)\n\tid 345D11138658; Wed, 13 Dec 2017 15:17:32 +0100 (CET)"],"From":"Markus Armbruster <armbru@redhat.com>","To":"=?utf-8?q?Marc-Andr=C3=A9?= Lureau <marcandre.lureau@redhat.com>","References":"<20170911110623.24981-1-marcandre.lureau@redhat.com>\n\t<20170911110623.24981-38-marcandre.lureau@redhat.com>","Date":"Wed, 13 Dec 2017 15:17:32 +0100","In-Reply-To":"<20170911110623.24981-38-marcandre.lureau@redhat.com> (\n\t=?utf-8?b?Ik1hcmMtQW5kcsOp?= Lureau\"'s message of \"Mon,\n\t11 Sep 2017 \t13:06:10 +0200\")","Message-ID":"<87indaaf0j.fsf@dusky.pond.sub.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.30]);\n\tWed, 13 Dec 2017 14:17:41 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v3 37/50] qapi: add conditions to SPICE\n\ttype/commands/events on the schema","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Paolo Bonzini <pbonzini@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, \n\tqemu-devel@nongnu.org, \"Dr. David Alan Gilbert\" <dgilbert@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]