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

[libvirt] [PATCH 1/5 v3] Added function pciSysfsFile to enable access to the PCI SYSFS files.



---
 src/util/pci.c |   16 ++++++++++++++++
 src/util/pci.h |    2 ++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/util/pci.c b/src/util/pci.c
index cd82b43..d0ba4c5 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -2027,6 +2027,22 @@ out:
 }
 
 /*
+ * Returns a path to the PCI sysfs file given the BDF of the PCI function
+ */
+
+int
+pciSysfsFile(char *pciDeviceName, char **pci_sysfs_device_link)
+{
+    if (virAsprintf(pci_sysfs_device_link, PCI_SYSFS "devices/%s",
+                    pciDeviceName) < 0) {
+        virReportOOMError();
+        return -1;
+    }
+    
+    return 0;
+}
+
+/*
  * Returns the network device name of a pci device
  */
 int
diff --git a/src/util/pci.h b/src/util/pci.h
index 76e37e3..f98e745 100644
--- a/src/util/pci.h
+++ b/src/util/pci.h
@@ -109,4 +109,6 @@ int pciGetVirtualFunctionIndex(const char *pf_sysfs_device_link,
 
 int pciDeviceNetName(char *device_link_sysfs_path, char **netname);
 
+int pciSysfsFile(char *pciDeviceName, char **pci_sysfs_device_link);
+
 #endif /* __VIR_PCI_H__ */
-- 
1.7.4.4



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