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

[libvirt] [PATCH 4/3] Remove arch parameter from cpuHasFeature()



---
This patch should be squashed in 3/3.

 src/cpu/cpu.c            | 10 ++++------
 src/cpu/cpu.h            |  3 +--
 src/qemu/qemu_command.c  |  4 ++--
 src/vmware/vmware_conf.c |  6 +++---
 tests/cputest.c          |  2 +-
 5 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index a4e1840..4124354 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -418,22 +418,20 @@ cpuUpdate(virCPUDefPtr guest,
 }
 
 int
-cpuHasFeature(virArch arch,
-              const virCPUDataPtr data,
+cpuHasFeature(const virCPUDataPtr data,
               const char *feature)
 {
     struct cpuArchDriver *driver;
 
-    VIR_DEBUG("arch=%s, data=%p, feature=%s",
-              virArchToString(arch), data, feature);
+    VIR_DEBUG("data=%p, feature=%s", data, feature);
 
-    if ((driver = cpuGetSubDriver(arch)) == NULL)
+    if ((driver = cpuGetSubDriver(data->arch)) == NULL)
         return -1;
 
     if (driver->hasFeature == NULL) {
         virReportError(VIR_ERR_NO_SUPPORT,
                        _("cannot check guest CPU data for %s architecture"),
-                       virArchToString(arch));
+                       virArchToString(data->arch));
         return -1;
     }
 
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 1feca82..4003435 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -162,8 +162,7 @@ cpuUpdate   (virCPUDefPtr guest,
              const virCPUDefPtr host);
 
 extern int
-cpuHasFeature(virArch arch,
-              const virCPUDataPtr data,
+cpuHasFeature(const virCPUDataPtr data,
               const char *feature);
 
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a7c978f..602bdec 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5712,7 +5712,7 @@ qemuBuildCpuArgStr(const virQEMUDriverPtr driver,
         /* Only 'svm' requires --enable-nesting. The nested
          * 'vmx' patches now simply hook off the CPU features
          */
-        hasSVM = cpuHasFeature(host->arch, data, "svm");
+        hasSVM = cpuHasFeature(data, "svm");
         if (hasSVM < 0)
             goto cleanup;
         *hasHwVirt = hasSVM > 0 ? true : false;
@@ -9907,7 +9907,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
                           NULL, NULL, NULL, NULL) < 0)
                 goto cleanup;
 
-            is_32bit = (cpuHasFeature(VIR_ARCH_X86_64, cpuData, "lm") != 1);
+            is_32bit = (cpuHasFeature(cpuData, "lm") != 1);
             cpuDataFree(cpuData);
         } else if (model) {
             is_32bit = STREQ(model, "qemu32");
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 6ef02a9..7734872 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -97,9 +97,9 @@ vmwareCapsInit(void)
      *  - Host CPU is x86_64 with virtualization extensions
      */
     if (caps->host.arch == VIR_ARCH_X86_64 ||
-        (cpuHasFeature(caps->host.arch, data, "lm") &&
-         (cpuHasFeature(caps->host.arch, data, "vmx") ||
-          cpuHasFeature(caps->host.arch, data, "svm")))) {
+        (cpuHasFeature(data, "lm") &&
+         (cpuHasFeature(data, "vmx") ||
+          cpuHasFeature(data, "svm")))) {
 
         if ((guest = virCapabilitiesAddGuest(caps,
                                              "hvm",
diff --git a/tests/cputest.c b/tests/cputest.c
index 803e395..2e5f0cd 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -426,7 +426,7 @@ cpuTestHasFeature(const void *arg)
                   NULL, NULL, NULL, NULL) < 0)
         goto cleanup;
 
-    result = cpuHasFeature(host->arch, hostData, data->name);
+    result = cpuHasFeature(hostData, data->name);
     if (data->result == -1)
         virResetLastError();
 
-- 
1.8.3.2


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