render / rpms / libvirt

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