[libvirt] [PATCH 2/6] Add helper APIs for iterating over PCI device resource files

Daniel Veillard veillard at redhat.com
Wed Sep 2 09:16:08 UTC 2009


On Tue, Sep 01, 2009 at 04:28:55PM +0100, Daniel P. Berrange wrote:
[...]
> @@ -1022,3 +1022,55 @@ pciDeviceListFind(pciDeviceList *list, pciDevice *dev)
>              return list->devs[i];
>      return NULL;
>  }
> +
> +
> +int pciDeviceFileIterate(virConnectPtr conn,
> +                         pciDevice *dev,
> +                         pciDeviceFileActor actor,
> +                         void *opaque)
> +{
> +    char *pcidir = NULL;
> +    char *file = NULL;
> +    DIR *dir = NULL;
> +    int ret = -1;
> +    struct dirent *ent;
> +
> +    if (virAsprintf(&pcidir, "/sys/bus/pci/devices/%04x:%02x:%02x.%x",
> +                    dev->domain, dev->bus, dev->slot, dev->function) < 0) {

  hum "%s/devices/%04x:%02x:%02x.%x ", PCI_SYSFS, ...
would be a bit better I guess

   Fine, ACK,

Daniel

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




More information about the libvir-list mailing list