[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 06/19] Add qemu_opts_validate() for post parsing
From: |
Mark McLoughlin |
Subject: |
Re: [Qemu-devel] [PATCH 06/19] Add qemu_opts_validate() for post parsing validation |
Date: |
Fri, 11 Sep 2009 13:38:11 +0100 |
On Fri, 2009-09-11 at 09:47 +0200, Gerd Hoffmann wrote:
> On 09/10/09 17:18, Mark McLoughlin wrote:
> > Several qemu command line options have a parameter whose value affects
> > what other parameters are accepted for the option.
> >
> > In these cases, we can have an empty description table in the
> > QemuOptsList and once the option has been parsed we can use a suitable
> > description table to validate the other parameters based on the value of
> > that parameter.
>
> Hmm. The "empty description" mode is intended to be used in case the
> verification isn't done by QemuOpts at all (i.e. for -devices, where the
> qdev property code will do the checks). I really like to have the
> option description hooked into QemuOptsList.
>
> I can think of two possible ways to do that:
>
> (1) We can stick all possible values info QemuOptsList->desc. Then
> have separate data structures to describe which fields are allowed
> in which cases (and, while being at it, which fields are mandatory).
You'd need to make it part of the QemuOptDesc to make it easy to figure
out from reading the code which parameters apply to which types.
e.g. a QemuOptDesc::firstname_values field
> (2) We have multiple QemuOptDesc lists for the different cases.
As with what I did, you'll have some parameters which are common to
different types.
> I tend to prefer the first. We can do the option parsing
> unconditionally in qemu_opt_set() then and don't have two different
> possible code paths for that.
Sounds reasonable, except it is nice that right now we have the
parameter descriptions associated with, and close to, the init function.
Cheers,
Mark.
- Re: [Qemu-devel] [PATCH 03/19] Remove double error message in qemu_option_set(), (continued)
[Qemu-devel] [PATCH 08/19] Add qemu_net_opts, Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 05/19] Make qemu_opts_parse() handle empty strings, Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 18/19] Port PCI NIC hotplug to QemuOpts, Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 12/19] Port -net socket to QemuOpts, Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 06/19] Add qemu_opts_validate() for post parsing validation, Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 10/19] Port -net user to QemuOpts, Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 09/19] Port -net none and -net nic to QemuOpts, Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 16/19] Port host_net_add monitor command to QemuOpts, Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 14/19] Port -net dump to QemuOpts, Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 17/19] Port usb net to QemuOpts, Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 15/19] Clean up legacy code in net_client_init(), Mark McLoughlin, 2009/09/10
[Qemu-devel] [PATCH 13/19] Port -net vde to QemuOpts, Mark McLoughlin, 2009/09/10