mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
util: Drop virPCIGetAddrString()
There's a single user for it which takes an existing virPCIDeviceAddress, passes its various bits to the function which in turn constructs a virPCIDevice and then copies the string representation for the caller to use: we can use virPCIDeviceAddressAsString() instead and avoid creating the virPCIDevice in the first place. Since the function ends up having no users after the change, we can just drop it. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
a14f597266
commit
ca7ad978a9
@ -1305,15 +1305,9 @@ virNetDevGetVirtualFunctions(const char *pfname,
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0; i < *n_vfname; i++) {
|
||||
if (virPCIGetAddrString((*virt_fns)[i]->domain,
|
||||
(*virt_fns)[i]->bus,
|
||||
(*virt_fns)[i]->slot,
|
||||
(*virt_fns)[i]->function,
|
||||
&pciConfigAddr) < 0) {
|
||||
virReportSystemError(ENOSYS, "%s",
|
||||
_("Failed to get PCI Config Address String"));
|
||||
if (!(pciConfigAddr = virPCIDeviceAddressAsString((*virt_fns)[i])))
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virPCIGetSysfsFile(pciConfigAddr, &pci_sysfs_device_link) < 0) {
|
||||
virReportSystemError(ENOSYS, "%s",
|
||||
_("Failed to get PCI SYSFS file"));
|
||||
|
@ -1668,22 +1668,6 @@ virPCIDeviceReadID(virPCIDevicePtr dev, const char *id_name)
|
||||
return id_str;
|
||||
}
|
||||
|
||||
int
|
||||
virPCIGetAddrString(unsigned int domain,
|
||||
unsigned int bus,
|
||||
unsigned int slot,
|
||||
unsigned int function,
|
||||
char **pciConfigAddr)
|
||||
{
|
||||
VIR_AUTOPTR(virPCIDevice) dev = NULL;
|
||||
|
||||
dev = virPCIDeviceNew(domain, bus, slot, function);
|
||||
if (!dev || VIR_STRDUP(*pciConfigAddr, dev->name) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
virPCIDeviceAddressAsString(virPCIDeviceAddressPtr addr)
|
||||
{
|
||||
|
@ -218,13 +218,6 @@ int virPCIGetSysfsFile(char *virPCIDeviceName,
|
||||
char **pci_sysfs_device_link)
|
||||
ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
int virPCIGetAddrString(unsigned int domain,
|
||||
unsigned int bus,
|
||||
unsigned int slot,
|
||||
unsigned int function,
|
||||
char **pciConfigAddr)
|
||||
ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
char *virPCIDeviceAddressAsString(virPCIDeviceAddressPtr addr)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user