render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
bba56f
From 53cf8a5c5e91132ac3d12bbe2e611594272bb30a Mon Sep 17 00:00:00 2001
bba56f
Message-Id: <53cf8a5c5e91132ac3d12bbe2e611594272bb30a@dist-git>
bba56f
From: Jiri Denemark <jdenemar@redhat.com>
bba56f
Date: Mon, 4 Mar 2019 16:18:42 +0100
bba56f
Subject: [PATCH] cpu_x86: Add x86ModelCopySignatures helper
bba56f
MIME-Version: 1.0
bba56f
Content-Type: text/plain; charset=UTF-8
bba56f
Content-Transfer-Encoding: 8bit
bba56f
bba56f
Introduce a helper for copying CPU signature between two CPU models.
bba56f
bba56f
It's not very useful until the way we store signatures is changed in the
bba56f
next patch.
bba56f
bba56f
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
bba56f
Reviewed-by: Ján Tomko <jtomko@redhat.com>
bba56f
(cherry picked from commit 2254c1cfb854dfc52f3b4bfdfca2bd995b0a163c)
bba56f
bba56f
https://bugzilla.redhat.com/show_bug.cgi?id=1558558
bba56f
https://bugzilla.redhat.com/show_bug.cgi?id=1687515
bba56f
bba56f
Conflicts:
bba56f
	src/cpu/cpu_x86.c
bba56f
            - other patches separating parts of x86ModelParse into
bba56f
              smaller functions were not backported due to conflicts
bba56f
              with older refactoring which is missing in RHEL-7
bba56f
bba56f
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
bba56f
Reviewed-by: Ján Tomko <jtomko@redhat.com>
bba56f
---
bba56f
 src/cpu/cpu_x86.c | 16 +++++++++++++---
bba56f
 1 file changed, 13 insertions(+), 3 deletions(-)
bba56f
bba56f
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
bba56f
index 668e8aa3f0..e54a3986a1 100644
bba56f
--- a/src/cpu/cpu_x86.c
bba56f
+++ b/src/cpu/cpu_x86.c
bba56f
@@ -1013,6 +1013,16 @@ x86ModelFree(virCPUx86ModelPtr model)
bba56f
 }
bba56f
 
bba56f
 
bba56f
+static int
bba56f
+x86ModelCopySignatures(virCPUx86ModelPtr dst,
bba56f
+                       virCPUx86ModelPtr src)
bba56f
+{
bba56f
+    dst->signature = src->signature;
bba56f
+
bba56f
+    return 0;
bba56f
+}
bba56f
+
bba56f
+
bba56f
 static virCPUx86ModelPtr
bba56f
 x86ModelCopy(virCPUx86ModelPtr model)
bba56f
 {
bba56f
@@ -1020,13 +1030,13 @@ x86ModelCopy(virCPUx86ModelPtr model)
bba56f
 
bba56f
     if (VIR_ALLOC(copy) < 0 ||
bba56f
         VIR_STRDUP(copy->name, model->name) < 0 ||
bba56f
+        x86ModelCopySignatures(copy, model) < 0 ||
bba56f
         x86DataCopy(&copy->data, &model->data) < 0) {
bba56f
         x86ModelFree(copy);
bba56f
         return NULL;
bba56f
     }
bba56f
 
bba56f
     copy->vendor = model->vendor;
bba56f
-    copy->signature = model->signature;
bba56f
 
bba56f
     return copy;
bba56f
 }
bba56f
@@ -1260,8 +1270,8 @@ x86ModelParse(xmlXPathContextPtr ctxt,
bba56f
         VIR_FREE(name);
bba56f
 
bba56f
         model->vendor = ancestor->vendor;
bba56f
-        model->signature = ancestor->signature;
bba56f
-        if (x86DataCopy(&model->data, &ancestor->data) < 0)
bba56f
+        if (x86ModelCopySignatures(model, ancestor) < 0 ||
bba56f
+            x86DataCopy(&model->data, &ancestor->data) < 0)
bba56f
             goto error;
bba56f
     }
bba56f
 
bba56f
-- 
bba56f
2.21.0
bba56f