]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu_x86: Add x86ModelCopySignatures helper
authorJiri Denemark <jdenemar@redhat.com>
Mon, 4 Mar 2019 15:18:42 +0000 (16:18 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 5 Mar 2019 13:38:52 +0000 (14:38 +0100)
Introduce a helper for copying CPU signature between two CPU models.

It's not very useful until the way we store signatures is changed in the
next patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/cpu/cpu_x86.c

index 4dd10fb5615758a3904a21501548bf77c4675427..0be1b12cdbd1e3993c784f7e5e1c604926e2d1e8 100644 (file)
@@ -979,6 +979,16 @@ x86ModelFree(virCPUx86ModelPtr model)
 }
 
 
+static int
+x86ModelCopySignatures(virCPUx86ModelPtr dst,
+                       virCPUx86ModelPtr src)
+{
+    dst->signature = src->signature;
+
+    return 0;
+}
+
+
 static virCPUx86ModelPtr
 x86ModelCopy(virCPUx86ModelPtr model)
 {
@@ -986,13 +996,13 @@ x86ModelCopy(virCPUx86ModelPtr model)
 
     if (VIR_ALLOC(copy) < 0 ||
         VIR_STRDUP(copy->name, model->name) < 0 ||
+        x86ModelCopySignatures(copy, model) < 0 ||
         x86DataCopy(&copy->data, &model->data) < 0) {
         x86ModelFree(copy);
         return NULL;
     }
 
     copy->vendor = model->vendor;
-    copy->signature = model->signature;
 
     return copy;
 }
@@ -1178,8 +1188,8 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
     }
 
     model->vendor = ancestor->vendor;
-    model->signature = ancestor->signature;
-    if (x86DataCopy(&model->data, &ancestor->data) < 0)
+    if (x86ModelCopySignatures(model, ancestor) < 0 ||
+        x86DataCopy(&model->data, &ancestor->data) < 0)
         return -1;
 
     return 0;