int ret = 0;
ret = virStrToLong_ui(s, end_ptr, base, result);
- if (ret != 0) {
+ if (ret != 0)
VIR_ERROR(_("Failed to convert '%s' to unsigned int"), s);
- } else {
- VIR_DEBUG("Converted '%s' to unsigned int %u", s, *result);
- }
-
return ret;
}
char errbuf[64];
int ret = -1;
- VIR_DEBUG("Attempting to resolve device path from device link '%s'",
- device_link);
-
if (!virFileExists(device_link)) {
- VIR_DEBUG("sysfs_path '%s' does not exist", device_link);
+ VIR_DEBUG("'%s' does not exist", device_link);
return ret;
}
goto out;
}
- VIR_DEBUG("virPCIDeviceAddress %.4x:%.2x:%.2x.%.1x",
- (*bdf)->domain,
- (*bdf)->bus,
- (*bdf)->slot,
- (*bdf)->function);
-
ret = 0;
-
out:
VIR_FREE(device_path);
*/
int
virPCIGetPhysicalFunction(const char *vf_sysfs_path,
- virPCIDeviceAddressPtr *physical_function)
+ virPCIDeviceAddressPtr *pf)
{
int ret = -1;
char *device_link = NULL;
- VIR_DEBUG("Attempting to get SR IOV physical function for device "
- "with sysfs path '%s'", vf_sysfs_path);
-
if (virBuildPath(&device_link, vf_sysfs_path, "physfn") == -1) {
virReportOOMError();
return ret;
- } else {
- ret = virPCIGetDeviceAddressFromSysfsLink(device_link,
- physical_function);
}
+ if ((ret = virPCIGetDeviceAddressFromSysfsLink(device_link, pf)) >= 0) {
+ VIR_DEBUG("PF for VF device '%s': %.4x:%.2x:%.2x.%.1x", vf_sysfs_path,
+ (*pf)->domain, (*pf)->bus, (*pf)->slot, (*pf)->function);
+ }
VIR_FREE(device_link);
return ret;
virPCIDeviceAddress *config_addr = NULL;
char *totalvfs_file = NULL, *totalvfs_str = NULL;
- VIR_DEBUG("Attempting to get SR IOV virtual functions for device"
- "with sysfs path '%s'", sysfs_path);
-
*virtual_functions = NULL;
*num_virtual_functions = 0;
*max_virtual_functions = 0;
goto error;
}
- VIR_DEBUG("Found virtual function %zu", *num_virtual_functions);
if (VIR_APPEND_ELEMENT(*virtual_functions, *num_virtual_functions, config_addr) < 0)
goto error;
VIR_FREE(device_link);
} while (1);
+ VIR_DEBUG("Found %zu virtual functions for %s", *num_virtual_functions, sysfs_path);
ret = 0;
cleanup:
VIR_FREE(device_link);
int
virPCIGetPhysicalFunction(const char *vf_sysfs_path ATTRIBUTE_UNUSED,
- virPCIDeviceAddressPtr *physical_function ATTRIBUTE_UNUSED)
+ virPCIDeviceAddressPtr *pf ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
int strict_acs_check);
int virPCIDeviceWaitForCleanup(virPCIDevicePtr dev, const char *matcher);
-int virPCIGetPhysicalFunction(const char *sysfs_path,
- virPCIDeviceAddressPtr *phys_fn);
+int virPCIGetPhysicalFunction(const char *vf_sysfs_path,
+ virPCIDeviceAddressPtr *pf);
int virPCIGetVirtualFunctions(const char *sysfs_path,
virPCIDeviceAddressPtr **virtual_functions,