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

Re: [Xen-devel] [PATCH 3 of 4 v2] libxl: Introduce pci_assignable_add and pci_assignable_remove



On Mon, May 14, 2012 at 10:21:33AM +0100, Ian Campbell wrote:
> > +
> > +/* Scan through /sys/.../pciback/slots looking for pcidev's BDF */
> > +static int pciback_dev_has_slot(libxl__gc *gc, libxl_device_pci *pcidev)
> > +{
> > +    libxl_ctx *ctx = libxl__gc_owner(gc);
> > +    FILE *f;
> > +    int rc = 0;
> > +    unsigned dom, bus, dev, func;
> > +
> > +    f = fopen(SYSFS_PCIBACK_DRIVER"/slots", "r");
> > +
> > +    if (f == NULL) {
> > +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s",
> > +                         SYSFS_PCIBACK_DRIVER"/slots");
> > +        return ERROR_FAIL;
> > +    }
> > +
> > +    while(fscanf(f, "%x:%x:%x.%x\n", &dom, &bus, &dev, &func)==3) {

And the last one should be %d.

> 
> Shouldn't this 3 be 4 now that you include dom?
> 
> Also ISTR some change to the precise formatting using by the kernel for
> BDFs recently (A . became a : or vice versa?). CCing Konrad for input in
> case it impacts this too.
> 
> The rest all looked fine.
> 
> > +        if(dom == pcidev->domain
> > +           && bus == pcidev->bus
> > +           && dev == pcidev->dev
> > +           && func == pcidev->func) {
> > +            rc = 1;
> > +            goto out;
> > +        }
> > +    }
> > +out:
> > +    fclose(f);
> > +    return rc;
> > +}
> > +

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.