conf: move virHostdevIs functions

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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2020-02-16 23:25:26 +01:00
parent a1c2628513
commit 4ccc69707e
5 changed files with 56 additions and 56 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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,

View File

@ -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,