
On Tue, Jun 16, 2020 at 09:27:52AM -0500, Jonathon Jongsma wrote:
In preparation for creating mediated devices in libvirt, we will need to wait for new mediated devices to be created as well. Refactor nodeDeviceFindNewDevice() so that we can re-use the main logic from this function to wait for different device types by passing a different 'find' function.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> --- ... + +static virNodeDevicePtr +nodeDeviceFindNewSCSIHostFunc(virConnectPtr conn, + const void *opaque) +{ + const NewSCSIHostFuncData *data = opaque;
Technically, there should be an empty line here since ^here we're defining a variable.
+ return nodeDeviceLookupSCSIHostByWWN(conn, data->wwnn, data->wwpn, 0); +} + + +static virNodeDevicePtr +nodeDeviceFindNewSCSIHost(virConnectPtr conn, + const char *wwnn, + const char *wwpn) +{ + NewSCSIHostFuncData data = { .wwnn = wwnn, .wwpn = wwpn};
...same here...
+ return nodeDeviceFindNewDevice(conn, nodeDeviceFindNewSCSIHostFunc, &data); +}
Reviewed-by: Erik Skultety <eskultet@redhat.com>