Re: [PATCH v2 1/2] libxl: add validation if sound device is supported

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

 



On 12/20/22 23:52, Marek Marczykowski-Górecki wrote:
> Xen supports only subset of libvirt's sound devices, and starting with
> Xen 4.17 it is enforced by libxl. Verify it early.
> 
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
> ---
>  src/libxl/libxl_domain.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 2d53250895..6507e34469 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -312,6 +312,27 @@ libxlDomainDefValidate(const virDomainDef *def,
>          return -1;
>      }
>  
> +    if (def->nsounds > 0) {
> +        virDomainSoundDef *snd = def->sounds[0];
> +        switch (snd->model) {

Nit pick, the variable declaration block and code should be separated by
an empty line. It's more readable that way.

> +            case VIR_DOMAIN_SOUND_MODEL_ICH6:
> +            case VIR_DOMAIN_SOUND_MODEL_ES1370:
> +            case VIR_DOMAIN_SOUND_MODEL_AC97:
> +            case VIR_DOMAIN_SOUND_MODEL_SB16:
> +                break;
> +            default:
> +            case VIR_DOMAIN_SOUND_MODEL_PCSPK:
> +            case VIR_DOMAIN_SOUND_MODEL_ICH7:
> +            case VIR_DOMAIN_SOUND_MODEL_USB:
> +            case VIR_DOMAIN_SOUND_MODEL_ICH9:
> +            case VIR_DOMAIN_SOUND_MODEL_LAST:
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                        _("unsupported audio model %s"),
> +                        virDomainSoundModelTypeToString(snd->model));
> +                return -1;
> +        }
> +    }
> +
>      return 0;
>  }
>  

Reviewed-by: Michal Privoznik <mprivozn@xxxxxxxxxx>

Michal




[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