On Fri, Mar 26, 2021 at 11:48:00AM -0500, Jonathon Jongsma wrote: > Add two flag values for virConnectListAllNodeDevices() so that we can > list only node devices that are active or inactive. > > Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> > Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx> > --- > include/libvirt/libvirt-nodedev.h | 9 +++-- > src/conf/node_device_conf.h | 8 ++++ > src/conf/virnodedeviceobj.c | 57 +++++++++++++++++----------- > src/libvirt-nodedev.c | 2 + > src/node_device/node_device_driver.c | 2 +- > 5 files changed, 51 insertions(+), 27 deletions(-) > > diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h > index eab8abf6ab..1a0e60b81f 100644 > --- a/include/libvirt/libvirt-nodedev.h > +++ b/include/libvirt/libvirt-nodedev.h > @@ -61,10 +61,9 @@ int virNodeListDevices (virConnectPtr conn, > * virConnectListAllNodeDevices: > * > * Flags used to filter the returned node devices. Flags in each group > - * are exclusive. Currently only one group to filter the devices by cap > - * type. > - */ > + * are exclusive. */ > typedef enum { > + /* filter the devices by cap type */ > VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM = 1 << 0, /* System capability */ > VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV = 1 << 1, /* PCI device */ > VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV = 1 << 2, /* USB device */ > @@ -86,6 +85,10 @@ typedef enum { > VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD = 1 << 18, /* s390 AP Card device */ > VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE = 1 << 19, /* s390 AP Queue */ > VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX = 1 << 20, /* s390 AP Matrix */ > + > + /* filter the devices by active state */ > + VIR_CONNECT_LIST_NODE_DEVICES_INACTIVE = 1 << 30, /* Inactive devices */ > + VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE = 1U << 31, /* Active devices */ > } virConnectListAllNodeDeviceFlags; > > int virConnectListAllNodeDevices (virConnectPtr conn, > diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h > index c67b8e2aeb..3d7872fd6e 100644 > --- a/src/conf/node_device_conf.h > +++ b/src/conf/node_device_conf.h > @@ -422,6 +422,14 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps); > VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE | \ > VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX) > > +#define VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_ACTIVE \ > + VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE |\ nitpick: 1 extra white space ^here My R-b still stands. Erik