Currently they live in util/virhostdev. However the virhostdev module is wrongly placed in util, which is below conf/ in our hierarchy. Move the functions that are actually used in conf/ to conf/ and remove the include of virhostdev.h from domain_conf. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/conf/domain_conf.c | 44 +++++++++++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 10 +++++++++ src/libvirt_private.syms | 6 +++--- src/util/virhostdev.c | 43 --------------------------------------- src/util/virhostdev.h | 9 -------- 5 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cef49df3f8..fc1e936bd0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -58,7 +58,6 @@ #include "virnetdevtap.h" #include "virnetdevmacvlan.h" #include "virarptable.h" -#include "virhostdev.h" #include "virmdev.h" #include "virdomainsnapshotobjlist.h" #include "virdomaincheckpointobjlist.h" @@ -32034,3 +32033,46 @@ virDomainBlockIoTuneInfoEqual(const virDomainBlockIoTuneInfo *a, a->read_iops_sec_max_length == b->read_iops_sec_max_length && a->write_iops_sec_max_length == b->write_iops_sec_max_length; } + + +/** + * virHostdevIsSCSIDevice: + * @hostdev: host device to check + * + * Returns true if @hostdev is a SCSI device, false otherwise. + */ +bool +virHostdevIsSCSIDevice(const virDomainHostdevDef *hostdev) +{ + return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && + hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI; +} + + +/** + * virHostdevIsMdevDevice: + * @hostdev: host device to check + * + * Returns true if @hostdev is a Mediated device, false otherwise. + */ +bool +virHostdevIsMdevDevice(const virDomainHostdevDef *hostdev) +{ + return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && + hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV; +} + + +/** + * virHostdevIsVFIODevice: + * @hostdev: host device to check + * + * Returns true if @hostdev is a PCI device with VFIO backend, false otherwise. + */ +bool +virHostdevIsVFIODevice(const virDomainHostdevDef *hostdev) +{ + return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && + hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI && + hostdev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO; +} diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cdc4d25700..c126a90729 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3743,3 +3743,13 @@ virDomainBlockIoTuneInfoCopy(const virDomainBlockIoTuneInfo *src, bool virDomainBlockIoTuneInfoEqual(const virDomainBlockIoTuneInfo *a, const virDomainBlockIoTuneInfo *b); + +bool +virHostdevIsSCSIDevice(const virDomainHostdevDef *hostdev) + ATTRIBUTE_NONNULL(1); +bool +virHostdevIsMdevDevice(const virDomainHostdevDef *hostdev) + ATTRIBUTE_NONNULL(1); +bool +virHostdevIsVFIODevice(const virDomainHostdevDef *hostdev) + ATTRIBUTE_NONNULL(1); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 907cef2390..05e1bc875b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -715,6 +715,9 @@ virDomainEventWatchdogNewFromDom; virDomainEventWatchdogNewFromObj; virDomainQemuMonitorEventNew; virDomainQemuMonitorEventStateRegisterID; +virHostdevIsMdevDevice; +virHostdevIsSCSIDevice; +virHostdevIsVFIODevice; # conf/domain_nwfilter.h @@ -2168,9 +2171,6 @@ virHostCPUStatsAssign; # util/virhostdev.h virHostdevFindUSBDevice; -virHostdevIsMdevDevice; -virHostdevIsSCSIDevice; -virHostdevIsVFIODevice; virHostdevManagerGetDefault; virHostdevPCINodeDeviceDetach; virHostdevPCINodeDeviceReAttach; diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index f8f7989206..6565cebe57 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -359,49 +359,6 @@ virHostdevIsPCINetDevice(const virDomainHostdevDef *hostdev) } -/** - * virHostdevIsSCSIDevice: - * @hostdev: host device to check - * - * Returns true if @hostdev is a SCSI device, false otherwise. - */ -bool -virHostdevIsSCSIDevice(const virDomainHostdevDef *hostdev) -{ - return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && - hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI; -} - - -/** - * virHostdevIsMdevDevice: - * @hostdev: host device to check - * - * Returns true if @hostdev is a Mediated device, false otherwise. - */ -bool -virHostdevIsMdevDevice(const virDomainHostdevDef *hostdev) -{ - return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && - hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV; -} - - -/** - * virHostdevIsVFIODevice: - * @hostdev: host device to check - * - * Returns true if @hostdev is a PCI device with VFIO backend, false otherwise. - */ -bool -virHostdevIsVFIODevice(const virDomainHostdevDef *hostdev) -{ - return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && - hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI && - hostdev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO; -} - - static int virHostdevNetConfigVirtPortProfile(const char *linkdev, int vf, const virNetDevVPortProfile *virtPort, diff --git a/src/util/virhostdev.h b/src/util/virhostdev.h index ae84ed3d20..811bda40ed 100644 --- a/src/util/virhostdev.h +++ b/src/util/virhostdev.h @@ -191,15 +191,6 @@ virHostdevReAttachDomainDevices(virHostdevManagerPtr mgr, unsigned int flags, const char *oldStateDir) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); -bool -virHostdevIsSCSIDevice(const virDomainHostdevDef *hostdev) - ATTRIBUTE_NONNULL(1); -bool -virHostdevIsMdevDevice(const virDomainHostdevDef *hostdev) - ATTRIBUTE_NONNULL(1); -bool -virHostdevIsVFIODevice(const virDomainHostdevDef *hostdev) - ATTRIBUTE_NONNULL(1); /* functions used by NodeDevDetach/Reattach/Reset */ int virHostdevPCINodeDeviceDetach(virHostdevManagerPtr mgr, -- 2.24.1