On 03/26/2015 04:05 PM, Neel Basu wrote:
Hi,
virConnectListAllNodeDevices() takes a virNodeDevicePtr **devices. So
I need to create an array of virNodeDevicePtr. For that I need to know
size / Number of devices. What is the function for that ?
No, that is incorrect.
http://www.libvirt.org/html/libvirt-libvirt-nodedev.html#virConnectListAl...
virConnectListAllNodeDevices() 1) allocates the memory for you (you must
later free it with iterated calls to virNodeDeviceFree()), and 2) the
return value of the API is the number of node devices that were found
(i.e. how many elements are in the array), or -1 if there was an error.