[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1 of 2] libxl_pci: rename is_assigned to is_pcidev_in_array
All this function does is check to see if a device is in an array of pcidevs passed by the caller. The function name can be misleading if ever used to check against a list of devices other than those assigned to a domain. Signed-off-by: Doug Magee <djmagee@xxxxxxxxxxxx> diff -r 5b2676ac1321 -r 3becc1652693 tools/libxl/libxl_pci.c --- a/tools/libxl/libxl_pci.c Mon Jan 09 16:01:44 2012 +0100 +++ b/tools/libxl/libxl_pci.c Tue Jan 17 10:14:15 2012 -0500 @@ -461,7 +461,7 @@ static int get_all_assigned_devices(libx return 0; } -static int is_assigned(libxl_device_pci *assigned, int num_assigned, +static int is_pcidev_in_array(libxl_device_pci *assigned, int num_assigned, int dom, int bus, int dev, int func) { int i; @@ -510,7 +510,7 @@ libxl_device_pci *libxl_device_pci_list_ if ( sscanf(de->d_name, PCI_BDF, &dom, &bus, &dev, &func) != 4 ) continue; - if ( is_assigned(assigned, num_assigned, dom, bus, dev, func) ) + if ( is_pcidev_in_array(assigned, num_assigned, dom, bus, dev, func) ) continue; new = realloc(pcidevs, ((*num) + 1) * sizeof(*new)); @@ -802,7 +802,7 @@ int libxl__device_pci_add(libxl__gc *gc, LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot determine if device is assigned, refusing to continue"); goto out; } - if ( is_assigned(assigned, num_assigned, pcidev->domain, + if ( is_pcidev_in_array(assigned, num_assigned, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func) ) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device already attached to a domain"); rc = ERROR_FAIL; @@ -906,7 +906,7 @@ static int do_pci_remove(libxl__gc *gc, return ERROR_FAIL; rc = ERROR_INVAL; - if ( !is_assigned(assigned, num, pcidev->domain, + if ( !is_pcidev_in_array(assigned, num, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func) ) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device not attached to this domain"); goto out_fail; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |