Re: [libvirt] [PATCH 1/6] Add helper module for dealing with USB host devices

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

 



On Tue, Sep 01, 2009 at 04:28:54PM +0100, Daniel P. Berrange wrote:
> * src/Makefile.am: Add usb.h and usb.h to libvirt_util.la
> * src/libvirt_private.syms: Export symbols
> * src/usb.c, src/usb.h: Helper APIs for USB host devices
> ---
>  src/Makefile.am          |    1 +
>  src/hostusb.c            |  103 ++++++++++++++++++++++++++++++++++++++++++++++
>  src/hostusb.h            |   45 ++++++++++++++++++++
>  src/libvirt_private.syms |    4 ++
>  4 files changed, 153 insertions(+), 0 deletions(-)
>  create mode 100644 src/hostusb.c
>  create mode 100644 src/hostusb.h

  Sounds good

[...]
> +/* For virReportOOMError()  and virReportSystemError() */
> +#define VIR_FROM_THIS VIR_FROM_NONE

   VIR_FROM_STORAGE might be a bit more precise

> +usbDevice *
> +usbGetDevice(virConnectPtr conn,
> +             unsigned bus,
> +             unsigned devno)
> +{

 The function code should probably be #ifdef linux

> +    usbDevice *dev;
> +
> +    if (VIR_ALLOC(dev) < 0) {
> +        virReportOOMError(conn);
> +        return NULL;
> +    }
> +
> +    dev->bus     = bus;
> +    dev->dev     = devno;
> +
> +    snprintf(dev->name, sizeof(dev->name), "%.3o:%.3o",
> +             dev->bus, dev->dev);
> +    snprintf(dev->path, sizeof(dev->path),
> +             USB_DEVFS "%03o/%03o", dev->bus, dev->dev);
> +
> +    /* XXX fixme. this should be product/vendor */
> +    snprintf(dev->id, sizeof(dev->id), "%d %d", dev->bus, dev->dev);
> +
> +    VIR_DEBUG("%s %s: initialized", dev->id, dev->name);
> +
> +    return dev;

  with a #else emitting an error

   Those tiny things apart, ACK, looks fine !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
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]