[libvirt] [PATCH 2/4] conf: domain: Introduce virDomainDeviceInfoIterate flags

John Ferlan jferlan at redhat.com
Tue Dec 11 23:50:19 UTC 2018



On 12/7/18 9:47 AM, Erik Skultety wrote:
> One of the usages of the device iterator is to run config validation.
> That's a problem for graphics devices, because they don't have any @info
> data (graphics shouldn't have been considered as devices in the first
> place), and simply passing NULL would crash a few callbacks invoked from
> the iterator. Fix this problem by introducing iterator flags.

Somewhat confusing commit message or I'm just being dense, your choice.

Although I think that @info data for graphics devices could be moved
into patch4 since that's where it makes more sense (eventually at least).

> 
> Signed-off-by: Erik Skultety <eskultet at redhat.com>
> ---
>  src/conf/domain_conf.c | 27 ++++++++++++++++++++-------
>  1 file changed, 20 insertions(+), 7 deletions(-)
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b70dca6c61..11552bff5b 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -3703,10 +3703,18 @@ virDomainSkipBackcompatConsole(virDomainDefPtr def,
>  }
>  
>  
> +typedef enum {
> +    DEVICE_INFO_ITERATE_ALL_CONSOLES = 1 << 0, /* Iterate console[0] */
> +} virDomainDeviceInfoIterateFlags;
> +

Logic seems right vis-a-vis replacing a bool with a flag properly. I
don't get the name and comment, but I'm not sure I could name it better.
The called function with the @all flag only processes when @all == false
as I'm reading things. Anyway, if someone has a better idea, then they
should speak up before you push!

Reviewed-by: John Ferlan <jferlan at redhat.com>

John




More information about the libvir-list mailing list