]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: rename virPCIDeviceGetDriverPathAndName
authorLaine Stump <laine@redhat.com>
Sun, 9 Jul 2023 03:12:09 +0000 (23:12 -0400)
committerLaine Stump <laine@redhat.com>
Fri, 25 Aug 2023 03:36:18 +0000 (23:36 -0400)
Instead, call it virPCIDeviceGetCurrentDriverPathAndName() to avoid
confusion with the device name that is stored in the virPCIDevice
object - that one is not necessarily the name of the current driver
for the device, but could instead be the driver that we want to be
bound to the device in the future.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/hypervisor/virhostdev.c
src/libvirt_private.syms
src/util/virpci.c
src/util/virpci.h
tests/virpcitest.c

index c437ca9d22d676a9e938d70949c072a129aa30cd..244f057c6ceffb7c9c1e8c7f8082399b9a18e1cb 100644 (file)
@@ -765,9 +765,10 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr,
              *       information about active / inactive device across
              *       daemon restarts has been implemented */
 
-            if (virPCIDeviceGetDriverPathAndName(pci,
-                                                 &driverPath, &driverName) < 0)
+            if (virPCIDeviceGetCurrentDriverPathAndName(pci, &driverPath,
+                                                        &driverName) < 0) {
                 goto reattachdevs;
+            }
 
             stub = virPCIStubDriverTypeFromString(driverName);
 
@@ -2294,7 +2295,7 @@ virHostdevPrepareOneNVMeDevice(virHostdevManager *hostdev_mgr,
         g_autofree char *drvName = NULL;
         int stub = VIR_PCI_STUB_DRIVER_NONE;
 
-        if (virPCIDeviceGetDriverPathAndName(pci, &drvPath, &drvName) < 0)
+        if (virPCIDeviceGetCurrentDriverPathAndName(pci, &drvPath, &drvName) < 0)
             goto cleanup;
 
         if (drvName)
index 0ca63f09552a8d112750269169c1f6b48bf10eee..cc564928170660e1d861f99c6ec6ed789c17958b 100644 (file)
@@ -3074,7 +3074,7 @@ virPCIDeviceFileIterate;
 virPCIDeviceFree;
 virPCIDeviceGetAddress;
 virPCIDeviceGetConfigPath;
-virPCIDeviceGetDriverPathAndName;
+virPCIDeviceGetCurrentDriverPathAndName;
 virPCIDeviceGetIOMMUGroupDev;
 virPCIDeviceGetIOMMUGroupList;
 virPCIDeviceGetLinkCapSta;
index a53a51d55e2f728d757df96aa7e782aaf6c82f95..e6f7554b232cb1208c2750b6c46e19d59fc854cd 100644 (file)
@@ -228,7 +228,7 @@ virPCIFile(const char *device, const char *file)
 }
 
 
-/* virPCIDeviceGetDriverPathAndName - put the path to the driver
+/* virPCIDeviceGetCurrentDriverPathAndName - put the path to the driver
  * directory of the driver in use for this device in @path and the
  * name of the driver in @name. Both could be NULL if it's not bound
  * to any driver.
@@ -236,7 +236,9 @@ virPCIFile(const char *device, const char *file)
  * Return 0 for success, -1 for error.
  */
 int
-virPCIDeviceGetDriverPathAndName(virPCIDevice *dev, char **path, char **name)
+virPCIDeviceGetCurrentDriverPathAndName(virPCIDevice *dev,
+                                        char **path,
+                                        char **name)
 {
     int ret = -1;
     g_autofree char *drvlink = NULL;
@@ -1032,7 +1034,7 @@ virPCIDeviceReset(virPCIDevice *dev,
      * reset it whenever appropriate, so doing it ourselves would just
      * be redundant.
      */
-    if (virPCIDeviceGetDriverPathAndName(dev, &drvPath, &drvName) < 0)
+    if (virPCIDeviceGetCurrentDriverPathAndName(dev, &drvPath, &drvName) < 0)
         goto cleanup;
 
     if (virPCIStubDriverTypeFromString(drvName) == VIR_PCI_STUB_DRIVER_VFIO) {
@@ -1137,7 +1139,7 @@ virPCIDeviceUnbind(virPCIDevice *dev)
     g_autofree char *drvpath = NULL;
     g_autofree char *driver = NULL;
 
-    if (virPCIDeviceGetDriverPathAndName(dev, &drvpath, &driver) < 0)
+    if (virPCIDeviceGetCurrentDriverPathAndName(dev, &drvpath, &driver) < 0)
         return -1;
 
     if (!driver)
index f8f98f39de706ebe12c27953165d4f635955c6b7..19c910202a2d4f667ffb019a091aee5f660b435c 100644 (file)
@@ -280,9 +280,9 @@ virPCIVPDResource * virPCIDeviceGetVPD(virPCIDevice *dev);
 
 int virPCIDeviceUnbind(virPCIDevice *dev);
 int virPCIDeviceRebind(virPCIDevice *dev);
-int virPCIDeviceGetDriverPathAndName(virPCIDevice *dev,
-                                     char **path,
-                                     char **name);
+int virPCIDeviceGetCurrentDriverPathAndName(virPCIDevice *dev,
+                                            char **path,
+                                            char **name);
 
 int virPCIDeviceIsPCIExpress(virPCIDevice *dev);
 int virPCIDeviceHasPCIExpressLink(virPCIDevice *dev);
index 92cc8c07c6f30dd8bd7f93647e898f058068956e..d69a1b511834f7598598b83a79ba256d2f33549d 100644 (file)
@@ -37,7 +37,7 @@ testVirPCIDeviceCheckDriver(virPCIDevice *dev, const char *expected)
     g_autofree char *path = NULL;
     g_autofree char *driver = NULL;
 
-    if (virPCIDeviceGetDriverPathAndName(dev, &path, &driver) < 0)
+    if (virPCIDeviceGetCurrentDriverPathAndName(dev, &path, &driver) < 0)
         return -1;
 
     if (STRNEQ_NULLABLE(driver, expected)) {