
On 4/30/20 11:42 PM, Jonathon Jongsma wrote:
Currently nodeDeviceCreateXML() and nodeDeviceDestroy() only support NPIV HBAs, but we want to be able to create mdev devices as well. This is a first step to enabling that support.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> --- src/node_device/node_device_driver.c | 90 ++++++++++++++++++---------- 1 file changed, 57 insertions(+), 33 deletions(-)
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index ee175e1095..6a96a77d92 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -487,6 +487,20 @@ nodeDeviceFindNewDevice(virConnectPtr conn, return device; }
+static bool +nodeDeviceHasCapability(virNodeDeviceDefPtr def, virNodeDevCapType type) +{ + virNodeDevCapsDefPtr cap = NULL; + + cap = def->caps;
This variable can be initialized to def->caps directly. No need to go through NULL, IMO.
+ while (cap != NULL) { + if (cap->data.type == type) + return true; + cap = cap->next; + } + + return false; +}
Also, here and for the rest of the patchset - the file uses two spaces between functions. Please keep that. Michal