[libvirt PATCH v3 04/11] nodedev: refactor nodeDeviceFindNewDevice()

Erik Skultety eskultet at redhat.com
Tue Jun 16 17:00:15 UTC 2020


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 at 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 at redhat.com>




More information about the libvir-list mailing list