qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Let's remove some deprecated stuff


From: Kevin Wolf
Subject: Re: Let's remove some deprecated stuff
Date: Thu, 29 Apr 2021 15:12:17 +0200

Am 29.04.2021 um 14:40 hat Gerd Hoffmann geschrieben:
>   Hi,
> 
> > For this to go away, I'd rather have something like the -nic option that
> > provides an easy way to set up the front end and back end.
> > 
> > In other words you would do something like -audiohw
> > <audiodev-args>,model=xxx and it gets desugared automatically to either
> > 
> >    -audiodev <audiodev-args>,id=foo -device devname,audiodev=xxx
> > 
> > or
> > 
> >    -audiodev <audiodev-args>,id=foo -M propname=foo
> 
> Suggestions how to do that in a clean way?
> Given that -audiodev is qapi-based I tried it this way:
> 
> --- a/qapi/audio.json
> +++ b/qapi/audio.json
> @@ -419,3 +419,22 @@
>      'sdl':       'AudiodevSdlOptions',
>      'spice':     'AudiodevGenericOptions',
>      'wav':       'AudiodevWavOptions' } }
> +
> +##
> +# @AudioDevice:
> +#
> +# TODO
> +##
> +{ 'enum': 'AudioDevice',
> +  'data': [ 'pcspk', 'ac97', 'hda' ] }
> +
> +##
> +# @AudioConfig:
> +#
> +# TODO
> +##
> +{ 'struct': 'AudioConfig',
> +  'base': 'Audiodev',
> +  'data': {
> +    'model': 'AudioDevice'
> +}}
> 
> But qemu doesn't like the schema:
> qapi/audio.json: In struct 'AudioConfig':
> qapi/audio.json:436: 'base' requires a struct type, union type 'Audiodev' 
> isn't
> 
> We could easily support the case that no additional options are
> specified, like this:
> 
> +{ 'struct': 'AudioConfig',
> +  'data': {
> +    'driver': 'AudiodevDriver',
> +    'model': 'AudioDevice'
> +}}
> 
> But then you have to switch to the long form as soon as you want
> specify any audiodev config option.  Maybe that is ok, dunno how
> much configuration options -nic supports.

Good support for this in QAPI sounds hard because you will want to use
the same Audiodev C type for both options. I think the naive
implementation for using unions as a base would end up creating new
C types.

Another option might be that you just nest things:

{ 'struct': 'AudioConfig',
  'data': {
      'model': 'AudioDevice',
      'backend': 'Audiodev' } }

Possibly instead of 'model' on the top level, you'll actually want to
nest there, too, and accept device properties.

If or when I finally get QAPI aliases merged, we can make this look nice
on the command line again by simply mapping everything to the top level
so that you don't necessarily need to use dotted keys like you would
initially, e.g. -audio backend.driver=sdl,model=hda could be optionally
reduced to -audio driver=sdl,model=hda.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]