qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/2] vl: Replace *_vga_available() functions wit


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 2/2] vl: Replace *_vga_available() functions with class_names field
Date: Wed, 11 Nov 2015 15:09:17 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 11/11/2015 02:27 PM, Eduardo Habkost wrote:
> Instead of requiring a separate function for each VGA interface,
> just enumerate the corresponding class names on struct
> VGAInterfaceInfo.
> 
> Signed-off-by: Eduardo Habkost <address@hidden>
> ---
>  vl.c | 70 
> +++++++++++++++++++++++---------------------------------------------
>  1 file changed, 23 insertions(+), 47 deletions(-)
> 

>      [VGA_CG3] = {
>          .opt_name = "cg3",
>          .name = "CG3 framebuffer",
> -        .available = cg3_vga_available,
> +        .class_names = { "cgthree" },
>      },
>      [VGA_XENFB] = {
>          .opt_name = "xenfb",
>      },
>  };
>  
> +static bool vga_interface_available(VGAInterfaceType t)
> +{
> +    VGAInterfaceInfo *ti = &vga_interfaces[t];
> +
> +    assert(t < VGA_TYPE_MAX);
> +    return !ti->class_names[0] ||
> +           object_class_by_name(ti->class_names[0]) ||
> +           object_class_by_name(ti->class_names[1]);

Does the correct thing when ti->class_names[1] is NULL (but I had to look).

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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