From 5ebe530e0939f2494716f43350446e64b01ddf06 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 18 Apr 2017 12:38:50 -0400 Subject: [PATCH] nwfilter: Rename some virNWFilterObj* API's Prefix should have been virNWFilterObjList since the API is operating on the list of filters. Signed-off-by: John Ferlan --- 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 7c21327249..28425ba753 100644 --- a/src/conf/virnwfilterobj.c +++ b/src/conf/virnwfilterobj.c @@ -111,8 +111,8 @@ virNWFilterObjListFree(virNWFilterObjListPtr nwfilters) void -virNWFilterObjRemove(virNWFilterObjListPtr nwfilters, - virNWFilterObjPtr obj) +virNWFilterObjListRemove(virNWFilterObjListPtr nwfilters, + virNWFilterObjPtr obj) { size_t i; @@ -133,8 +133,8 @@ virNWFilterObjRemove(virNWFilterObjListPtr nwfilters, virNWFilterObjPtr -virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters, - const unsigned char *uuid) +virNWFilterObjListFindByUUID(virNWFilterObjListPtr nwfilters, + const unsigned char *uuid) { size_t i; virNWFilterObjPtr obj; @@ -154,8 +154,8 @@ virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters, virNWFilterObjPtr -virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters, - const char *name) +virNWFilterObjListFindByName(virNWFilterObjListPtr nwfilters, + const char *name) { size_t i; virNWFilterObjPtr obj; @@ -175,9 +175,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; @@ -196,11 +196,11 @@ _virNWFilterObjDefLoopDetect(virNWFilterObjListPtr nwfilters, break; } - obj = virNWFilterObjFindByName(nwfilters, - entry->include->filterref); + obj = virNWFilterObjListFindByName(nwfilters, + entry->include->filterref); if (obj) { - rc = _virNWFilterObjDefLoopDetect(nwfilters, obj->def, - filtername); + rc = _virNWFilterObjListDefLoopDetect(nwfilters, obj->def, + filtername); virNWFilterObjUnlock(obj); if (rc < 0) break; @@ -213,7 +213,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 * @@ -223,10 +223,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); } @@ -279,13 +279,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)) { @@ -298,7 +298,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; @@ -311,14 +311,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)) { @@ -357,9 +357,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; @@ -377,11 +377,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; @@ -463,9 +463,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; @@ -490,7 +490,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); @@ -504,8 +504,8 @@ virNWFilterObjLoadConfig(virNWFilterObjListPtr nwfilters, int -virNWFilterObjLoadAllConfigs(virNWFilterObjListPtr nwfilters, - const char *configDir) +virNWFilterObjListLoadAllConfigs(virNWFilterObjListPtr nwfilters, + const char *configDir) { DIR *dir; struct dirent *entry; @@ -521,7 +521,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 b02dcfad5e..4c1922329d 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 dd6cb98db1..453d0fe717 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 dd3645a02d..6516053642 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 b356d87aba..23f19997f3 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'"), -- GitLab