[PATCH 01/12] tests: Switch to sparse initialization of virCPUDef

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 tests/domaincapstest.c | 38 ++++++++++++++++++++++++--------------
 tests/testutilsqemu.c  | 48 ++++++++++++++++++++----------------------------
 2 files changed, 44 insertions(+), 42 deletions(-)

diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index a4bc8d6d0..462f86801 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -66,10 +66,10 @@ fillAllCaps(virDomainCapsPtr domCaps)
     virDomainCapsDeviceVideoPtr video = &domCaps->video;
     virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev;
     virCPUDef host = {
-        VIR_CPU_TYPE_HOST, 0, 0,
-        VIR_ARCH_X86_64, (char *) "host",
-        NULL, 0, (char *) "CPU Vendorrr",
-        0, 0, 0, 0, 0, NULL,
+        .type = VIR_CPU_TYPE_HOST,
+        .arch = VIR_ARCH_X86_64,
+        .model = (char *) "host",
+        .vendor = (char *) "CPU Vendorrr",
     };
 
     domCaps->maxvcpus = 255;
@@ -119,25 +119,35 @@ fillAllCaps(virDomainCapsPtr domCaps)
 # include "testutilsqemu.h"
 
 static virCPUDef aarch64Cpu = {
-    0, 0, 0, 0, NULL, NULL, 0, NULL, 1, 1, 1, 0, 0, NULL,
+    .sockets = 1,
+    .cores = 1,
+    .threads = 1,
 };
 
 static virCPUDef ppc64leCpu = {
-    VIR_CPU_TYPE_HOST, 0, 0,
-    VIR_ARCH_PPC64LE, (char *) "POWER8",
-    NULL, 0, NULL, 1, 1, 1, 0, 0, NULL,
+    .type = VIR_CPU_TYPE_HOST,
+    .arch = VIR_ARCH_PPC64LE,
+    .model = (char *) "POWER8",
+    .sockets = 1,
+    .cores = 1,
+    .threads = 1,
 };
 
 static virCPUDef x86Cpu = {
-    VIR_CPU_TYPE_HOST, 0, 0,
-    VIR_ARCH_X86_64, (char *) "Broadwell",
-    NULL, 0, NULL, 1, 1, 1, 0, 0, NULL,
+    .type = VIR_CPU_TYPE_HOST,
+    .arch = VIR_ARCH_X86_64,
+    .model = (char *) "Broadwell",
+    .sockets = 1,
+    .cores = 1,
+    .threads = 1,
 };
 
 static virCPUDef s390Cpu = {
-    VIR_CPU_TYPE_HOST, 0, 0,
-    VIR_ARCH_S390X, NULL,
-    NULL, 0, NULL, 1, 1, 1, 0, 0, NULL,
+    .type = VIR_CPU_TYPE_HOST,
+    .arch = VIR_ARCH_S390X,
+    .sockets = 1,
+    .cores = 1,
+    .threads = 1,
 };
 
 static int
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 0726cd317..026b73e9b 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -34,20 +34,16 @@ static virCPUFeatureDef cpuDefaultFeatures[] = {
     { (char *) "lahf_lm",   -1 },
 };
 static virCPUDef cpuDefaultData = {
-    VIR_CPU_TYPE_HOST,      /* type */
-    0,                      /* mode */
-    0,                      /* match */
-    VIR_ARCH_X86_64,        /* arch */
-    (char *) "core2duo",    /* model */
-    NULL,                   /* vendor_id */
-    0,                      /* fallback */
-    (char *) "Intel",       /* vendor */
-    1,                      /* sockets */
-    2,                      /* cores */
-    1,                      /* threads */
-    ARRAY_CARDINALITY(cpuDefaultFeatures), /* nfeatures */
-    ARRAY_CARDINALITY(cpuDefaultFeatures), /* nfeatures_max */
-    cpuDefaultFeatures,     /* features */
+    .type = VIR_CPU_TYPE_HOST,
+    .arch = VIR_ARCH_X86_64,
+    .model = (char *) "core2duo",
+    .vendor = (char *) "Intel",
+    .sockets = 1,
+    .cores = 2,
+    .threads = 1,
+    .nfeatures = ARRAY_CARDINALITY(cpuDefaultFeatures),
+    .nfeatures_max = ARRAY_CARDINALITY(cpuDefaultFeatures),
+    .features = cpuDefaultFeatures,
 };
 
 static virCPUFeatureDef cpuHaswellFeatures[] = {
@@ -77,20 +73,16 @@ static virCPUFeatureDef cpuHaswellFeatures[] = {
     { (char *) "lahf_lm",   -1 },
 };
 static virCPUDef cpuHaswellData = {
-    VIR_CPU_TYPE_HOST,      /* type */
-    0,                      /* mode */
-    0,                      /* match */
-    VIR_ARCH_X86_64,        /* arch */
-    (char *) "Haswell",     /* model */
-    NULL,                   /* vendor_id */
-    0,                      /* fallback */
-    (char *) "Intel",       /* vendor */
-    1,                      /* sockets */
-    2,                      /* cores */
-    2,                      /* threads */
-    ARRAY_CARDINALITY(cpuHaswellFeatures), /* nfeatures */
-    ARRAY_CARDINALITY(cpuHaswellFeatures), /* nfeatures_max */
-    cpuHaswellFeatures,     /* features */
+    .type = VIR_CPU_TYPE_HOST,
+    .arch = VIR_ARCH_X86_64,
+    .model = (char *) "Haswell",
+    .vendor = (char *) "Intel",
+    .sockets = 1,
+    .cores = 2,
+    .threads = 2,
+    .nfeatures = ARRAY_CARDINALITY(cpuHaswellFeatures),
+    .nfeatures_max = ARRAY_CARDINALITY(cpuHaswellFeatures),
+    .features = cpuHaswellFeatures,
 };
 
 static virCPUDef cpuPower8Data = {
-- 
2.12.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux