[PATCH 07/15] nwfilter: Rename some virNWFilterObj* API's

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

 



Prefix should have been virNWFilterObjList since the API is operating on
the list of filters

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/virnwfilterobj.c              | 76 +++++++++++++++++-----------------
 src/conf/virnwfilterobj.h              | 36 ++++++++--------
 src/libvirt_private.syms               | 14 +++----
 src/nwfilter/nwfilter_driver.c         | 22 +++++-----
 src/nwfilter/nwfilter_gentech_driver.c | 12 +++---
 5 files changed, 80 insertions(+), 80 deletions(-)

diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index dcfd1e7..a259062 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -116,8 +116,8 @@ virNWFilterObjListFree(virNWFilterObjListPtr nwfilters)
 
 
 void
-virNWFilterObjRemove(virNWFilterObjListPtr nwfilters,
-                     virNWFilterObjPtr obj)
+virNWFilterObjListRemove(virNWFilterObjListPtr nwfilters,
+                         virNWFilterObjPtr obj)
 {
     size_t i;
 
@@ -138,8 +138,8 @@ virNWFilterObjRemove(virNWFilterObjListPtr nwfilters,
 
 
 virNWFilterObjPtr
-virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters,
-                         const unsigned char *uuid)
+virNWFilterObjListFindByUUID(virNWFilterObjListPtr nwfilters,
+                             const unsigned char *uuid)
 {
     size_t i;
     virNWFilterObjPtr obj;
@@ -159,8 +159,8 @@ virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters,
 
 
 virNWFilterObjPtr
-virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters,
-                         const char *name)
+virNWFilterObjListFindByName(virNWFilterObjListPtr nwfilters,
+                             const char *name)
 {
     size_t i;
     virNWFilterObjPtr obj;
@@ -180,9 +180,9 @@ virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters,
 
 
 static int
-_virNWFilterObjDefLoopDetect(virNWFilterObjListPtr nwfilters,
-                             virNWFilterDefPtr def,
-                             const char *filtername)
+_virNWFilterObjListDefLoopDetect(virNWFilterObjListPtr nwfilters,
+                                 virNWFilterDefPtr def,
+                                 const char *filtername)
 {
     int rc = 0;
     size_t i;
@@ -202,12 +202,12 @@ _virNWFilterObjDefLoopDetect(virNWFilterObjListPtr nwfilters,
                 break;
             }
 
-            obj = virNWFilterObjFindByName(nwfilters,
-                                           entry->include->filterref);
+            obj = virNWFilterObjListFindByName(nwfilters,
+                                               entry->include->filterref);
             if (obj) {
                 objdef = obj->def;
-                rc = _virNWFilterObjDefLoopDetect(nwfilters, objdef,
-                                                  filtername);
+                rc = _virNWFilterObjListDefLoopDetect(nwfilters, objdef,
+                                                      filtername);
                 virNWFilterObjUnlock(obj);
                 if (rc < 0)
                     break;
@@ -220,7 +220,7 @@ _virNWFilterObjDefLoopDetect(virNWFilterObjListPtr nwfilters,
 
 
 /*
- * virNWFilterObjDefLoopDetect:
+ * virNWFilterObjListDefLoopDetect:
  * @nwfilters : the nwfilters to search
  * @def : the filter definition that may add a loop and is to be tested
  *
@@ -230,10 +230,10 @@ _virNWFilterObjDefLoopDetect(virNWFilterObjListPtr nwfilters,
  * Returns 0 in case no loop was detected, -1 otherwise.
  */
 static int
-virNWFilterObjDefLoopDetect(virNWFilterObjListPtr nwfilters,
-                            virNWFilterDefPtr def)
+virNWFilterObjListDefLoopDetect(virNWFilterObjListPtr nwfilters,
+                                virNWFilterDefPtr def)
 {
-    return _virNWFilterObjDefLoopDetect(nwfilters, def, def->name);
+    return _virNWFilterObjListDefLoopDetect(nwfilters, def, def->name);
 }
 
 
@@ -286,13 +286,13 @@ virNWFilterDefEqual(const virNWFilterDef *def1,
 
 
 virNWFilterObjPtr
-virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters,
-                        virNWFilterDefPtr def)
+virNWFilterObjListAssignDef(virNWFilterObjListPtr nwfilters,
+                            virNWFilterDefPtr def)
 {
     virNWFilterObjPtr obj;
     virNWFilterDefPtr objdef;
 
-    if ((obj = virNWFilterObjFindByUUID(nwfilters, def->uuid))) {
+    if ((obj = virNWFilterObjListFindByUUID(nwfilters, def->uuid))) {
         objdef = obj->def;
 
         if (STRNEQ(def->name, objdef->name)) {
@@ -305,7 +305,7 @@ virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters,
         }
         virNWFilterObjUnlock(obj);
     } else {
-        if ((obj = virNWFilterObjFindByName(nwfilters, def->name))) {
+        if ((obj = virNWFilterObjListFindByName(nwfilters, def->name))) {
             char uuidstr[VIR_UUID_STRING_BUFLEN];
 
             objdef = obj->def;
@@ -318,14 +318,14 @@ virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters,
         }
     }
 
-    if (virNWFilterObjDefLoopDetect(nwfilters, def) < 0) {
+    if (virNWFilterObjListDefLoopDetect(nwfilters, def) < 0) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        "%s", _("filter would introduce a loop"));
         return NULL;
     }
 
 
-    if ((obj = virNWFilterObjFindByName(nwfilters, def->name))) {
+    if ((obj = virNWFilterObjListFindByName(nwfilters, def->name))) {
 
         objdef = obj->def;
         if (virNWFilterDefEqual(def, objdef, false)) {
@@ -364,9 +364,9 @@ virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters,
 
 
 int
-virNWFilterObjNumOfNWFilters(virNWFilterObjListPtr nwfilters,
-                             virConnectPtr conn,
-                             virNWFilterObjListFilter aclfilter)
+virNWFilterObjListNumOfNWFilters(virNWFilterObjListPtr nwfilters,
+                                 virConnectPtr conn,
+                                 virNWFilterObjListFilter aclfilter)
 {
     size_t i;
     int nfilters = 0;
@@ -386,11 +386,11 @@ virNWFilterObjNumOfNWFilters(virNWFilterObjListPtr nwfilters,
 
 
 int
-virNWFilterObjGetNames(virNWFilterObjListPtr nwfilters,
-                       virConnectPtr conn,
-                       virNWFilterObjListFilter aclfilter,
-                       char **const names,
-                       int maxnames)
+virNWFilterObjListGetNames(virNWFilterObjListPtr nwfilters,
+                           virConnectPtr conn,
+                           virNWFilterObjListFilter aclfilter,
+                           char **const names,
+                           int maxnames)
 {
     int nnames = 0;
     size_t i;
@@ -472,9 +472,9 @@ virNWFilterObjListExport(virConnectPtr conn,
 
 
 static virNWFilterObjPtr
-virNWFilterObjLoadConfig(virNWFilterObjListPtr nwfilters,
-                         const char *configDir,
-                         const char *name)
+virNWFilterObjListLoadConfig(virNWFilterObjListPtr nwfilters,
+                             const char *configDir,
+                             const char *name)
 {
     virNWFilterDefPtr def = NULL;
     virNWFilterObjPtr obj;
@@ -499,7 +499,7 @@ virNWFilterObjLoadConfig(virNWFilterObjListPtr nwfilters,
         virNWFilterSaveConfig(configDir, def) < 0)
         goto error;
 
-    if (!(obj = virNWFilterObjAssignDef(nwfilters, def)))
+    if (!(obj = virNWFilterObjListAssignDef(nwfilters, def)))
         goto error;
 
     VIR_FREE(configFile);
@@ -513,8 +513,8 @@ virNWFilterObjLoadConfig(virNWFilterObjListPtr nwfilters,
 
 
 int
-virNWFilterObjLoadAllConfigs(virNWFilterObjListPtr nwfilters,
-                             const char *configDir)
+virNWFilterObjListLoadAllConfigs(virNWFilterObjListPtr nwfilters,
+                                 const char *configDir)
 {
     DIR *dir;
     struct dirent *entry;
@@ -530,7 +530,7 @@ virNWFilterObjLoadAllConfigs(virNWFilterObjListPtr nwfilters,
         if (!virFileStripSuffix(entry->d_name, ".xml"))
             continue;
 
-        obj = virNWFilterObjLoadConfig(nwfilters, configDir, entry->d_name);
+        obj = virNWFilterObjListLoadConfig(nwfilters, configDir, entry->d_name);
         if (obj)
             virNWFilterObjUnlock(obj);
     }
diff --git a/src/conf/virnwfilterobj.h b/src/conf/virnwfilterobj.h
index b02dcfa..4c19223 100644
--- a/src/conf/virnwfilterobj.h
+++ b/src/conf/virnwfilterobj.h
@@ -59,20 +59,20 @@ void
 virNWFilterObjListFree(virNWFilterObjListPtr nwfilters);
 
 void
-virNWFilterObjRemove(virNWFilterObjListPtr nwfilters,
-                     virNWFilterObjPtr obj);
+virNWFilterObjListRemove(virNWFilterObjListPtr nwfilters,
+                         virNWFilterObjPtr obj);
 
 virNWFilterObjPtr
-virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters,
-                         const unsigned char *uuid);
+virNWFilterObjListFindByUUID(virNWFilterObjListPtr nwfilters,
+                             const unsigned char *uuid);
 
 virNWFilterObjPtr
-virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters,
-                         const char *name);
+virNWFilterObjListFindByName(virNWFilterObjListPtr nwfilters,
+                             const char *name);
 
 virNWFilterObjPtr
-virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters,
-                        virNWFilterDefPtr def);
+virNWFilterObjListAssignDef(virNWFilterObjListPtr nwfilters,
+                            virNWFilterDefPtr def);
 
 int
 virNWFilterObjTestUnassignDef(virNWFilterObjPtr obj);
@@ -82,16 +82,16 @@ typedef bool
                             virNWFilterDefPtr def);
 
 int
-virNWFilterObjNumOfNWFilters(virNWFilterObjListPtr nwfilters,
-                             virConnectPtr conn,
-                             virNWFilterObjListFilter aclfilter);
+virNWFilterObjListNumOfNWFilters(virNWFilterObjListPtr nwfilters,
+                                 virConnectPtr conn,
+                                 virNWFilterObjListFilter aclfilter);
 
 int
-virNWFilterObjGetNames(virNWFilterObjListPtr nwfilters,
-                       virConnectPtr conn,
-                       virNWFilterObjListFilter aclfilter,
-                       char **const names,
-                       int maxnames);
+virNWFilterObjListGetNames(virNWFilterObjListPtr nwfilters,
+                           virConnectPtr conn,
+                           virNWFilterObjListFilter aclfilter,
+                           char **const names,
+                           int maxnames);
 
 int
 virNWFilterObjListExport(virConnectPtr conn,
@@ -100,8 +100,8 @@ virNWFilterObjListExport(virConnectPtr conn,
                          virNWFilterObjListFilter aclfilter);
 
 int
-virNWFilterObjLoadAllConfigs(virNWFilterObjListPtr nwfilters,
-                             const char *configDir);
+virNWFilterObjListLoadAllConfigs(virNWFilterObjListPtr nwfilters,
+                                 const char *configDir);
 
 void
 virNWFilterObjLock(virNWFilterObjPtr obj);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index dd6cb98..453d0fe 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -962,18 +962,18 @@ virNodeDeviceObjUnlock;
 
 
 # conf/virnwfilterobj.h
-virNWFilterObjAssignDef;
-virNWFilterObjFindByName;
-virNWFilterObjFindByUUID;
 virNWFilterObjGetDef;
-virNWFilterObjGetNames;
 virNWFilterObjGetNewDef;
+virNWFilterObjListAssignDef;
 virNWFilterObjListExport;
+virNWFilterObjListFindByName;
+virNWFilterObjListFindByUUID;
 virNWFilterObjListFree;
-virNWFilterObjLoadAllConfigs;
+virNWFilterObjListGetNames;
+virNWFilterObjListLoadAllConfigs;
+virNWFilterObjListNumOfNWFilters;
+virNWFilterObjListRemove;
 virNWFilterObjLock;
-virNWFilterObjNumOfNWFilters;
-virNWFilterObjRemove;
 virNWFilterObjTestUnassignDef;
 virNWFilterObjUnlock;
 virNWFilterObjWantRemoved;
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index dd3645a..6516053 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -237,7 +237,7 @@ nwfilterStateInitialize(bool privileged,
 
     VIR_FREE(base);
 
-    if (virNWFilterObjLoadAllConfigs(&driver->nwfilters, driver->configDir) < 0)
+    if (virNWFilterObjListLoadAllConfigs(&driver->nwfilters, driver->configDir) < 0)
         goto error;
 
     nwfilterDriverUnlock();
@@ -289,7 +289,7 @@ nwfilterStateReload(void)
     virNWFilterWriteLockFilterUpdates();
     virNWFilterCallbackDriversLock();
 
-    virNWFilterObjLoadAllConfigs(&driver->nwfilters, driver->configDir);
+    virNWFilterObjListLoadAllConfigs(&driver->nwfilters, driver->configDir);
 
     virNWFilterCallbackDriversUnlock();
     virNWFilterUnlockFilterUpdates();
@@ -362,7 +362,7 @@ nwfilterLookupByUUID(virConnectPtr conn,
     virNWFilterPtr ret = NULL;
 
     nwfilterDriverLock();
-    obj = virNWFilterObjFindByUUID(&driver->nwfilters, uuid);
+    obj = virNWFilterObjListFindByUUID(&driver->nwfilters, uuid);
     nwfilterDriverUnlock();
 
     if (!obj) {
@@ -393,7 +393,7 @@ nwfilterLookupByName(virConnectPtr conn,
     virNWFilterPtr ret = NULL;
 
     nwfilterDriverLock();
-    obj = virNWFilterObjFindByName(&driver->nwfilters, name);
+    obj = virNWFilterObjListFindByName(&driver->nwfilters, name);
     nwfilterDriverUnlock();
 
     if (!obj) {
@@ -421,7 +421,7 @@ nwfilterConnectNumOfNWFilters(virConnectPtr conn)
     if (virConnectNumOfNWFiltersEnsureACL(conn) < 0)
         return -1;
 
-    return virNWFilterObjNumOfNWFilters(&driver->nwfilters, conn,
+    return virNWFilterObjListNumOfNWFilters(&driver->nwfilters, conn,
                                         virConnectNumOfNWFiltersCheckACL);
 }
 
@@ -437,7 +437,7 @@ nwfilterConnectListNWFilters(virConnectPtr conn,
         return -1;
 
     nwfilterDriverLock();
-    nnames = virNWFilterObjGetNames(&driver->nwfilters, conn,
+    nnames = virNWFilterObjListGetNames(&driver->nwfilters, conn,
                                     virConnectListNWFiltersCheckACL,
                                     names, maxnames);
     nwfilterDriverUnlock();
@@ -490,13 +490,13 @@ nwfilterDefineXML(virConnectPtr conn,
     if (virNWFilterDefineXMLEnsureACL(conn, def) < 0)
         goto cleanup;
 
-    if (!(obj = virNWFilterObjAssignDef(&driver->nwfilters, def)))
+    if (!(obj = virNWFilterObjListAssignDef(&driver->nwfilters, def)))
         goto cleanup;
     def = NULL;
     objdef = virNWFilterObjGetDef(obj);
 
     if (virNWFilterSaveDef(driver->configDir, objdef) < 0) {
-        virNWFilterObjRemove(&driver->nwfilters, obj);
+        virNWFilterObjListRemove(&driver->nwfilters, obj);
         goto cleanup;
     }
 
@@ -525,7 +525,7 @@ nwfilterUndefine(virNWFilterPtr nwfilter)
     virNWFilterWriteLockFilterUpdates();
     virNWFilterCallbackDriversLock();
 
-    obj = virNWFilterObjFindByUUID(&driver->nwfilters, nwfilter->uuid);
+    obj = virNWFilterObjListFindByUUID(&driver->nwfilters, nwfilter->uuid);
     if (!obj) {
         virReportError(VIR_ERR_NO_NWFILTER,
                        "%s", _("no nwfilter with matching uuid"));
@@ -546,7 +546,7 @@ nwfilterUndefine(virNWFilterPtr nwfilter)
     if (virNWFilterDeleteDef(driver->configDir, def) < 0)
         goto cleanup;
 
-    virNWFilterObjRemove(&driver->nwfilters, obj);
+    virNWFilterObjListRemove(&driver->nwfilters, obj);
     obj = NULL;
     ret = 0;
 
@@ -572,7 +572,7 @@ nwfilterGetXMLDesc(virNWFilterPtr nwfilter,
     virCheckFlags(0, NULL);
 
     nwfilterDriverLock();
-    obj = virNWFilterObjFindByUUID(&driver->nwfilters, nwfilter->uuid);
+    obj = virNWFilterObjListFindByUUID(&driver->nwfilters, nwfilter->uuid);
     nwfilterDriverUnlock();
 
     if (!obj) {
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index b356d87..23f1999 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -60,11 +60,11 @@ static virNWFilterTechDriverPtr filter_tech_drivers[] = {
  * to avoid lock ordering deadlocks. eg __virNWFilterInstantiateFilter
  * will hold a lock on a virNWFilterObjPtr. This in turn invokes
  * virNWFilterInstantiate which invokes virNWFilterDetermineMissingVarsRec
- * which invokes virNWFilterObjFindByName. This iterates over every single
+ * which invokes virNWFilterObjListFindByName. This iterates over every single
  * virNWFilterObjPtr in the list. So if 2 threads try to instantiate a
  * filter in parallel, they'll both hold 1 lock at the top level in
  * __virNWFilterInstantiateFilter which will cause the other thread
- * to deadlock in virNWFilterObjFindByName.
+ * to deadlock in virNWFilterObjListFindByName.
  *
  * XXX better long term solution is to make virNWFilterObjList use a
  * hash table as is done for virDomainObjList. You can then get
@@ -383,8 +383,8 @@ virNWFilterIncludeDefToRuleInst(virNWFilterDriverStatePtr driver,
     int ret = -1;
 
     VIR_DEBUG("Instantiating filter %s", inc->filterref);
-    obj = virNWFilterObjFindByName(&driver->nwfilters,
-                                   inc->filterref);
+    obj = virNWFilterObjListFindByName(&driver->nwfilters,
+                                       inc->filterref);
     if (!obj) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("referenced filter '%s' is missing"),
@@ -545,7 +545,7 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
                 break;
         } else if (inc) {
             VIR_DEBUG("Following filter %s", inc->filterref);
-            obj = virNWFilterObjFindByName(&driver->nwfilters, inc->filterref);
+            obj = virNWFilterObjListFindByName(&driver->nwfilters, inc->filterref);
             if (obj) {
 
                 if (virNWFilterObjWantRemoved(obj)) {
@@ -812,7 +812,7 @@ __virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
 
     VIR_DEBUG("filter name: %s", filtername);
 
-    obj = virNWFilterObjFindByName(&driver->nwfilters, filtername);
+    obj = virNWFilterObjListFindByName(&driver->nwfilters, filtername);
     if (!obj) {
         virReportError(VIR_ERR_NO_NWFILTER,
                        _("Could not find filter '%s'"),
-- 
2.9.3

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