[PATCHv2 1/5] conf: use a unique data type for PF array in virDomainNetDef

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

 



This array was originally defined using the existing
virNetworkForwardIfDef, but that struct has a UsageCount field that
isn't used in the case of PFs. This patch just copies that struct and
removes UsageCount. It ends up being a struct with a single field, but
I left it as a struct in case we need to add other fields to it in the
future.
---
 src/conf/network_conf.c | 9 +++++++--
 src/conf/network_conf.h | 8 +++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 783c388..666118c 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -97,6 +97,12 @@ virNetworkForwardIfDefClear(virNetworkForwardIfDefPtr def)
     VIR_FREE(def->dev);
 }
 
+static void
+virNetworkForwardPfDefClear(virNetworkForwardPfDefPtr def)
+{
+    VIR_FREE(def->dev);
+}
+
 static void virNetworkIpDefClear(virNetworkIpDefPtr def)
 {
     int ii;
@@ -157,7 +163,7 @@ void virNetworkDefFree(virNetworkDefPtr def)
     VIR_FREE(def->domain);
 
     for (ii = 0 ; ii < def->nForwardPfs && def->forwardPfs ; ii++) {
-        virNetworkForwardIfDefClear(&def->forwardPfs[ii]);
+        virNetworkForwardPfDefClear(&def->forwardPfs[ii]);
     }
     VIR_FREE(def->forwardPfs);
 
@@ -1113,7 +1119,6 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
                 goto error;
             }
 
-            def->forwardPfs->usageCount = 0;
             def->forwardPfs->dev = forwardDev;
             forwardDev = NULL;
             def->nForwardPfs++;
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index a95b382..040d912 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -135,6 +135,12 @@ struct _virNetworkForwardIfDef {
     int usageCount; /* how many guest interfaces are bound to this device? */
 };
 
+typedef struct _virNetworkForwardPfDef virNetworkForwardPfDef;
+typedef virNetworkForwardPfDef *virNetworkForwardPfDefPtr;
+struct _virNetworkForwardPfDef {
+    char *dev;      /* name of device */
+};
+
 typedef struct _virPortGroupDef virPortGroupDef;
 typedef virPortGroupDef *virPortGroupDefPtr;
 struct _virPortGroupDef {
@@ -164,7 +170,7 @@ struct _virNetworkDef {
      * interfaces), they will be listed here.
      */
     size_t nForwardPfs;
-    virNetworkForwardIfDefPtr forwardPfs;
+    virNetworkForwardPfDefPtr forwardPfs;
 
     size_t nForwardIfs;
     virNetworkForwardIfDefPtr forwardIfs;
-- 
1.7.11.2

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