render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
a41c76
From 693d01f00b9608a4f4cac3b91e38b5537eff754f Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <693d01f00b9608a4f4cac3b91e38b5537eff754f@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:59:28 +0200
a41c76
Subject: [PATCH] cpu_x86: Move and rename x86ModelHasSignature
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Later in this series the function will work on a newly introduced
a41c76
virCPUx86Signatures structure. Let's move it to the place were all
a41c76
related functions will be added and rename the function as
a41c76
virCPUx86SignaturesMatch for easier review of the virCPUx86Signatures
a41c76
patch.
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 782be9f0af2e02e725fca45b7674e8b2f008dc6c)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <7662ee03449ae588a5381c546eb7e8a3b64cadb3.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu_x86.c | 38 +++++++++++++++++++-------------------
a41c76
 1 file changed, 19 insertions(+), 19 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
a41c76
index 16e6aa73d2..65a99876a9 100644
a41c76
--- a/src/cpu/cpu_x86.c
a41c76
+++ b/src/cpu/cpu_x86.c
a41c76
@@ -1110,6 +1110,21 @@ virCPUx86SignaturesCopy(virCPUx86ModelPtr dst,
a41c76
 }
a41c76
 
a41c76
 
a41c76
+static bool
a41c76
+virCPUx86SignaturesMatch(virCPUx86ModelPtr model,
a41c76
+                         uint32_t signature)
a41c76
+{
a41c76
+    size_t i;
a41c76
+
a41c76
+    for (i = 0; i < model->nsignatures; i++) {
a41c76
+        if (model->signatures[i] == signature)
a41c76
+            return true;
a41c76
+    }
a41c76
+
a41c76
+    return false;
a41c76
+}
a41c76
+
a41c76
+
a41c76
 static void
a41c76
 x86ModelFree(virCPUx86ModelPtr model)
a41c76
 {
a41c76
@@ -1875,21 +1890,6 @@ virCPUx86Compare(virCPUDefPtr host,
a41c76
 }
a41c76
 
a41c76
 
a41c76
-static bool
a41c76
-x86ModelHasSignature(virCPUx86ModelPtr model,
a41c76
-                     uint32_t signature)
a41c76
-{
a41c76
-    size_t i;
a41c76
-
a41c76
-    for (i = 0; i < model->nsignatures; i++) {
a41c76
-        if (model->signatures[i] == signature)
a41c76
-            return true;
a41c76
-    }
a41c76
-
a41c76
-    return false;
a41c76
-}
a41c76
-
a41c76
-
a41c76
 static char *
a41c76
 x86FormatSignatures(virCPUx86ModelPtr model)
a41c76
 {
a41c76
@@ -1961,8 +1961,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
a41c76
      * consider candidates with matching family/model.
a41c76
      */
a41c76
     if (signature &&
a41c76
-        x86ModelHasSignature(current, signature) &&
a41c76
-        !x86ModelHasSignature(candidate, signature)) {
a41c76
+        virCPUx86SignaturesMatch(current, signature) &&
a41c76
+        !virCPUx86SignaturesMatch(candidate, signature)) {
a41c76
         VIR_DEBUG("%s differs in signature from matching %s",
a41c76
                   cpuCandidate->model, cpuCurrent->model);
a41c76
         return 0;
a41c76
@@ -1978,8 +1978,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
a41c76
      * result in longer list of features.
a41c76
      */
a41c76
     if (signature &&
a41c76
-        x86ModelHasSignature(candidate, signature) &&
a41c76
-        !x86ModelHasSignature(current, signature)) {
a41c76
+        virCPUx86SignaturesMatch(candidate, signature) &&
a41c76
+        !virCPUx86SignaturesMatch(current, signature)) {
a41c76
         VIR_DEBUG("%s provides matching signature", cpuCandidate->model);
a41c76
         return 1;
a41c76
     }
a41c76
-- 
a41c76
2.26.2
a41c76