Re: [PATCH v4 1/2] xen_common: Split per-Vif logic from xenParseVif()

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

 



On Thu, Jun 14, 2018 at 06:59:52AM +0200, Fabiano Fidêncio wrote:
xenParseVif() does a lot of stuff and, in order to make things cleaner,
let's split it in two new functions:
- xenParseVif(): it's a new function that keeps the old name. It's
responsible for the whole per-Vif logic from the old xenParseVif();
- xenParseVifList(): it's basically the old xenParsePCI(), but now it
just iterates over the list of Vifs, calling xenParsePCI() per each Vif.

This patch is basically preparing the ground for the future when
typesafe virConf acessors will be used.

Signed-off-by: Fabiano Fidêncio <fabiano@xxxxxxxxxxxx>
---
src/xenconfig/xen_common.c | 358 +++++++++++++++++++++++----------------------
1 file changed, 187 insertions(+), 171 deletions(-)


Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>
With the following diff squashed in, to minimize changes:

Jano

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 02765c540b..4a94127da1 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -984,25 +984,21 @@ xenParseVif(char *entry, const char *vif_typename)
        virStringListFree(ip_list);
    }

-    if (script && script[0]) {
-        if (VIR_STRDUP(net->script, script) < 0)
-            goto cleanup;
-    }
+    if (script && script[0] &&
+        VIR_STRDUP(net->script, script) < 0)
+        goto cleanup;

-    if (model[0]) {
-        if (VIR_STRDUP(net->model, model) < 0)
-            goto cleanup;
-    }
+    if (model[0] &&
+        VIR_STRDUP(net->model, model) < 0)
+        goto cleanup;

-    if (!model[0] && type[0] && STREQ(type, vif_typename)) {
-        if (VIR_STRDUP(net->model, "netfront") < 0)
-            goto cleanup;
-    }
+    if (!model[0] && type[0] && STREQ(type, vif_typename) &&
+        VIR_STRDUP(net->model, "netfront") < 0)
+        goto cleanup;

-    if (vifname[0]) {
-        if (VIR_STRDUP(net->ifname, vifname) < 0)
-            goto cleanup;
-    }
+    if (vifname[0] &&
+        VIR_STRDUP(net->ifname, vifname) < 0)
+        goto cleanup;

    if (rate[0]) {
        virNetDevBandwidthPtr bandwidth;

Attachment: signature.asc
Description: Digital signature

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