On Tue, Nov 01, 2022 at 15:43:40 +0100, Michal Prívozník wrote: > On 10/20/22 16:37, Peter Krempa wrote: > > The node device APIs which get XML from the user don't yet support XML > > validation flags. Introduce virNodeDeviceCreateXMLFlags and > > virNodeDeviceDefineXMLFlags with the appropriate flags and add virsh > > support for the new flags. > > > > Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> > > --- > > docs/manpages/virsh.rst | 10 ++++++++-- > > include/libvirt/libvirt-nodedev.h | 19 +++++++++++++++++++ > > src/libvirt-nodedev.c | 4 ++-- > > tools/virsh-nodedev.c | 20 ++++++++++++++++++-- > > 4 files changed, 47 insertions(+), 6 deletions(-) > > > + > > +/** > > + * virNodeDeviceDefineXMLFlags: > > + * > > + * Since: 8.10.0 > > + */ > > +typedef enum { > > + VIR_NODE_DEVICE_DEFINE_XML_VALIDATE = 1 << 0, /* Validate the XML document against schema (Since: 8.10.0) */ > > +} virNodeDeviceDefineXMLFlags; > > + > > I know you already pushed these, but I am just wondering whether we > ought to drop the _XML_ infix as it diverges from the rest of _VALIDATE > flags. > > libvirt.git $ git grep VALIDATE -- include/ | grep _XML_ > include/libvirt/libvirt-nodedev.h: VIR_NODE_DEVICE_CREATE_XML_VALIDATE = 1 << 0, /* Validate the XML document against schema (Since: 8.10.0) */ > include/libvirt/libvirt-nodedev.h: VIR_NODE_DEVICE_DEFINE_XML_VALIDATE = 1 << 0, /* Validate the XML document against schema (Since: 8.10.0) */ The infix was based on the full API name the flags bind to: * 'virNodeDeviceCreateXMLFlags' are for 'virNodeDeviceCreateXML' There is 'virNodeDeviceCreate' which does not take an XML thus in such case I think having the proper full name of the API in the name of the flag should be done to differentiate diverging flags. * 'virNodeDeviceDefineXMLFlags' are for 'virNodeDeviceDefineXML' Now here is no other 'define' API so the XML suffix doesn't differentiate it, but for symmetry IMO the full function name should be the prefix for the flag.