}
+typedef virNodeDevicePtr (*nodeDeviceFindNewDeviceFunc)(virConnectPtr conn,
+ const void* opaque);
+
+
/* When large numbers of devices are present on the host, it's
* possible for udev not to realize that it has work to do before we
* get here. We thus keep trying to find the new device we just
*/
static virNodeDevicePtr
nodeDeviceFindNewDevice(virConnectPtr conn,
- const char *wwnn,
- const char *wwpn)
+ nodeDeviceFindNewDeviceFunc func,
+ const void *opaque)
{
virNodeDevicePtr device = NULL;
time_t start = 0, now = 0;
virWaitForDevices();
- device = nodeDeviceLookupSCSIHostByWWN(conn, wwnn, wwpn, 0);
+ device = func(conn, opaque);
if (device != NULL)
break;
}
+typedef struct _NewSCSIHostFuncData NewSCSIHostFuncData;
+struct _NewSCSIHostFuncData
+{
+ const char *wwnn;
+ const char *wwpn;
+};
+
+
+static virNodeDevicePtr
+nodeDeviceFindNewSCSIHostFunc(virConnectPtr conn,
+ const void *opaque)
+{
+ const NewSCSIHostFuncData *data = opaque;
+
+ 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};
+
+ return nodeDeviceFindNewDevice(conn, nodeDeviceFindNewSCSIHostFunc, &data);
+}
+
+
static bool
nodeDeviceHasCapability(virNodeDeviceDefPtr def, virNodeDevCapType type)
{
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_CREATE) < 0)
return NULL;
- device = nodeDeviceFindNewDevice(conn, wwnn, wwpn);
+ device = nodeDeviceFindNewSCSIHost(conn, wwnn, wwpn);
/* We don't check the return value, because one way or another,
* we're returning what we get... */