[libvirt] [PATCH 03/14] nwfilter: remove virNWFilterHashTable typedefs entirely

Daniel P. Berrangé posted 14 patches 6 years, 7 months ago
There is a newer version of this series
[libvirt] [PATCH 03/14] nwfilter: remove virNWFilterHashTable typedefs entirely
Posted by Daniel P. Berrangé 6 years, 7 months ago
All the code now just uses the virHashTablePtr type directly.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/conf/domain_conf.c                 |  2 +-
 src/conf/domain_conf.h                 |  2 +-
 src/conf/nwfilter_conf.h               |  2 +-
 src/conf/nwfilter_ipaddrmap.c          |  2 +-
 src/conf/nwfilter_params.c             | 26 ++++++++++-----------
 src/conf/nwfilter_params.h             | 23 ++++++++-----------
 src/nwfilter/nwfilter_dhcpsnoop.c      |  6 ++---
 src/nwfilter/nwfilter_dhcpsnoop.h      |  2 +-
 src/nwfilter/nwfilter_gentech_driver.c | 42 +++++++++++++++++-----------------
 src/nwfilter/nwfilter_gentech_driver.h |  4 ++--
 src/nwfilter/nwfilter_learnipaddr.c    |  6 ++---
 src/nwfilter/nwfilter_learnipaddr.h    |  4 ++--
 src/nwfilter/nwfilter_tech_driver.h    |  2 +-
 tests/nwfilterxml2firewalltest.c       | 24 +++++++++----------
 14 files changed, 72 insertions(+), 75 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 627058a144..bdda11c599 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10868,7 +10868,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
     char *vhostuser_type = NULL;
     char *trustGuestRxFilters = NULL;
     char *vhost_path = NULL;
-    virNWFilterHashTablePtr filterparams = NULL;
+    virHashTablePtr filterparams = NULL;
     virDomainActualNetDefPtr actual = NULL;
     xmlNodePtr oldnode = ctxt->node;
     virDomainChrSourceReconnectDef reconnect = {0};
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3c7eccb8ca..b954f4d462 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1057,7 +1057,7 @@ struct _virDomainNetDef {
     virNetDevIPInfo guestIP;
     virDomainDeviceInfo info;
     char *filter;
-    virNWFilterHashTablePtr filterparams;
+    virHashTablePtr filterparams;
     virNetDevBandwidthPtr bandwidth;
     virNetDevVlan vlan;
     int trustGuestRxFilters; /* enum virTristateBool */
diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index f960bf3d56..a31db6d3ff 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -501,7 +501,7 @@ typedef struct _virNWFilterIncludeDef virNWFilterIncludeDef;
 typedef virNWFilterIncludeDef *virNWFilterIncludeDefPtr;
 struct _virNWFilterIncludeDef {
     char *filterref;
-    virNWFilterHashTablePtr params;
+    virHashTablePtr params;
 };
 
 
diff --git a/src/conf/nwfilter_ipaddrmap.c b/src/conf/nwfilter_ipaddrmap.c
index a921d7cfd6..14a62c1a74 100644
--- a/src/conf/nwfilter_ipaddrmap.c
+++ b/src/conf/nwfilter_ipaddrmap.c
@@ -36,7 +36,7 @@
 #define VIR_FROM_THIS VIR_FROM_NWFILTER
 
 static virMutex ipAddressMapLock = VIR_MUTEX_INITIALIZER;
-static virNWFilterHashTablePtr ipAddressMap;
+static virHashTablePtr ipAddressMap;
 
 
 /* Add an IP address to the list of IP addresses an interface is
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index ee9c063941..ffffc6bae8 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -348,7 +348,7 @@ virNWFilterVarCombIterEntryInit(virNWFilterVarCombIterEntryPtr cie,
 
 static int
 virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
-                                  virNWFilterHashTablePtr hash,
+                                  virHashTablePtr hash,
                                   const virNWFilterVarAccess *varAccess)
 {
     virNWFilterVarValuePtr varValue;
@@ -415,7 +415,7 @@ virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
  */
 static bool
 virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
-                                            virNWFilterHashTablePtr hash)
+                                            virHashTablePtr hash)
 {
     size_t i, j;
     virNWFilterVarValuePtr varValue, tmp;
@@ -473,7 +473,7 @@ virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
  * be created.
  */
 virNWFilterVarCombIterPtr
-virNWFilterVarCombIterCreate(virNWFilterHashTablePtr hash,
+virNWFilterVarCombIterCreate(virHashTablePtr hash,
                              virNWFilterVarAccessPtr *varAccess,
                              size_t nVarAccess)
 {
@@ -631,14 +631,14 @@ hashDataFree(void *payload, const void *name ATTRIBUTE_UNUSED)
 }
 
 
-virNWFilterHashTablePtr
+virHashTablePtr
 virNWFilterHashTableCreate(int n)
 {
     return virHashCreate(n, hashDataFree);
 }
 
 struct addToTableStruct {
-    virNWFilterHashTablePtr target;
+    virHashTablePtr target;
     int errOccurred;
 };
 
@@ -668,8 +668,8 @@ addToTable(void *payload, const void *name, void *data)
 
 
 int
-virNWFilterHashTablePutAll(virNWFilterHashTablePtr src,
-                           virNWFilterHashTablePtr dest)
+virNWFilterHashTablePutAll(virHashTablePtr src,
+                           virHashTablePtr dest)
 {
     struct addToTableStruct atts = {
         .target = dest,
@@ -698,8 +698,8 @@ virNWFilterVarValueCompare(const void *a, const void *b)
 }
 
 bool
-virNWFilterHashTableEqual(virNWFilterHashTablePtr a,
-                          virNWFilterHashTablePtr b)
+virNWFilterHashTableEqual(virHashTablePtr a,
+                          virHashTablePtr b)
 {
     return virHashEqual(a, b, virNWFilterVarValueCompare);
 }
@@ -723,13 +723,13 @@ virNWFilterParseVarValue(const char *val)
     return virNWFilterVarValueCreateSimpleCopyValue(val);
 }
 
-virNWFilterHashTablePtr
+virHashTablePtr
 virNWFilterParseParamAttributes(xmlNodePtr cur)
 {
     char *nam, *val;
     virNWFilterVarValuePtr value;
 
-    virNWFilterHashTablePtr table = virNWFilterHashTableCreate(0);
+    virHashTablePtr table = virNWFilterHashTableCreate(0);
     if (!table)
         return NULL;
 
@@ -791,7 +791,7 @@ virNWFilterFormatParameterNameSorter(const virHashKeyValuePair *a,
 
 int
 virNWFilterFormatParamAttributes(virBufferPtr buf,
-                                 virNWFilterHashTablePtr table,
+                                 virHashTablePtr table,
                                  const char *filterref)
 {
     virHashKeyValuePairPtr items;
@@ -1023,7 +1023,7 @@ virNWFilterVarAccessGetIntIterId(const virNWFilterVarAccess *vap)
 
 bool
 virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *varAccess,
-                                const virNWFilterHashTable *hash)
+                                const virHashTable *hash)
 {
     const char *varName = virNWFilterVarAccessGetVarName(varAccess);
     const char *res;
diff --git a/src/conf/nwfilter_params.h b/src/conf/nwfilter_params.h
index b24f023633..9bdf65c033 100644
--- a/src/conf/nwfilter_params.h
+++ b/src/conf/nwfilter_params.h
@@ -63,19 +63,16 @@ int virNWFilterVarValueAddValue(virNWFilterVarValuePtr val, char *value);
 int virNWFilterVarValueAddValueCopy(virNWFilterVarValuePtr val, const char *value);
 int virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value);
 
-typedef virHashTable virNWFilterHashTable;
-typedef virHashTable *virNWFilterHashTablePtr;
-
-virNWFilterHashTablePtr virNWFilterParseParamAttributes(xmlNodePtr cur);
+virHashTablePtr virNWFilterParseParamAttributes(xmlNodePtr cur);
 int virNWFilterFormatParamAttributes(virBufferPtr buf,
-                                     virNWFilterHashTablePtr table,
+                                     virHashTablePtr table,
                                      const char *filterref);
 
-virNWFilterHashTablePtr virNWFilterHashTableCreate(int n);
-int virNWFilterHashTablePutAll(virNWFilterHashTablePtr src,
-                               virNWFilterHashTablePtr dest);
-bool virNWFilterHashTableEqual(virNWFilterHashTablePtr a,
-                               virNWFilterHashTablePtr b);
+virHashTablePtr virNWFilterHashTableCreate(int n);
+int virNWFilterHashTablePutAll(virHashTablePtr src,
+                               virHashTablePtr dest);
+bool virNWFilterHashTableEqual(virHashTablePtr a,
+                               virHashTablePtr b);
 
 # define VALID_VARNAME \
   "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
@@ -123,7 +120,7 @@ virNWFilterVarAccessType virNWFilterVarAccessGetType(
 unsigned int virNWFilterVarAccessGetIterId(const virNWFilterVarAccess *vap);
 unsigned int virNWFilterVarAccessGetIndex(const virNWFilterVarAccess *vap);
 bool virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *vap,
-                                     const virNWFilterHashTable *hash);
+                                     const virHashTable *hash);
 
 typedef struct _virNWFilterVarCombIterEntry virNWFilterVarCombIterEntry;
 typedef virNWFilterVarCombIterEntry *virNWFilterVarCombIterEntryPtr;
@@ -139,12 +136,12 @@ struct _virNWFilterVarCombIterEntry {
 typedef struct _virNWFilterVarCombIter virNWFilterVarCombIter;
 typedef virNWFilterVarCombIter *virNWFilterVarCombIterPtr;
 struct _virNWFilterVarCombIter {
-    virNWFilterHashTablePtr hashTable;
+    virHashTablePtr hashTable;
     size_t nIter;
     virNWFilterVarCombIterEntry iter[0];
 };
 virNWFilterVarCombIterPtr virNWFilterVarCombIterCreate(
-                             virNWFilterHashTablePtr hash,
+                             virHashTablePtr hash,
                              virNWFilterVarAccessPtr *vars,
                              size_t nVars);
 
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index d23cad3b75..aec68ab847 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -141,7 +141,7 @@ struct _virNWFilterSnoopReq {
     char                                 ifkey[VIR_IFKEY_LEN];
     virMacAddr                           macaddr;
     char                                *filtername;
-    virNWFilterHashTablePtr              vars;
+    virHashTablePtr              vars;
     virNWFilterDriverStatePtr            driver;
     /* start and end of lease list, ordered by lease time */
     virNWFilterSnoopIPLeasePtr           start;
@@ -1595,7 +1595,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
                         const unsigned char *vmuuid,
                         const virMacAddr *macaddr,
                         const char *filtername,
-                        virNWFilterHashTablePtr filterparams,
+                        virHashTablePtr filterparams,
                         virNWFilterDriverStatePtr driver)
 {
     virNWFilterSnoopReqPtr req;
@@ -2239,7 +2239,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
                         const unsigned char *vmuuid ATTRIBUTE_UNUSED,
                         const virMacAddr *macaddr ATTRIBUTE_UNUSED,
                         const char *filtername ATTRIBUTE_UNUSED,
-                        virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
+                        virHashTablePtr filterparams ATTRIBUTE_UNUSED,
                         virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED)
 {
     virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.h b/src/nwfilter/nwfilter_dhcpsnoop.h
index 3ef96fa4e1..a5925de40a 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.h
+++ b/src/nwfilter/nwfilter_dhcpsnoop.h
@@ -35,7 +35,7 @@ int virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
                             const unsigned char *vmuuid,
                             const virMacAddr *macaddr,
                             const char *filtername,
-                            virNWFilterHashTablePtr filterparams,
+                            virHashTablePtr filterparams,
                             virNWFilterDriverStatePtr driver);
 void virNWFilterDHCPSnoopEnd(const char *ifname);
 #endif /* __NWFILTER_DHCPSNOOP_H */
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 130a366d67..0735426734 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -142,7 +142,7 @@ virNWFilterRuleInstFree(virNWFilterRuleInstPtr inst)
  * Adds a couple of standard keys (MAC, IP) to the hash table.
  */
 static int
-virNWFilterVarHashmapAddStdValues(virNWFilterHashTablePtr table,
+virNWFilterVarHashmapAddStdValues(virHashTablePtr table,
                                   char *macaddr,
                                   const virNWFilterVarValue *ipaddr)
 {
@@ -191,11 +191,11 @@ virNWFilterVarHashmapAddStdValues(virNWFilterHashTablePtr table,
  *
  * Returns pointer to hashmap, NULL if an error occurred.
  */
-virNWFilterHashTablePtr
+virHashTablePtr
 virNWFilterCreateVarHashmap(char *macaddr,
                             const virNWFilterVarValue *ipaddr)
 {
-    virNWFilterHashTablePtr table = virNWFilterHashTableCreate(0);
+    virHashTablePtr table = virNWFilterHashTableCreate(0);
     if (!table)
         return NULL;
 
@@ -208,7 +208,7 @@ virNWFilterCreateVarHashmap(char *macaddr,
 
 
 /**
- * Convert a virNWFilterHashTable into a string of comma-separated
+ * Convert a virHashTable into a string of comma-separated
  * variable names.
  */
 struct printString
@@ -278,11 +278,11 @@ virNWFilterPrintVars(virHashTablePtr vars,
  * Creates a new hash table with contents of var1 and var2 added where
  * contents of var2 will overwrite those of var1.
  */
-static virNWFilterHashTablePtr
-virNWFilterCreateVarsFrom(virNWFilterHashTablePtr vars1,
-                          virNWFilterHashTablePtr vars2)
+static virHashTablePtr
+virNWFilterCreateVarsFrom(virHashTablePtr vars1,
+                          virHashTablePtr vars2)
 {
-    virNWFilterHashTablePtr res = virNWFilterHashTableCreate(0);
+    virHashTablePtr res = virNWFilterHashTableCreate(0);
     if (!res)
         return NULL;
 
@@ -330,7 +330,7 @@ virNWFilterInstReset(virNWFilterInstPtr inst)
 static int
 virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
                      virNWFilterDefPtr def,
-                     virNWFilterHashTablePtr vars,
+                     virHashTablePtr vars,
                      enum instCase useNewFilter,
                      bool *foundNewFilter,
                      virNWFilterInstPtr inst);
@@ -338,7 +338,7 @@ virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
 static int
 virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
                              virNWFilterRuleDefPtr rule,
-                             virNWFilterHashTablePtr vars,
+                             virHashTablePtr vars,
                              virNWFilterInstPtr inst)
 {
     virNWFilterRuleInstPtr ruleinst;
@@ -371,13 +371,13 @@ virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
 static int
 virNWFilterIncludeDefToRuleInst(virNWFilterDriverStatePtr driver,
                                 virNWFilterIncludeDefPtr inc,
-                                virNWFilterHashTablePtr vars,
+                                virHashTablePtr vars,
                                 enum instCase useNewFilter,
                                 bool *foundNewFilter,
                                 virNWFilterInstPtr inst)
 {
     virNWFilterObjPtr obj;
-    virNWFilterHashTablePtr tmpvars = NULL;
+    virHashTablePtr tmpvars = NULL;
     virNWFilterDefPtr childdef;
     virNWFilterDefPtr newChilddef;
     int ret = -1;
@@ -452,7 +452,7 @@ virNWFilterIncludeDefToRuleInst(virNWFilterDriverStatePtr driver,
 static int
 virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
                      virNWFilterDefPtr def,
-                     virNWFilterHashTablePtr vars,
+                     virHashTablePtr vars,
                      enum instCase useNewFilter,
                      bool *foundNewFilter,
                      virNWFilterInstPtr inst)
@@ -487,8 +487,8 @@ virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
 
 static int
 virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
-                                   virNWFilterHashTablePtr vars,
-                                   virNWFilterHashTablePtr missing_vars,
+                                   virHashTablePtr vars,
+                                   virHashTablePtr missing_vars,
                                    int useNewFilter,
                                    virNWFilterDriverStatePtr driver)
 {
@@ -498,7 +498,7 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
     virNWFilterDefPtr next_filter;
     virNWFilterDefPtr newNext_filter;
     virNWFilterVarValuePtr val;
-    virNWFilterHashTablePtr tmpvars;
+    virHashTablePtr tmpvars;
 
     for (i = 0; i < filter->nentries; i++) {
         virNWFilterRuleDefPtr    rule = filter->filterEntries[i]->rule;
@@ -600,7 +600,7 @@ virNWFilterDoInstantiate(const unsigned char *vmuuid,
                          const char *ifname,
                          int ifindex,
                          const char *linkdev,
-                         virNWFilterHashTablePtr vars,
+                         virHashTablePtr vars,
                          enum instCase useNewFilter,
                          bool *foundNewFilter,
                          bool teardownOld,
@@ -616,7 +616,7 @@ virNWFilterDoInstantiate(const unsigned char *vmuuid,
     const char *learning;
     bool reportIP = false;
 
-    virNWFilterHashTablePtr missing_vars = virNWFilterHashTableCreate(0);
+    virHashTablePtr missing_vars = virNWFilterHashTableCreate(0);
 
     memset(&inst, 0, sizeof(inst));
 
@@ -754,7 +754,7 @@ virNWFilterInstantiateFilterUpdate(virNWFilterDriverStatePtr driver,
                                    const char *linkdev,
                                    const virMacAddr *macaddr,
                                    const char *filtername,
-                                   virNWFilterHashTablePtr filterparams,
+                                   virHashTablePtr filterparams,
                                    enum instCase useNewFilter,
                                    bool forceWithPendingReq,
                                    bool *foundNewFilter)
@@ -763,7 +763,7 @@ virNWFilterInstantiateFilterUpdate(virNWFilterDriverStatePtr driver,
     const char *drvname = EBIPTABLES_DRIVER_ID;
     virNWFilterTechDriverPtr techdriver;
     virNWFilterObjPtr obj;
-    virNWFilterHashTablePtr vars, vars1;
+    virHashTablePtr vars, vars1;
     virNWFilterDefPtr filter;
     virNWFilterDefPtr newFilter;
     char vmmacaddr[VIR_MAC_STRING_BUFLEN] = {0};
@@ -896,7 +896,7 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
                                  const char *linkdev,
                                  const virMacAddr *macaddr,
                                  const char *filtername,
-                                 virNWFilterHashTablePtr filterparams)
+                                 virHashTablePtr filterparams)
 {
     int rc;
     bool foundNewFilter = false;
diff --git a/src/nwfilter/nwfilter_gentech_driver.h b/src/nwfilter/nwfilter_gentech_driver.h
index 71924879a2..67092157b8 100644
--- a/src/nwfilter/nwfilter_gentech_driver.h
+++ b/src/nwfilter/nwfilter_gentech_driver.h
@@ -53,11 +53,11 @@ int virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
                                      const char *linkdev,
                                      const virMacAddr *macaddr,
                                      const char *filtername,
-                                     virNWFilterHashTablePtr filterparams);
+                                     virHashTablePtr filterparams);
 
 int virNWFilterTeardownFilter(const virDomainNetDef *net);
 
-virNWFilterHashTablePtr virNWFilterCreateVarHashmap(char *macaddr,
+virHashTablePtr virNWFilterCreateVarHashmap(char *macaddr,
                                        const virNWFilterVarValue *value);
 
 int virNWFilterDomainFWUpdateCB(virDomainObjPtr vm,
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index f5b94cf27d..2401857ddb 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -692,14 +692,14 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
                           const char *linkdev,
                           const virMacAddr *macaddr,
                           const char *filtername,
-                          virNWFilterHashTablePtr filterparams,
+                          virHashTablePtr filterparams,
                           virNWFilterDriverStatePtr driver,
                           enum howDetect howDetect)
 {
     int rc;
     virThread thread;
     virNWFilterIPAddrLearnReqPtr req = NULL;
-    virNWFilterHashTablePtr ht = NULL;
+    virHashTablePtr ht = NULL;
 
     if (howDetect == 0)
         return -1;
@@ -781,7 +781,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
                           const char *linkdev ATTRIBUTE_UNUSED,
                           const virMacAddr *macaddr ATTRIBUTE_UNUSED,
                           const char *filtername ATTRIBUTE_UNUSED,
-                          virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
+                          virHashTablePtr filterparams ATTRIBUTE_UNUSED,
                           virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED,
                           enum howDetect howDetect ATTRIBUTE_UNUSED)
 {
diff --git a/src/nwfilter/nwfilter_learnipaddr.h b/src/nwfilter/nwfilter_learnipaddr.h
index b93ed38cff..dc4c0d110f 100644
--- a/src/nwfilter/nwfilter_learnipaddr.h
+++ b/src/nwfilter/nwfilter_learnipaddr.h
@@ -44,7 +44,7 @@ struct _virNWFilterIPAddrLearnReq {
     char linkdev[IF_NAMESIZE];
     virMacAddr macaddr;
     char *filtername;
-    virNWFilterHashTablePtr filterparams;
+    virHashTablePtr filterparams;
     virNWFilterDriverStatePtr driver;
     enum howDetect howDetect;
 
@@ -58,7 +58,7 @@ int virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
                               const char *linkdev,
                               const virMacAddr *macaddr,
                               const char *filtername,
-                              virNWFilterHashTablePtr filterparams,
+                              virHashTablePtr filterparams,
                               virNWFilterDriverStatePtr driver,
                               enum howDetect howDetect);
 
diff --git a/src/nwfilter/nwfilter_tech_driver.h b/src/nwfilter/nwfilter_tech_driver.h
index bc30496644..d2ac0077db 100644
--- a/src/nwfilter/nwfilter_tech_driver.h
+++ b/src/nwfilter/nwfilter_tech_driver.h
@@ -39,7 +39,7 @@ struct _virNWFilterRuleInst {
     virNWFilterChainPriority chainPriority;
     virNWFilterRuleDefPtr def;
     virNWFilterRulePriority priority;
-    virNWFilterHashTablePtr vars;
+    virHashTablePtr vars;
 };
 
 
diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewalltest.c
index a51ad9412a..043b7d170e 100644
--- a/tests/nwfilterxml2firewalltest.c
+++ b/tests/nwfilterxml2firewalltest.c
@@ -147,11 +147,11 @@ static const char *commonRules[] = {
 };
 
 
-static virNWFilterHashTablePtr
-virNWFilterCreateVarsFrom(virNWFilterHashTablePtr vars1,
-                          virNWFilterHashTablePtr vars2)
+static virHashTablePtr
+virNWFilterCreateVarsFrom(virHashTablePtr vars1,
+                          virHashTablePtr vars2)
 {
-    virNWFilterHashTablePtr res = virNWFilterHashTableCreate(0);
+    virHashTablePtr res = virNWFilterHashTableCreate(0);
     if (!res)
         return NULL;
 
@@ -199,13 +199,13 @@ virNWFilterInstReset(virNWFilterInstPtr inst)
 
 static int
 virNWFilterDefToInst(const char *xml,
-                     virNWFilterHashTablePtr vars,
+                     virHashTablePtr vars,
                      virNWFilterInstPtr inst);
 
 static int
 virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
                              virNWFilterRuleDefPtr rule,
-                             virNWFilterHashTablePtr vars,
+                             virHashTablePtr vars,
                              virNWFilterInstPtr inst)
 {
     virNWFilterRuleInstPtr ruleinst;
@@ -238,10 +238,10 @@ virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
 
 static int
 virNWFilterIncludeDefToRuleInst(virNWFilterIncludeDefPtr inc,
-                                virNWFilterHashTablePtr vars,
+                                virHashTablePtr vars,
                                 virNWFilterInstPtr inst)
 {
-    virNWFilterHashTablePtr tmpvars = NULL;
+    virHashTablePtr tmpvars = NULL;
     int ret = -1;
     char *xml;
 
@@ -270,7 +270,7 @@ virNWFilterIncludeDefToRuleInst(virNWFilterIncludeDefPtr inc,
 
 static int
 virNWFilterDefToInst(const char *xml,
-                     virNWFilterHashTablePtr vars,
+                     virHashTablePtr vars,
                      virNWFilterInstPtr inst)
 {
     size_t i;
@@ -326,7 +326,7 @@ static void testRemoveCommonRules(char *rules)
 }
 
 
-static int testSetOneParameter(virNWFilterHashTablePtr vars,
+static int testSetOneParameter(virHashTablePtr vars,
                                const char *name,
                                const char *value)
 {
@@ -350,7 +350,7 @@ static int testSetOneParameter(virNWFilterHashTablePtr vars,
     return ret;
 }
 
-static int testSetDefaultParameters(virNWFilterHashTablePtr vars)
+static int testSetDefaultParameters(virHashTablePtr vars)
 {
     if (testSetOneParameter(vars, "IPSETNAME", "tck_test") < 0 ||
         testSetOneParameter(vars, "A", "1.1.1.1") ||
@@ -374,7 +374,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
 {
     char *actualargv = NULL;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
-    virNWFilterHashTablePtr vars = virNWFilterHashTableCreate(0);
+    virHashTablePtr vars = virNWFilterHashTableCreate(0);
     virNWFilterInst inst;
     int ret = -1;
 
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 03/14] nwfilter: remove virNWFilterHashTable typedefs entirely
Posted by Jiri Denemark 6 years, 7 months ago
On Fri, Apr 27, 2018 at 16:25:02 +0100, Daniel P. Berrangé wrote:
> All the code now just uses the virHashTablePtr type directly.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  src/conf/domain_conf.c                 |  2 +-
>  src/conf/domain_conf.h                 |  2 +-
>  src/conf/nwfilter_conf.h               |  2 +-
>  src/conf/nwfilter_ipaddrmap.c          |  2 +-
>  src/conf/nwfilter_params.c             | 26 ++++++++++-----------
>  src/conf/nwfilter_params.h             | 23 ++++++++-----------
>  src/nwfilter/nwfilter_dhcpsnoop.c      |  6 ++---
>  src/nwfilter/nwfilter_dhcpsnoop.h      |  2 +-
>  src/nwfilter/nwfilter_gentech_driver.c | 42 +++++++++++++++++-----------------
>  src/nwfilter/nwfilter_gentech_driver.h |  4 ++--
>  src/nwfilter/nwfilter_learnipaddr.c    |  6 ++---
>  src/nwfilter/nwfilter_learnipaddr.h    |  4 ++--
>  src/nwfilter/nwfilter_tech_driver.h    |  2 +-
>  tests/nwfilterxml2firewalltest.c       | 24 +++++++++----------
>  14 files changed, 72 insertions(+), 75 deletions(-)
...
> diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
> index d23cad3b75..aec68ab847 100644
> --- a/src/nwfilter/nwfilter_dhcpsnoop.c
> +++ b/src/nwfilter/nwfilter_dhcpsnoop.c
> @@ -141,7 +141,7 @@ struct _virNWFilterSnoopReq {
>      char                                 ifkey[VIR_IFKEY_LEN];
>      virMacAddr                           macaddr;
>      char                                *filtername;
> -    virNWFilterHashTablePtr              vars;
> +    virHashTablePtr              vars;

One space between virHashTablePtr and vars would be enough. Or fix the
alignment if you want to keep it consistently aligned.

>      virNWFilterDriverStatePtr            driver;
>      /* start and end of lease list, ordered by lease time */
>      virNWFilterSnoopIPLeasePtr           start;
...
> diff --git a/src/nwfilter/nwfilter_gentech_driver.h b/src/nwfilter/nwfilter_gentech_driver.h
> index 71924879a2..67092157b8 100644
> --- a/src/nwfilter/nwfilter_gentech_driver.h
> +++ b/src/nwfilter/nwfilter_gentech_driver.h
> @@ -53,11 +53,11 @@ int virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
>                                       const char *linkdev,
>                                       const virMacAddr *macaddr,
>                                       const char *filtername,
> -                                     virNWFilterHashTablePtr filterparams);
> +                                     virHashTablePtr filterparams);
>  
>  int virNWFilterTeardownFilter(const virDomainNetDef *net);
>  
> -virNWFilterHashTablePtr virNWFilterCreateVarHashmap(char *macaddr,
> +virHashTablePtr virNWFilterCreateVarHashmap(char *macaddr,
>                                         const virNWFilterVarValue *value);

The indentation could be updated here as well.

>  
>  int virNWFilterDomainFWUpdateCB(virDomainObjPtr vm,
...

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>

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