From: Ján Tomko Date: Tue, 15 Jan 2019 15:08:48 +0000 (+0100) Subject: Add qemuBuildDomainForbidLegacyUSBController X-Git-Tag: v5.1.0-rc1~369 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95049d70540ef2c9cc5bcfd96f33d28a00fd95dd;p=thirdparty%2Flibvirt.git Add qemuBuildDomainForbidLegacyUSBController Shorten some long conditions. Signed-off-by: Ján Tomko Reviewed-by: Cole Robinson --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e108ad1e86..82c2a47f5e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3049,6 +3049,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, @@ -3068,9 +3080,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 @@ -3173,9 +3183,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