[PATCH 2/2] qemu: Use ARCH_IS_X86() more

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

 



In a few cases, we checked for VIR_ARCH_X86_64 and
VIR_ARCH_I686 separately: change all those to use the
ARCH_IS_X86() macro instead.
---
 src/qemu/qemu_capabilities.c  | 15 +++++----------
 src/qemu/qemu_parse_command.c |  6 ++----
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ceda769..d9b294f 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -782,8 +782,7 @@ virQEMUCapsProbeCPUModels(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid)
     virQEMUCapsParseCPUModels parse;
     virCommandPtr cmd;
 
-    if (qemuCaps->arch == VIR_ARCH_I686 ||
-        qemuCaps->arch == VIR_ARCH_X86_64) {
+    if (ARCH_IS_X86(qemuCaps->arch)) {
         parse = virQEMUCapsParseX86Models;
     } else if (ARCH_IS_PPC64(qemuCaps->arch)) {
         parse = virQEMUCapsParsePPCModels;
@@ -1039,8 +1038,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
 
     }
 
-    if (((guestarch == VIR_ARCH_I686) ||
-         (guestarch == VIR_ARCH_X86_64)) &&
+    if (ARCH_IS_X86(guestarch) &&
         (virCapabilitiesAddGuestFeature(guest, "acpi", true, true) == NULL ||
          virCapabilitiesAddGuestFeature(guest, "apic", true, false) == NULL))
         goto cleanup;
@@ -3920,14 +3918,12 @@ virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid, const c
      * helper virQEMUCapsHasPCIMultiBus() which keys off the machine
      * stored in virDomainDef and QEMU version number
      */
-    if (qemuCaps->arch == VIR_ARCH_X86_64 ||
-        qemuCaps->arch == VIR_ARCH_I686)
+    if (ARCH_IS_X86(qemuCaps->arch))
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
 
     /* -no-acpi is not supported on non-x86
      * even if qemu reports it in -help */
-    if (qemuCaps->arch != VIR_ARCH_X86_64 &&
-        qemuCaps->arch != VIR_ARCH_I686)
+    if (!ARCH_IS_X86(qemuCaps->arch))
         virQEMUCapsClear(qemuCaps, QEMU_CAPS_NO_ACPI);
 
     /* virQEMUCapsExtractDeviceStr will only set additional caps if qemu
@@ -4034,8 +4030,7 @@ virQEMUCapsInitArchQMPBasic(virQEMUCapsPtr qemuCaps,
      *
      * ACPI/HPET/KVM PIT are also x86 specific
      */
-    if (qemuCaps->arch == VIR_ARCH_X86_64 ||
-        qemuCaps->arch == VIR_ARCH_I686) {
+    if (ARCH_IS_X86(qemuCaps->arch)) {
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI);
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_HPET);
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index a215027..89c7659 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1441,8 +1441,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
             if (*feature == '\0')
                 goto syntax;
 
-            if (dom->os.arch != VIR_ARCH_X86_64 &&
-                dom->os.arch != VIR_ARCH_I686) {
+            if (!ARCH_IS_X86(dom->os.arch)) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("%s platform doesn't support CPU features'"),
                                virArchToString(dom->os.arch));
@@ -1863,8 +1862,7 @@ qemuParseCommandLine(virCapsPtr caps,
     else
         def->os.arch = VIR_ARCH_I686;
 
-    if ((def->os.arch == VIR_ARCH_I686) ||
-        (def->os.arch == VIR_ARCH_X86_64))
+    if (ARCH_IS_X86(def->os.arch))
         def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ON;
 
 #define WANT_VALUE()                                                   \
-- 
2.7.4

--
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