[PATCH 03/11] Add qemuBuildDomainForbidLegacyUSBController

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shorten some long conditions.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 80b05efa03..cce5520783 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3021,6 +3021,18 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
 }
 
 
+static bool
+qemuBuildDomainForbidLegacyUSBController(const virDomainDef *def)
+{
+    if (qemuDomainIsQ35(def) ||
+        qemuDomainIsARMVirt(def) ||
+        qemuDomainIsRISCVVirt(def))
+        return true;
+
+    return false;
+}
+
+
 static int
 qemuBuildLegacyUSBControllerCommandLine(virCommandPtr cmd,
                                         const virDomainDef *def,
@@ -3040,9 +3052,7 @@ qemuBuildLegacyUSBControllerCommandLine(virCommandPtr cmd,
     }
 
     if (usbcontroller == 0 &&
-        !qemuDomainIsQ35(def) &&
-        !qemuDomainIsARMVirt(def) &&
-        !qemuDomainIsRISCVVirt(def) &&
+        !qemuBuildDomainForbidLegacyUSBController(def) &&
         !ARCH_IS_S390(def->os.arch)) {
         /* We haven't added any USB controller yet, but we haven't been asked
          * not to add one either. Add a legacy USB controller, unless we're
@@ -3145,9 +3155,7 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
 
             if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
                 cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT &&
-                !qemuDomainIsQ35(def) &&
-                !qemuDomainIsARMVirt(def) &&
-                !qemuDomainIsRISCVVirt(def)) {
+                !qemuBuildDomainForbidLegacyUSBController(def)) {
 
                 /* An appropriate default USB controller model should already
                  * have been selected in qemuDomainDeviceDefPostParse(); if
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux