[PATCH 2/2] Simplify condition for formatting CPU features

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

 



Commit adff345 added support for features to MODE_HOSTPASSTHROUGH
as well. Since we support all modes now, the condition can be
eliminated.
---
 src/conf/cpu_conf.c | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

Mostly whitespace changes.

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index d6d579f..4a367a1 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -660,32 +660,30 @@ virCPUDefFormatBuf(virBufferPtr buf,
         virBufferAddLit(buf, "/>\n");
     }
 
-    if (formatModel || def->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) {
-        for (i = 0; i < def->nfeatures; i++) {
-            virCPUFeatureDefPtr feature = def->features + i;
+    for (i = 0; i < def->nfeatures; i++) {
+        virCPUFeatureDefPtr feature = def->features + i;
 
-            if (!feature->name) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Missing CPU feature name"));
-                return -1;
-            }
+        if (!feature->name) {
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("Missing CPU feature name"));
+            return -1;
+        }
 
-            if (def->type == VIR_CPU_TYPE_GUEST) {
-                const char *policy;
+        if (def->type == VIR_CPU_TYPE_GUEST) {
+            const char *policy;
 
-                policy = virCPUFeaturePolicyTypeToString(feature->policy);
-                if (!policy) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unexpected CPU feature policy %d"),
-                                   feature->policy);
-                    return -1;
-                }
-                virBufferAsprintf(buf, "<feature policy='%s' name='%s'/>\n",
-                                  policy, feature->name);
-            } else {
-                virBufferAsprintf(buf, "<feature name='%s'/>\n",
-                                  feature->name);
+            policy = virCPUFeaturePolicyTypeToString(feature->policy);
+            if (!policy) {
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("Unexpected CPU feature policy %d"),
+                               feature->policy);
+                return -1;
             }
+            virBufferAsprintf(buf, "<feature policy='%s' name='%s'/>\n",
+                              policy, feature->name);
+        } else {
+            virBufferAsprintf(buf, "<feature name='%s'/>\n",
+                              feature->name);
         }
     }
 
-- 
2.0.4

--
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]