Re: [PATCH v2 1/1] conf: Add validation of input devices

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

 




On 07/26/2018 03:27 AM, Han Han wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1591151
> 
> Add function virDomainInputDefValidate to validate input devices.
> Make sure evdev attribute of source element is not used by mouse,
> keyboard, and tablet input device.
> 
> Signed-off-by: Han Han <hhan@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 

FYI: For a single patch series, no need to create a --cover-letter

> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 178c6d2711..a65b53b70c 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -5723,6 +5723,24 @@ virDomainVsockDefValidate(const virDomainVsockDef *vsock)
>      return 0;
>  }
>  
> +static int
> +virDomainInputDefValidate(const virDomainInputDef *input)
> +{
> +    switch (input->type) {

So you missed the part where I said like virDomainInputDefGetPath...

This should be

    switch ((virDomainInputType) input->type)

> +        case VIR_DOMAIN_INPUT_TYPE_MOUSE:
> +        case VIR_DOMAIN_INPUT_TYPE_TABLET:
> +        case VIR_DOMAIN_INPUT_TYPE_KBD:
> +            if (input->source.evdev) {
> +                 virReportError(VIR_ERR_XML_ERROR, "%s",
> +                                _("setting source evdev path only supported for "
> +                                  "passthrough input devices"));
> +                 return -1;
> +            }

Thus necessitating cases for:

        case VIR_DOMAIN_INPUT_TYPE_LAST:
(int the above failure pile)

and

        case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
            break;

I have fixed this and pushed with my

Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>

John


> +    }
> +
> +    return 0;
> +}
> +
>  
>  static int
>  virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
> @@ -5762,9 +5780,11 @@ virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
>      case VIR_DOMAIN_DEVICE_VSOCK:
>          return virDomainVsockDefValidate(dev->data.vsock);
>  
> +    case VIR_DOMAIN_DEVICE_INPUT:
> +        return virDomainInputDefValidate(dev->data.input);
> +
>      case VIR_DOMAIN_DEVICE_LEASE:
>      case VIR_DOMAIN_DEVICE_FS:
> -    case VIR_DOMAIN_DEVICE_INPUT:
>      case VIR_DOMAIN_DEVICE_SOUND:
>      case VIR_DOMAIN_DEVICE_WATCHDOG:
>      case VIR_DOMAIN_DEVICE_GRAPHICS:
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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