[Qemu-devel] [PATCH v6 26/27] qapi: add more conditions to SPICE

Marc-André Lureau posted 27 patches 7 years, 4 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v6 26/27] qapi: add more conditions to SPICE
Posted by Marc-André Lureau 7 years, 4 months ago
Now that member can be made conditional, let's make SPICE chardev
conditional:

* spiceport, spicevmc

  Before and after the patch for !CONFIG_SPICE, the error is the
  same ('spiceport' is not a valid char driver name).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qapi/char.json | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/qapi/char.json b/qapi/char.json
index b7b2a05766..54e3b970f6 100644
--- a/qapi/char.json
+++ b/qapi/char.json
@@ -319,8 +319,8 @@
 # Since: 1.5
 ##
 { 'struct': 'ChardevSpiceChannel', 'data': { 'type'  : 'str' },
-  'base': 'ChardevCommon' }
-# TODO: 'if': 'defined(CONFIG_SPICE)'
+  'base': 'ChardevCommon',
+  'if': 'defined(CONFIG_SPICE)' }
 
 ##
 # @ChardevSpicePort:
@@ -332,8 +332,8 @@
 # Since: 1.5
 ##
 { 'struct': 'ChardevSpicePort', 'data': { 'fqdn'  : 'str' },
-  'base': 'ChardevCommon' }
-# TODO: 'if': 'defined(CONFIG_SPICE)'
+  'base': 'ChardevCommon',
+  'if': 'defined(CONFIG_SPICE)' }
 
 ##
 # @ChardevVC:
@@ -387,10 +387,10 @@
                                        'testdev': 'ChardevCommon',
                                        'stdio'  : 'ChardevStdio',
                                        'console': 'ChardevCommon',
-                                       'spicevmc': 'ChardevSpiceChannel',
-# TODO: { 'type': 'ChardevSpiceChannel', 'if': 'defined(CONFIG_SPICE)' },
-                                       'spiceport': 'ChardevSpicePort',
-# TODO: { 'type': 'ChardevSpicePort', 'if': 'defined(CONFIG_SPICE)' },
+                                       'spicevmc': { 'type': 'ChardevSpiceChannel',
+                                                     'if': 'defined(CONFIG_SPICE)' },
+                                       'spiceport': { 'type': 'ChardevSpicePort',
+                                                      'if': 'defined(CONFIG_SPICE)' },
                                        'vc'     : 'ChardevVC',
                                        'ringbuf': 'ChardevRingbuf',
                                        # next one is just for compatibility
-- 
2.18.0.rc1


Re: [Qemu-devel] [PATCH v6 26/27] qapi: add more conditions to SPICE
Posted by Markus Armbruster 6 years, 11 months ago
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Now that member can be made conditional, let's make SPICE chardev
> conditional:
>
> * spiceport, spicevmc
>
>   Before and after the patch for !CONFIG_SPICE, the error is the
>   same ('spiceport' is not a valid char driver name).
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  qapi/char.json | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/qapi/char.json b/qapi/char.json
> index b7b2a05766..54e3b970f6 100644
> --- a/qapi/char.json
> +++ b/qapi/char.json
> @@ -319,8 +319,8 @@
>  # Since: 1.5
>  ##
>  { 'struct': 'ChardevSpiceChannel', 'data': { 'type'  : 'str' },
> -  'base': 'ChardevCommon' }
> -# TODO: 'if': 'defined(CONFIG_SPICE)'
> +  'base': 'ChardevCommon',
> +  'if': 'defined(CONFIG_SPICE)' }
>  
>  ##
>  # @ChardevSpicePort:
> @@ -332,8 +332,8 @@
>  # Since: 1.5
>  ##
>  { 'struct': 'ChardevSpicePort', 'data': { 'fqdn'  : 'str' },
> -  'base': 'ChardevCommon' }
> -# TODO: 'if': 'defined(CONFIG_SPICE)'
> +  'base': 'ChardevCommon',
> +  'if': 'defined(CONFIG_SPICE)' }
>  
>  ##
>  # @ChardevVC:
> @@ -387,10 +387,10 @@
>                                         'testdev': 'ChardevCommon',
>                                         'stdio'  : 'ChardevStdio',
>                                         'console': 'ChardevCommon',
> -                                       'spicevmc': 'ChardevSpiceChannel',
> -# TODO: { 'type': 'ChardevSpiceChannel', 'if': 'defined(CONFIG_SPICE)' },
> -                                       'spiceport': 'ChardevSpicePort',
> -# TODO: { 'type': 'ChardevSpicePort', 'if': 'defined(CONFIG_SPICE)' },
> +                                       'spicevmc': { 'type': 'ChardevSpiceChannel',
> +                                                     'if': 'defined(CONFIG_SPICE)' },
> +                                       'spiceport': { 'type': 'ChardevSpicePort',
> +                                                      'if': 'defined(CONFIG_SPICE)' },
>                                         'vc'     : 'ChardevVC',
>                                         'ringbuf': 'ChardevRingbuf',
>                                         # next one is just for compatibility

Long lines due to foolish indentation.

Let me grep for the pattern:

    $ grep ", 'data.*,$" qapi/*json
    qapi/block-core.json:  'data': {'start': 'int', 'length': 'int', 'data': 'bool',
    qapi/block-core.json:{ 'command': 'block_passwd', 'data': {'*device': 'str',
    qapi/block-core.json:{ 'command': 'block_resize', 'data': { '*device': 'str',
    qapi/block-core.json:{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],
    qapi/char.json:{ 'struct': 'ChardevInfo', 'data': {'label': 'str',
    qapi/char.json:  'data': {'device': 'str', 'data': 'str',
    qapi/char.json:{ 'struct': 'ChardevCommon', 'data': { '*logfile': 'str',
    qapi/char.json:{ 'struct': 'ChardevFile', 'data': { '*in' : 'str',
    qapi/char.json:{ 'struct': 'ChardevHostdev', 'data': { 'device' : 'str' },
    qapi/char.json:{ 'struct': 'ChardevSocket', 'data': { 'addr'       : 'SocketAddressLegacy',
    qapi/char.json:{ 'struct': 'ChardevUdp', 'data': { 'remote' : 'SocketAddressLegacy',
    qapi/char.json:{ 'struct': 'ChardevMux', 'data': { 'chardev' : 'str' },
    qapi/char.json:{ 'struct': 'ChardevStdio', 'data': { '*signal' : 'bool' },
    qapi/char.json:{ 'struct': 'ChardevSpiceChannel', 'data': { 'type'  : 'str' },
    qapi/char.json:{ 'struct': 'ChardevSpicePort', 'data': { 'fqdn'  : 'str' },
    qapi/char.json:{ 'struct': 'ChardevVC', 'data': { '*width'  : 'int',
    qapi/char.json:{ 'struct': 'ChardevRingbuf', 'data': { '*size'  : 'int' },
    qapi/char.json:{ 'union': 'ChardevBackend', 'data': { 'file'   : 'ChardevFile',
    qapi/char.json:{ 'command': 'chardev-add', 'data': {'id'      : 'str',
    qapi/char.json:{ 'command': 'chardev-change', 'data': {'id'      : 'str',
    qapi/migration.json:{ 'command': 'migrate-recover', 'data': { 'uri': 'str' },
    qapi/misc.json:{ 'command': 'add-fd', 'data': {'*fdset-id': 'int', '*opaque': 'str'},
    qapi/misc.json:{'command': 'query-command-line-options', 'data': { '*option': 'str' },
    qapi/net.json:{ 'command': 'query-rx-filter', 'data': { '*name': 'str' },
    qapi/tpm.json:{ 'struct': 'TPMPassthroughOptions', 'data': { '*path' : 'str',
    qapi/ui.json:{ 'command': 'change-vnc-password', 'data': {'password': 'str'},
The first hit is a false positive.  For the rest, let's break the line
before 'data'.