mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
virhostdev.c: add virHostdevIsPCIDevice() helper
Add a helper to quickly determine if a hostdev is a PCI device, instead of doing a tedious 'if' check with hostdev mode and subsys type. Reviewed-by: Laine Stump <laine@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
953be56eea
commit
a8017c6882
@ -347,12 +347,18 @@ virHostdevNetDevice(virDomainHostdevDefPtr hostdev,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
virHostdevIsPCIDevice(const virDomainHostdevDef *hostdev)
|
||||
{
|
||||
return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
virHostdevIsPCINetDevice(const virDomainHostdevDef *hostdev)
|
||||
{
|
||||
return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
||||
hostdev->parentnet != NULL;
|
||||
return virHostdevIsPCIDevice(hostdev) && hostdev->parentnet != NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -233,3 +233,5 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManagerPtr hostdev_mgr,
|
||||
const char *dom_name,
|
||||
virDomainDiskDefPtr *disks,
|
||||
size_t ndisks);
|
||||
|
||||
bool virHostdevIsPCIDevice(const virDomainHostdevDef *hostdev);
|
||||
|
@ -1526,6 +1526,7 @@ virCloseCallbacksUnset;
|
||||
|
||||
# hypervisor/virhostdev.h
|
||||
virHostdevFindUSBDevice;
|
||||
virHostdevIsPCIDevice;
|
||||
virHostdevManagerGetDefault;
|
||||
virHostdevPCINodeDeviceDetach;
|
||||
virHostdevPCINodeDeviceReAttach;
|
||||
|
Loading…
Reference in New Issue
Block a user