render / rpms / libvirt

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