util: rename virPCIDeviceGetDriverPathAndName

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>
This commit is contained in:
Laine Stump 2023-07-08 23:12:09 -04:00
parent 1bb9617971
commit 222b66974e
5 changed files with 15 additions and 12 deletions

View 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)

View File

@ -3074,7 +3074,7 @@ virPCIDeviceFileIterate;
virPCIDeviceFree;
virPCIDeviceGetAddress;
virPCIDeviceGetConfigPath;
virPCIDeviceGetDriverPathAndName;
virPCIDeviceGetCurrentDriverPathAndName;
virPCIDeviceGetIOMMUGroupDev;
virPCIDeviceGetIOMMUGroupList;
virPCIDeviceGetLinkCapSta;

View 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)

View 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);

View 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)) {