Re: [PATCH 4/7] qemu_command: Switch from VIR_ENUM_IMPL(qemuDeviceVideo) to explicit switch()

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

 



On Fri, Jun 11, 2021 at 17:04:57 +0200, Michal Privoznik wrote:
> This may look like a step backwards, but it isn't. The point is
> that in near future the chosen model will depend on more than
> just video type.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/qemu/qemu_command.c | 56 +++++++++++++++++++++++++----------------
>  1 file changed, 34 insertions(+), 22 deletions(-)


> @@ -4215,10 +4196,41 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
>          else
>              model = "vhost-user-gpu";
>      } else {
> -        if (primaryVga)
> -            model = qemuDeviceVideoTypeToString(video->type);
> -        else
> +        if (primaryVga) {
> +            switch (video->type) {

video->type is declared as:

int type;   /* enum virDomainVideoType */

Since it's not implicit, you need to use the proper typecast in the
switch to ensure that it's always populated.

> +            case VIR_DOMAIN_VIDEO_TYPE_VGA:
> +                model = "VGA";
> +                break;
> +            case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux