qemu-devel
[Top][All Lists]
Advanced

[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.





reply via email to

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