[PATCH 37/50] list: Implement listAllNodeDevices

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

 



This simply implements listAllNodeDevices using helper virNodeDeviceList

src/node_device/node_device_driver.h:
  * Declare nodeListAllNodeDevices.

src/node_device/node_device_driver.c:
  * Implement nodeListAllNodeDevices.

src/node_device/node_device_hal.c:
  * Hook listAllNodeDevices to nodeListAllNodeDevices.

src/node_device/node_device_udev.c
  * Hook listAllNodeDevices to nodeListAllNodeDevices.
---
 src/node_device/node_device_driver.c |   16 ++++++++++++++++
 src/node_device/node_device_driver.h |    3 +++
 src/node_device/node_device_hal.c    |    1 +
 src/node_device/node_device_udev.c   |    1 +
 4 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 83db775..52df49e 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -37,6 +37,7 @@
 #include "node_device_conf.h"
 #include "node_device_hal.h"
 #include "node_device_driver.h"
+#include "virobjectlist.h"
 #include "util.h"
 
 #define VIR_FROM_THIS VIR_FROM_NODEDEV
@@ -183,6 +184,21 @@ nodeListDevices(virConnectPtr conn,
     return -1;
 }
 
+int
+nodeListAllNodeDevices(virConnectPtr conn,
+                       virNodeDevicePtr **devices,
+                       unsigned int flags)
+{
+    virDeviceMonitorStatePtr driver = conn->devMonPrivateData;
+    int ret = -1;
+
+    virCheckFlags(VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP, -1);
+
+    nodeDeviceLock(driver);
+    ret = virNodeDeviceList(conn, driver->devs, devices, flags);
+    nodeDeviceUnlock(driver);
+    return ret;
+}
 
 virNodeDevicePtr
 nodeDeviceLookupByName(virConnectPtr conn, const char *name)
diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_device_driver.h
index 673e95b..deab618 100644
--- a/src/node_device/node_device_driver.h
+++ b/src/node_device/node_device_driver.h
@@ -73,6 +73,9 @@ int read_wwn_linux(int host, const char *file, char **wwn);
 int nodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags);
 int nodeListDevices(virConnectPtr conn, const char *cap, char **const names,
                     int maxnames, unsigned int flags);
+int nodeListAllNodeDevices(virConnectPtr conn,
+                           virNodeDevicePtr **devices,
+                           unsigned int flags);
 virNodeDevicePtr nodeDeviceLookupByName(virConnectPtr conn, const char *name);
 char *nodeDeviceGetXMLDesc(virNodeDevicePtr dev, unsigned int flags);
 char *nodeDeviceGetParent(virNodeDevicePtr dev);
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 7f8b076..c06f977 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -770,6 +770,7 @@ static virDeviceMonitor halDeviceMonitor = {
     .close = halNodeDrvClose, /* 0.5.0 */
     .numOfDevices = nodeNumOfDevices, /* 0.5.0 */
     .listDevices = nodeListDevices, /* 0.5.0 */
+    .listAllNodeDevices = nodeListAllNodeDevices, /* 0.9.14 */
     .deviceLookupByName = nodeDeviceLookupByName, /* 0.5.0 */
     .deviceGetXMLDesc = nodeDeviceGetXMLDesc, /* 0.5.0 */
     .deviceGetParent = nodeDeviceGetParent, /* 0.5.0 */
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index aa96abd..33dd3e9 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1757,6 +1757,7 @@ static virDeviceMonitor udevDeviceMonitor = {
     .close = udevNodeDrvClose, /* 0.7.3 */
     .numOfDevices = nodeNumOfDevices, /* 0.7.3 */
     .listDevices = nodeListDevices, /* 0.7.3 */
+    .listAllNodeDevices = nodeListAllNodeDevices, /* 0.9.14 */
     .deviceLookupByName = nodeDeviceLookupByName, /* 0.7.3 */
     .deviceGetXMLDesc = nodeDeviceGetXMLDesc, /* 0.7.3 */
     .deviceGetParent = nodeDeviceGetParent, /* 0.7.3 */
-- 
1.7.7.3

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