diff mbox series

[3/4] libxl: Break out libxlCapsHasPVUSB

Message ID 3df61f42f2554e33b46635c71a6fbf7a1734da3e.1549665763.git.crobinso@redhat.com
State Accepted
Commit b99fdb60b20052eea91c232a765f8f907a67da30
Headers show
Series libxl: override HAVE_PVUSB in test suite | expand

Commit Message

Cole Robinson Feb. 8, 2019, 10:47 p.m. UTC
No functional change, but this will allow us to mock out the function
in the test suite

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/libxl/libxl_capabilities.c | 16 ++++++++++++----
 src/libxl/libxl_capabilities.h |  1 +
 2 files changed, 13 insertions(+), 4 deletions(-)

-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index 111fb462e4..cc42dc6987 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -671,6 +671,15 @@  libxlMakeDomainDeviceVideoCaps(virDomainCapsDeviceVideoPtr dev)
     return 0;
 }
 
+bool libxlCapsHasPVUSB(void)
+{
+#ifdef LIBXL_HAVE_PVUSB
+    return true;
+#else
+    return false;
+#endif
+}
+
 static int
 libxlMakeDomainDeviceHostdevCaps(virDomainCapsDeviceHostdevPtr dev)
 {
@@ -688,10 +697,9 @@  libxlMakeDomainDeviceHostdevCaps(virDomainCapsDeviceHostdevPtr dev)
     VIR_DOMAIN_CAPS_ENUM_SET(dev->subsysType,
                              VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI);
 
-#ifdef LIBXL_HAVE_PVUSB
-    VIR_DOMAIN_CAPS_ENUM_SET(dev->subsysType,
-                             VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB);
-#endif
+    if (libxlCapsHasPVUSB())
+        VIR_DOMAIN_CAPS_ENUM_SET(dev->subsysType,
+                                 VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB);
 
     /* No virDomainHostdevCapsType for libxl */
     virDomainCapsEnumClear(&dev->capsType);
diff --git a/src/libxl/libxl_capabilities.h b/src/libxl/libxl_capabilities.h
index be41682206..a0b9c10653 100644
--- a/src/libxl/libxl_capabilities.h
+++ b/src/libxl/libxl_capabilities.h
@@ -40,6 +40,7 @@ 
  * by libvirt for Xen, and cannot be used for a persistent network name.  */
 # define LIBXL_GENERATED_PREFIX_XEN "vif"
 
+bool libxlCapsHasPVUSB(void);
 
 virCapsPtr
 libxlMakeCapabilities(libxl_ctx *ctx);