From: Kevin Wolf <kwolf@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Thomas Huth" <thuth@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
qemu-devel@nongnu.org,
"Alistair Francis" <alistair.francis@wdc.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
dirty.ice.hu@gmail.com, "Paolo Bonzini" <pbonzini@redhat.com>,
"Robert Hoo" <robert.hu@linux.intel.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: Let's remove some deprecated stuff
Date: Thu, 29 Apr 2021 15:12:17 +0200 [thread overview]
Message-ID: <YIqwsUAGEvfazbvZ@merkur.fritz.box> (raw)
In-Reply-To: <20210429124049.z7qtkufk2wgvvd5i@sirius.home.kraxel.org>
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
next prev parent reply other threads:[~2021-04-29 13:13 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 9:59 Let's remove some deprecated stuff Markus Armbruster
2021-04-29 10:18 ` Gerd Hoffmann
2021-04-29 10:24 ` Daniel P. Berrangé
2021-04-29 10:29 ` Peter Maydell
2021-04-29 10:35 ` Daniel P. Berrangé
2021-04-29 10:55 ` Gerd Hoffmann
2021-04-30 10:47 ` Markus Armbruster
2021-04-29 11:07 ` Paolo Bonzini
2021-04-29 10:25 ` Peter Maydell
2021-04-29 10:32 ` Daniel P. Berrangé
2021-04-30 6:47 ` Markus Armbruster
2021-04-29 11:06 ` Paolo Bonzini
2021-04-29 12:40 ` Gerd Hoffmann
2021-04-29 13:12 ` Kevin Wolf [this message]
2021-04-29 13:46 ` Gerd Hoffmann
2021-04-29 15:05 ` Philippe Mathieu-Daudé
2021-04-30 7:01 ` Markus Armbruster
2021-04-30 7:01 ` Gerd Hoffmann
2021-05-03 15:10 ` Paolo Bonzini
2021-04-29 11:17 ` Thomas Huth
2021-04-29 11:24 ` Peter Maydell
2021-05-03 10:39 ` Markus Armbruster
2021-04-29 14:49 ` Stefan Hajnoczi
2021-04-29 16:32 ` Eduardo Habkost
2021-04-30 3:22 ` Robert Hoo
2021-05-03 1:41 ` Alistair Francis
2021-05-03 4:49 ` Thomas Huth
2021-05-03 7:12 ` Alistair Francis
2021-05-03 15:13 ` Paolo Bonzini
2021-05-03 22:57 ` Alistair Francis
2021-05-03 13:14 ` Philippe Mathieu-Daudé
2021-05-03 18:21 ` Eric Blake
2021-05-04 13:59 ` Peter Krempa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YIqwsUAGEvfazbvZ@merkur.fritz.box \
--to=kwolf@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dirty.ice.hu@gmail.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=robert.hu@linux.intel.com \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).