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(a)redhat.com>
---
src/hypervisor/virhostdev.c | 7 ++++---
src/libvirt_private.syms | 2 +-
src/util/virpci.c | 10 ++++++----
src/util/virpci.h | 6 +++---
tests/virpcitest.c | 2 +-
5 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index c437ca9d22..244f057c6c 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -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)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index fad5389d68..2b577c4e2d 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3064,7 +3064,7 @@ virPCIDeviceFileIterate;
virPCIDeviceFree;
virPCIDeviceGetAddress;
virPCIDeviceGetConfigPath;
-virPCIDeviceGetDriverPathAndName;
+virPCIDeviceGetCurrentDriverPathAndName;
virPCIDeviceGetIOMMUGroupDev;
virPCIDeviceGetIOMMUGroupList;
virPCIDeviceGetLinkCapSta;
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 103bc4254e..2ec0dc2053 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -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)
diff --git a/src/util/virpci.h b/src/util/virpci.h
index f8f98f39de..19c910202a 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -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);
diff --git a/tests/virpcitest.c b/tests/virpcitest.c
index 92cc8c07c6..d69a1b5118 100644
--- a/tests/virpcitest.c
+++ b/tests/virpcitest.c
@@ -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)) {
--
2.41.0