]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu: Drop unused parameter from cpuDecode
authorJiri Denemark <jdenemar@redhat.com>
Tue, 26 Sep 2017 08:24:05 +0000 (10:24 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 16 Oct 2017 07:21:52 +0000 (09:21 +0200)
The "preferred" parameter is not used by any caller of cpuDecode
anymore. It's only used internally in cpu_x86 to implement cpuBaseline.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/cpu/cpu.c
src/cpu/cpu.h
src/cpu/cpu_ppc64.c
src/cpu/cpu_x86.c
src/libxl/libxl_capabilities.c
src/qemu/qemu_capabilities.c
tests/cputest.c

index 42b836354db1799360fcd1b29e55501e43dd278b..f589666562b2eb5d6940a4eb3dc8b0839d5e9095 100644 (file)
@@ -192,34 +192,27 @@ virCPUCompare(virArch arch,
  * @cpu: CPU definition stub to be filled in
  * @data: internal CPU data to be decoded into @cpu definition
  * @models: list of CPU models that can be considered when decoding @data
- * @preferred: CPU models that should be used if possible
  *
  * Decodes internal CPU data into a CPU definition consisting of a CPU model
  * and a list of CPU features. The @cpu model stub is supposed to have arch,
  * type, match and fallback members set, this function will add the rest. If
  * @models list is NULL, all models supported by libvirt will be considered
  * when decoding the data. In general, this function will select the model
- * closest to the CPU specified by @data unless @preferred is non-NULL, in
- * which case the @preferred model will be used as long as it is compatible
- * with @data.
+ * closest to the CPU specified by @data.
  *
  * For VIR_ARCH_I686 and VIR_ARCH_X86_64 architectures this means the computed
  * CPU definition will have the shortest possible list of additional features.
- * When @preferred is non-NULL, the @preferred model will be used even if
- * other models would result in a shorter list of additional features.
  *
  * Returns 0 on success, -1 on error.
  */
 int
 cpuDecode(virCPUDefPtr cpu,
           const virCPUData *data,
-          virDomainCapsCPUModelsPtr models,
-          const char *preferred)
+          virDomainCapsCPUModelsPtr models)
 {
     struct cpuArchDriver *driver;
 
-    VIR_DEBUG("cpu=%p, data=%p, models=%p, preferred=%s",
-              cpu, data, models, NULLSTR(preferred));
+    VIR_DEBUG("cpu=%p, data=%p, models=%p", cpu, data, models);
     if (models) {
         size_t i;
         for (i = 0; i < models->nmodels; i++)
@@ -243,7 +236,7 @@ cpuDecode(virCPUDefPtr cpu,
         return -1;
     }
 
-    return driver->decode(cpu, data, models, preferred);
+    return driver->decode(cpu, data, models);
 }
 
 
index d325fe3d04bc4aa2a979d90e547a6fa7f556e2be..83d5bcb63f9dca78c42b027bdd9027f12145d85d 100644 (file)
@@ -53,8 +53,7 @@ typedef virCPUCompareResult
 typedef int
 (*cpuArchDecode)    (virCPUDefPtr cpu,
                      const virCPUData *data,
-                     virDomainCapsCPUModelsPtr models,
-                     const char *preferred);
+                     virDomainCapsCPUModelsPtr models);
 
 typedef int
 (*cpuArchEncode)    (virArch arch,
@@ -162,8 +161,7 @@ virCPUCompare(virArch arch,
 int
 cpuDecode   (virCPUDefPtr cpu,
              const virCPUData *data,
-             virDomainCapsCPUModelsPtr models,
-             const char *preferred)
+             virDomainCapsCPUModelsPtr models)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 int
index 902c465cf4c1019dca3f0db2d88a474da56ed697..76582d4083bb23b117a16d7d8e5b04098b8edde4 100644 (file)
@@ -669,8 +669,7 @@ virCPUppc64Compare(virCPUDefPtr host,
 static int
 ppc64DriverDecode(virCPUDefPtr cpu,
                   const virCPUData *data,
-                  virDomainCapsCPUModelsPtr models,
-                  const char *preferred ATTRIBUTE_UNUSED)
+                  virDomainCapsCPUModelsPtr models)
 {
     int ret = -1;
     struct ppc64_map *map;
@@ -741,7 +740,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu,
 #endif
     data->pvr[0].mask = 0xfffffffful;
 
-    ret = ppc64DriverDecode(cpu, cpuData, models, NULL);
+    ret = ppc64DriverDecode(cpu, cpuData, models);
 
  cleanup:
     virCPUppc64DataFree(cpuData);
index 3f9e83ca72588df3268b0b7d5573c45b687ec715..84ec878d1be2f6aaccef7324ee5acc426f41951b 100644 (file)
@@ -1945,10 +1945,9 @@ x86Decode(virCPUDefPtr cpu,
 static int
 x86DecodeCPUData(virCPUDefPtr cpu,
                  const virCPUData *data,
-                 virDomainCapsCPUModelsPtr models,
-                 const char *preferred)
+                 virDomainCapsCPUModelsPtr models)
 {
-    return x86Decode(cpu, &data->data.x86, models, preferred, false);
+    return x86Decode(cpu, &data->data.x86, models, NULL, false);
 }
 
 
@@ -2412,7 +2411,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
         cpuidSet(CPUX86_EXTENDED, cpuData) < 0)
         goto cleanup;
 
-    ret = x86DecodeCPUData(cpu, cpuData, models, NULL);
+    ret = x86DecodeCPUData(cpu, cpuData, models);
 
  cleanup:
     virCPUx86DataFree(cpuData);
index 4def56114334eb187d26635db352def4f955b919..18596c7c72c142ff5ab2b5fa98168a27844bef99 100644 (file)
@@ -192,7 +192,7 @@ libxlCapsInitCPU(virCapsPtr caps, libxl_physinfo *phy_info,
     ret = 0;
 
     if (!(data = libxlCapsNodeData(cpu, phy_info->hw_cap, version)) ||
-        cpuDecode(cpu, data, NULL, NULL) < 0) {
+        cpuDecode(cpu, data, NULL) < 0) {
         VIR_WARN("Failed to initialize host cpu features");
         goto error;
     }
index 4bdc3f26c9d000d64913f3f2d2f4478a0a2a82af..8803980495714abe738decd7f94ace9b2fe86c97 100644 (file)
@@ -3397,9 +3397,7 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
     if (virCPUx86DataSetSignature(data, sigFamily, sigModel) < 0)
         goto cleanup;
 
-    if (cpuDecode(cpu, data,
-                  virQEMUCapsGetCPUDefinitions(qemuCaps, type),
-                  NULL) < 0)
+    if (cpuDecode(cpu, data, virQEMUCapsGetCPUDefinitions(qemuCaps, type)) < 0)
         goto cleanup;
 
     ret = 0;
index 552c07e2c5af9858f009bd1255b1ce69feed20bc..cc95f1d55131f82066927db9abab4c40fb87041b 100644 (file)
@@ -491,7 +491,7 @@ cpuTestCPUID(bool guest, const void *arg)
         cpu->type = VIR_CPU_TYPE_HOST;
     }
 
-    if (cpuDecode(cpu, hostData, NULL, NULL) < 0)
+    if (cpuDecode(cpu, hostData, NULL) < 0)
         goto cleanup;
 
     if (virAsprintf(&result, "cpuid-%s-%s",