[libvirt PATCH v3 1/8] util: use "stubDriverType" instead of just "stubDriver"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the past we just kept track of the type of the "stub driver" (the
driver that is bound to a device in order to assign it to a
guest). The next commit will add a stubDriverName to go along with
type, so lets use stubDriverType for the existing enum to make it
easier to keep track of whether we're talking about the name or the
type.

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
 src/hypervisor/domain_driver.c |  4 ++--
 src/hypervisor/virhostdev.c    |  8 ++++----
 src/libvirt_private.syms       |  4 ++--
 src/util/virnvme.c             |  2 +-
 src/util/virpci.c              | 16 ++++++++--------
 src/util/virpci.h              |  6 +++---
 tests/virhostdevtest.c         |  2 +-
 tests/virpcitest.c             |  8 ++++----
 8 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c
index 66e09ffb04..a70f75f3ae 100644
--- a/src/hypervisor/domain_driver.c
+++ b/src/hypervisor/domain_driver.c
@@ -505,9 +505,9 @@ virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr dev,
         return -1;
 
     if (STREQ(driverName, "vfio"))
-        virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO);
+        virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_VFIO);
     else if (STREQ(driverName, "xen"))
-        virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_XEN);
+        virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_XEN);
 
     return virHostdevPCINodeDeviceDetach(hostdevMgr, pci);
 }
diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index eac3474783..c437ca9d22 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -244,9 +244,9 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
     virPCIDeviceSetManaged(actual, hostdev->managed);
 
     if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
-        virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_VFIO);
+        virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO);
     } else if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) {
-        virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_XEN);
+        virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_XEN);
     } else {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("pci backend driver '%1$s' is not supported"),
@@ -679,7 +679,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr,
     for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
         virPCIDevice *pci = virPCIDeviceListGet(pcidevs, i);
         bool strict_acs_check = !!(flags & VIR_HOSTDEV_STRICT_ACS_CHECK);
-        bool usesVFIO = (virPCIDeviceGetStubDriver(pci) == VIR_PCI_STUB_DRIVER_VFIO);
+        bool usesVFIO = (virPCIDeviceGetStubDriverType(pci) == VIR_PCI_STUB_DRIVER_VFIO);
         struct virHostdevIsPCINodeDeviceUsedData data = {mgr, drv_name, dom_name, false};
         int hdrType = -1;
 
@@ -776,7 +776,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr,
 
                 /* The device is bound to a known stub driver: store this
                  * information and add a copy to the inactive list */
-                virPCIDeviceSetStubDriver(pci, stub);
+                virPCIDeviceSetStubDriverType(pci, stub);
 
                 VIR_DEBUG("Adding PCI device %s to inactive list",
                           virPCIDeviceGetName(pci));
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index da60c965dd..983109df86 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3072,7 +3072,7 @@ virPCIDeviceGetManaged;
 virPCIDeviceGetName;
 virPCIDeviceGetRemoveSlot;
 virPCIDeviceGetReprobe;
-virPCIDeviceGetStubDriver;
+virPCIDeviceGetStubDriverType;
 virPCIDeviceGetUnbindFromStub;
 virPCIDeviceGetUsedBy;
 virPCIDeviceGetVPD;
@@ -3098,7 +3098,7 @@ virPCIDeviceReset;
 virPCIDeviceSetManaged;
 virPCIDeviceSetRemoveSlot;
 virPCIDeviceSetReprobe;
-virPCIDeviceSetStubDriver;
+virPCIDeviceSetStubDriverType;
 virPCIDeviceSetUnbindFromStub;
 virPCIDeviceSetUsedBy;
 virPCIDeviceUnbind;
diff --git a/src/util/virnvme.c b/src/util/virnvme.c
index f7f8dc5ea9..37333d515b 100644
--- a/src/util/virnvme.c
+++ b/src/util/virnvme.c
@@ -292,7 +292,7 @@ virNVMeDeviceCreatePCIDevice(const virNVMeDevice *nvme)
         return NULL;
 
     /* NVMe devices must be bound to vfio */
-    virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO);
+    virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_VFIO);
     virPCIDeviceSetManaged(pci, nvme->managed);
 
     return g_steal_pointer(&pci);
diff --git a/src/util/virpci.c b/src/util/virpci.c
index cc2b07bbba..88a020fb86 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -87,7 +87,7 @@ struct _virPCIDevice {
 
     bool          managed;
 
-    virPCIStubDriver stubDriver;
+    virPCIStubDriver stubDriverType;
 
     /* used by reattach function */
     bool          unbind_from_stub;
@@ -1233,12 +1233,12 @@ virPCIDeviceBindToStub(virPCIDevice *dev)
     g_autofree char *driverLink = NULL;
 
     /* Check the device is configured to use one of the known stub drivers */
-    if (dev->stubDriver == VIR_PCI_STUB_DRIVER_NONE) {
+    if (dev->stubDriverType == VIR_PCI_STUB_DRIVER_NONE) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("No stub driver configured for PCI device %1$s"),
                        dev->name);
         return -1;
-    } else if (!(stubDriverName = virPCIStubDriverTypeToString(dev->stubDriver))) {
+    } else if (!(stubDriverName = virPCIStubDriverTypeToString(dev->stubDriverType))) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unknown stub driver configured for PCI device %1$s"),
                        dev->name);
@@ -1287,7 +1287,7 @@ virPCIDeviceDetach(virPCIDevice *dev,
                    virPCIDeviceList *activeDevs,
                    virPCIDeviceList *inactiveDevs)
 {
-    if (virPCIProbeStubDriver(dev->stubDriver) < 0)
+    if (virPCIProbeStubDriver(dev->stubDriverType) < 0)
         return -1;
 
     if (activeDevs && virPCIDeviceListFind(activeDevs, &dev->address)) {
@@ -1569,15 +1569,15 @@ virPCIDeviceGetManaged(virPCIDevice *dev)
 }
 
 void
-virPCIDeviceSetStubDriver(virPCIDevice *dev, virPCIStubDriver driver)
+virPCIDeviceSetStubDriverType(virPCIDevice *dev, virPCIStubDriver driverType)
 {
-    dev->stubDriver = driver;
+    dev->stubDriverType = driverType;
 }
 
 virPCIStubDriver
-virPCIDeviceGetStubDriver(virPCIDevice *dev)
+virPCIDeviceGetStubDriverType(virPCIDevice *dev)
 {
-    return dev->stubDriver;
+    return dev->stubDriverType;
 }
 
 bool
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 4d9193f24e..485f535bc9 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -134,9 +134,9 @@ int virPCIDeviceReset(virPCIDevice *dev,
 void virPCIDeviceSetManaged(virPCIDevice *dev,
                             bool managed);
 bool virPCIDeviceGetManaged(virPCIDevice *dev);
-void virPCIDeviceSetStubDriver(virPCIDevice *dev,
-                               virPCIStubDriver driver);
-virPCIStubDriver virPCIDeviceGetStubDriver(virPCIDevice *dev);
+void virPCIDeviceSetStubDriverType(virPCIDevice *dev,
+                                   virPCIStubDriver driverType);
+virPCIStubDriver virPCIDeviceGetStubDriverType(virPCIDevice *dev);
 virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev);
 int virPCIDeviceSetUsedBy(virPCIDevice *dev,
                           const char *drv_name,
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index ee0d1c1e6b..04e6c00908 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -142,7 +142,7 @@ myInit(void)
         if (!(dev[i] = virPCIDeviceNew(&subsys->u.pci.addr)))
             goto cleanup;
 
-        virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
+        virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
     }
 
     for (i = 0; i < ndisks; i++) {
diff --git a/tests/virpcitest.c b/tests/virpcitest.c
index 769175d7c4..92cc8c07c6 100644
--- a/tests/virpcitest.c
+++ b/tests/virpcitest.c
@@ -107,7 +107,7 @@ testVirPCIDeviceDetach(const void *opaque G_GNUC_UNUSED)
         if (!(dev[i] = virPCIDeviceNew(&devAddr)))
             goto cleanup;
 
-        virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
+        virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
 
         if (virPCIDeviceDetach(dev[i], activeDevs, inactiveDevs) < 0)
             goto cleanup;
@@ -149,7 +149,7 @@ testVirPCIDeviceReset(const void *opaque G_GNUC_UNUSED)
         if (!(dev[i] = virPCIDeviceNew(&devAddr)))
             goto cleanup;
 
-        virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
+        virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
 
         if (virPCIDeviceReset(dev[i], activeDevs, inactiveDevs) < 0)
             goto cleanup;
@@ -190,7 +190,7 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UNUSED)
         CHECK_LIST_COUNT(activeDevs, 0);
         CHECK_LIST_COUNT(inactiveDevs, i + 1);
 
-        virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
+        virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
     }
 
     CHECK_LIST_COUNT(activeDevs, 0);
@@ -249,7 +249,7 @@ testVirPCIDeviceDetachSingle(const void *opaque)
     if (!dev)
         goto cleanup;
 
-    virPCIDeviceSetStubDriver(dev, VIR_PCI_STUB_DRIVER_VFIO);
+    virPCIDeviceSetStubDriverType(dev, VIR_PCI_STUB_DRIVER_VFIO);
 
     if (virPCIDeviceDetach(dev, NULL, NULL) < 0)
         goto cleanup;
-- 
2.41.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux