c313de
From 0b98a3d385f3d46949c5b2bc15c27c7c62739496 Mon Sep 17 00:00:00 2001
c313de
Message-Id: <0b98a3d385f3d46949c5b2bc15c27c7c62739496@dist-git>
c313de
From: Jiri Denemark <jdenemar@redhat.com>
c313de
Date: Fri, 21 Jun 2019 09:24:59 +0200
c313de
Subject: [PATCH] cpu_x86: Add x86ModelCopySignatures helper
c313de
MIME-Version: 1.0
c313de
Content-Type: text/plain; charset=UTF-8
c313de
Content-Transfer-Encoding: 8bit
c313de
c313de
Introduce a helper for copying CPU signature between two CPU models.
c313de
c313de
It's not very useful until the way we store signatures is changed in the
c313de
next patch.
c313de
c313de
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c313de
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c313de
(cherry picked from commit 2254c1cfb854dfc52f3b4bfdfca2bd995b0a163c)
c313de
c313de
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
c313de
c313de
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c313de
Message-Id: <eb973566dab0f8d77ff536e4c56eb6bffd77928f.1561068591.git.jdenemar@redhat.com>
c313de
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c313de
---
c313de
 src/cpu/cpu_x86.c | 16 +++++++++++++---
c313de
 1 file changed, 13 insertions(+), 3 deletions(-)
c313de
c313de
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
c313de
index 51cb9b7143..e25bc691ae 100644
c313de
--- a/src/cpu/cpu_x86.c
c313de
+++ b/src/cpu/cpu_x86.c
c313de
@@ -977,6 +977,16 @@ x86ModelFree(virCPUx86ModelPtr model)
c313de
 }
c313de
 
c313de
 
c313de
+static int
c313de
+x86ModelCopySignatures(virCPUx86ModelPtr dst,
c313de
+                       virCPUx86ModelPtr src)
c313de
+{
c313de
+    dst->signature = src->signature;
c313de
+
c313de
+    return 0;
c313de
+}
c313de
+
c313de
+
c313de
 static virCPUx86ModelPtr
c313de
 x86ModelCopy(virCPUx86ModelPtr model)
c313de
 {
c313de
@@ -984,13 +994,13 @@ x86ModelCopy(virCPUx86ModelPtr model)
c313de
 
c313de
     if (VIR_ALLOC(copy) < 0 ||
c313de
         VIR_STRDUP(copy->name, model->name) < 0 ||
c313de
+        x86ModelCopySignatures(copy, model) < 0 ||
c313de
         x86DataCopy(&copy->data, &model->data) < 0) {
c313de
         x86ModelFree(copy);
c313de
         return NULL;
c313de
     }
c313de
 
c313de
     copy->vendor = model->vendor;
c313de
-    copy->signature = model->signature;
c313de
 
c313de
     return copy;
c313de
 }
c313de
@@ -1176,8 +1186,8 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
c313de
     }
c313de
 
c313de
     model->vendor = ancestor->vendor;
c313de
-    model->signature = ancestor->signature;
c313de
-    if (x86DataCopy(&model->data, &ancestor->data) < 0)
c313de
+    if (x86ModelCopySignatures(model, ancestor) < 0 ||
c313de
+        x86DataCopy(&model->data, &ancestor->data) < 0)
c313de
         return -1;
c313de
 
c313de
     return 0;
c313de
-- 
c313de
2.22.0
c313de