提交 20bf8ea6 编写于 作者: M Marc Hartmayer 提交者: Michal Privoznik

util: Add virHostdevIsSCSIDevice()

Add the function virHostdevIsSCSIDevice() which detects whether a
hostdev is a SCSI device or not.
Signed-off-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: NBjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
上级 505bc9b0
......@@ -1677,6 +1677,7 @@ virHookPresent;
# util/virhostdev.h
virHostdevFindUSBDevice;
virHostdevIsSCSIDevice;
virHostdevManagerGetDefault;
virHostdevPCINodeDeviceDetach;
virHostdevPCINodeDeviceReAttach;
......
......@@ -337,6 +337,20 @@ virHostdevIsPCINetDevice(virDomainHostdevDefPtr hostdev)
}
/**
* virHostdevIsSCSIDevice:
* @hostdev: host device to check
*
* Returns true if @hostdev is a SCSI device, false otherwise.
*/
bool
virHostdevIsSCSIDevice(virDomainHostdevDefPtr hostdev)
{
return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI;
}
static int
virHostdevNetConfigVirtPortProfile(const char *linkdev, int vf,
virNetDevVPortProfilePtr virtPort,
......
......@@ -149,6 +149,9 @@ virHostdevReAttachDomainDevices(virHostdevManagerPtr mgr,
unsigned int flags,
const char *oldStateDir)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
bool
virHostdevIsSCSIDevice(virDomainHostdevDefPtr hostdev)
ATTRIBUTE_NONNULL(1);
/* functions used by NodeDevDetach/Reattach/Reset */
int virHostdevPCINodeDeviceDetach(virHostdevManagerPtr mgr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册