On 08/05/2016 01:10 AM, Cédric Bosdonnat wrote:
Finding an USB device from the vendor/device values will be needed
by libxl driver to convert from vendor/device to bus/dev addresses.
---
src/libvirt_private.syms | 1 +
src/util/virhostdev.c | 2 +-
src/util/virhostdev.h | 6 ++++++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 419c33d..de8b1fe 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1646,6 +1646,7 @@ virHookPresent;
# util/virhostdev.h
+virHostdevFindUSBDevice;
virHostdevManagerGetDefault;
virHostdevPCINodeDeviceDetach;
virHostdevPCINodeDeviceReAttach;
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 9b5ca6f..9c2262e 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -1178,7 +1178,7 @@ virHostdevMarkUSBDevices(virHostdevManagerPtr mgr,
}
-static int
+int
virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
bool mandatory,
virUSBDevicePtr *usb)
diff --git a/src/util/virhostdev.h b/src/util/virhostdev.h
index c451981..9bb582b 100644
--- a/src/util/virhostdev.h
+++ b/src/util/virhostdev.h
@@ -66,6 +66,12 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
unsigned int flags)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4);
+
+int
+virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
+ bool mandatory,
+ virUSBDevicePtr *usb)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
ATTRIBUTE_NONNULL(2) is not needed.
I'm fine with exporting this function from virhostdev, but I'd like to hear what
others think since it has some interesting side-affects such as modifying
hostdev->source.subsys.u.usb if the device is found by vendor. My first thought
is that such behavior is internal to the virhostdev module, but populating
hostdev->source.subsys.u.usb->{bus,device} when called externally may be fine.
Regards,
Jim