提交 ca7ad978 编写于 作者: A Andrea Bolognani

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: NAndrea Bolognani <abologna@redhat.com>
Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
上级 a14f5972
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册