|
[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
> +
> +/* 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) {
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |