]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu, libxl, hypervisor: use virDomainDriverNodeDeviceDetachFlags() helper
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Sat, 30 Jan 2021 17:23:41 +0000 (14:23 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 17 Feb 2021 18:56:27 +0000 (15:56 -0300)
commit887dd0d331e43dc124a858514ab246ecbc18518e
tree1a21e0ddfd293300dfa1a419724f70fde2152da6
parent76f47889326c45d2732711bc6dd5751aaf6e5194
qemu, libxl, hypervisor: use virDomainDriverNodeDeviceDetachFlags() helper

libxlNodeDeviceDetachFlags() and qemuNodeDeviceDetachFlags() are mostly
equal, aside from how the virHostdevmanager pointer is retrieved and
the PCI stub driver used.

Now that the PCI stub driver verification is done early in both functions,
we can use the virDomainDriverNodeDeviceDetachFlags() helper to reduce
code duplication between them. 'driverName' is checked inside the helper
to set the appropriate stub driver.

The helper is named with the 'Flags' suffix, even when the helper itself
isn't receiving the flags from the callers, to be compliant with the
ACL function virNodeDeviceDetachFlagsEnsureACL() that is being called
inside it and was called from the original functions. Renaming the helper
would implicate in renaming REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS, and all the
related structs inside remote_protocol.x, to be compliant with the ACL
rules.

This is not being checked at this moment, but we'll fix check-aclrules.py to
verify all the helpers that calls ACL functions in domain_driver.c shortly.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/hypervisor/domain_driver.c
src/hypervisor/domain_driver.h
src/libvirt_private.syms
src/libxl/libxl_driver.c
src/qemu/qemu_driver.c