]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
list: Implement listAllNodeDevices
authorOsier Yang <jyang@redhat.com>
Wed, 5 Sep 2012 05:34:10 +0000 (13:34 +0800)
committerOsier Yang <jyang@redhat.com>
Mon, 17 Sep 2012 02:40:31 +0000 (10:40 +0800)
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
src/node_device/node_device_driver.h
src/node_device/node_device_hal.c
src/node_device/node_device_udev.c

index d44924c132fe65e5f438472257d08b9e915f2978..4c6270787da20fb9fe1f3c0bc7e42c5bfc4059c4 100644 (file)
@@ -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)
index 6f680a5d81ed25ba6c6a528c55b53e7c73114a49..b34e1af2205c31f217d7be0eafff059069b4b7ec 100644 (file)
@@ -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);
index 9d63a29436a8d945a4a0ab228474b930cff1bda8..273b114bd1b70add2fe7f4f67bc0c3f3c6bccdb8 100644 (file)
@@ -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 */
index 265cbd4a29e4a3f8f4a43d43665ea2a74392d55e..f4191019761d8d499e15998d045a8136adaa0a1c 100644 (file)
@@ -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 */