[PATCH v3 2/9] Initialize the stubDriver of pci devices if bound to a valid one

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

 



The stubDriver name can be used to make useful decisions if readily available.
Set it if bound to a valid one during initialisation.

Signed-off-by: Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxxxxxxx>
---
 src/util/virpci.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/util/virpci.c b/src/util/virpci.c
index bff37d7..876da70 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1564,6 +1564,8 @@ virPCIDeviceNew(unsigned int domain,
     virPCIDevicePtr dev;
     char *vendor = NULL;
     char *product = NULL;
+    char *drvpath = NULL;
+    char *driver = NULL;
 
     if (VIR_ALLOC(dev) < 0)
         return NULL;
@@ -1611,9 +1613,19 @@ virPCIDeviceNew(unsigned int domain,
         goto error;
     }
 
+    if (virPCIDeviceGetDriverPathAndName(dev, &drvpath, &driver) < 0)
+        goto cleanup;
+
     VIR_DEBUG("%s %s: initialized", dev->id, dev->name);
 
+    if (!virPCIIsKnownStub(driver)) {
+        VIR_FREE(driver);
+        goto cleanup;
+    }
+    dev->stubDriver = driver;
+
  cleanup:
+    VIR_FREE(drvpath);
     VIR_FREE(product);
     VIR_FREE(vendor);
     return dev;

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]