]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Drop virPCIGetAddrString()
authorAndrea Bolognani <abologna@redhat.com>
Tue, 4 Sep 2018 17:05:46 +0000 (19:05 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 5 Sep 2018 13:51:42 +0000 (15:51 +0200)
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>
src/util/virnetdev.c
src/util/virpci.c
src/util/virpci.h

index 8eac419725325669788851cdb66a4ff37e73ac04..c4dd354dc37516e5ed0c5f84cf1ddb961c4cf20d 100644 (file)
@@ -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"));
index d82da710ee5e56b9a0e6923ee6b26065e7d629f5..1730d888f716b413c3955591fe44a5df191fa016 100644 (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)
 {
index 271a753be22a4a216ea7aa2deeecc366d16fe04f..b4f72f8f063ef43eb0d464f2c2a40122836029ea 100644 (file)
@@ -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);