aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOsier Yang <jyang@redhat.com>2012-09-05 13:34:10 +0800
committerOsier Yang <jyang@redhat.com>2012-09-17 10:40:31 +0800
commitc68cd62adb83c74bdd54431d3988400b506aaf3a (patch)
tree1ab5fc77b8b94c04f37defb11098f09c09767307
parentlist: Add helpers for listing node devices (diff)
downloadlibvirt-c68cd62adb83c74bdd54431d3988400b506aaf3a.tar.gz
libvirt-c68cd62adb83c74bdd54431d3988400b506aaf3a.tar.bz2
libvirt-c68cd62adb83c74bdd54431d3988400b506aaf3a.zip
list: Implement listAllNodeDevices
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.
-rw-r--r--src/node_device/node_device_driver.c15
-rw-r--r--src/node_device/node_device_driver.h3
-rw-r--r--src/node_device/node_device_hal.c1
-rw-r--r--src/node_device/node_device_udev.c1
4 files changed, 20 insertions, 0 deletions
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index d44924c13..4c6270787 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -183,6 +183,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 6f680a5d8..b34e1af22 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 9d63a2943..273b114bd 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.10.2 */
.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 265cbd4a2..f41910197 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.10.2 */
.deviceLookupByName = nodeDeviceLookupByName, /* 0.7.3 */
.deviceGetXMLDesc = nodeDeviceGetXMLDesc, /* 0.7.3 */
.deviceGetParent = nodeDeviceGetParent, /* 0.7.3 */