render / rpms / libvirt

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