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

Re: [libvirt] [PATCH v3 09/13] Rename all USB device functions to have a standard name prefix



On Fri, Feb 01, 2013 at 11:18:31 +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> Rename all the usbDeviceXXX and usbXXXDevice APIs to have a
> fixed virUSBDevice name prefix
...
> diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
> index 1984c5f..c382635 100644
> --- a/src/lxc/lxc_cgroup.c
> +++ b/src/lxc/lxc_cgroup.c
...
> @@ -421,14 +421,15 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def,
>              if (hostdev->missing)
>                  continue;
>  
> -            if ((usb = usbGetDevice(hostdev->source.subsys.u.usb.bus,
> -                                    hostdev->source.subsys.u.usb.device,
> -                                    NULL)) == NULL)
> +            if ((usb = virUSBDeviceNew(hostdev->source.subsys.u.usb.bus,
> +                                       hostdev->source.subsys.u.usb.device,
> +                                       NULL)) == NULL)
>                  goto cleanup;
>  
> -            if (usbDeviceFileIterate(usb, virLXCSetupHostUsbDeviceCgroup,
> -                                     cgroup) < 0)
> +            if (virUSBDeviceFileIterate(usb, virLXCSetupHostUsbDeviceCgroup,
> +                                        cgroup) < 0)
>                  goto cleanup;
> +            virUSBDeviceFree(usb);

This line looks like a standalone bug fix that should be in a separate
patch. Not to mention that the same call should be done even if
virUSBDeviceFileIterate fails.

>              break;
>          case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
>              switch (hostdev->source.caps.type) {
...
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index 482989f..4eeb4e5 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
...
> @@ -295,13 +295,13 @@ int qemuSetupCgroup(virQEMUDriverPtr driver,
>              if (hostdev->missing)
>                  continue;
>  
> -            if ((usb = usbGetDevice(hostdev->source.subsys.u.usb.bus,
> -                                    hostdev->source.subsys.u.usb.device,
> -                                    NULL)) == NULL)
> +            if ((usb = virUSBDeviceNew(hostdev->source.subsys.u.usb.bus,
> +                                       hostdev->source.subsys.u.usb.device,
> +                                       NULL)) == NULL)
>                  goto cleanup;
>  
> -            if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup,
> -                                     &data) < 0)
> +            if (virUSBDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup,
> +                                        &data) < 0)
>                  goto cleanup;
>          }

This code has the same bug you fixed for LXC. But again, it's for a
separate patch.

>      }
...

ACK after separating the bug fix into its own patch.

Jirka


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