mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
conf: Use consistent function name prefixes for virnwfilterobj
Use "virNWFilterObj" as a prefix for any external API in virnwfilterobj
This commit is contained in:
parent
44242cce02
commit
62bc956786
@ -117,9 +117,9 @@ virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_virNWFilterDefLoopDetect(virNWFilterObjListPtr nwfilters,
|
_virNWFilterObjDefLoopDetect(virNWFilterObjListPtr nwfilters,
|
||||||
virNWFilterDefPtr def,
|
virNWFilterDefPtr def,
|
||||||
const char *filtername)
|
const char *filtername)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -141,8 +141,8 @@ _virNWFilterDefLoopDetect(virNWFilterObjListPtr nwfilters,
|
|||||||
obj = virNWFilterObjFindByName(nwfilters,
|
obj = virNWFilterObjFindByName(nwfilters,
|
||||||
entry->include->filterref);
|
entry->include->filterref);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
rc = _virNWFilterDefLoopDetect(nwfilters,
|
rc = _virNWFilterObjDefLoopDetect(nwfilters,
|
||||||
obj->def, filtername);
|
obj->def, filtername);
|
||||||
|
|
||||||
virNWFilterObjUnlock(obj);
|
virNWFilterObjUnlock(obj);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
@ -156,7 +156,7 @@ _virNWFilterDefLoopDetect(virNWFilterObjListPtr nwfilters,
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* virNWFilterDefLoopDetect:
|
* virNWFilterObjDefLoopDetect:
|
||||||
* @nwfilters : the nwfilters to search
|
* @nwfilters : the nwfilters to search
|
||||||
* @def : the filter definition that may add a loop and is to be tested
|
* @def : the filter definition that may add a loop and is to be tested
|
||||||
*
|
*
|
||||||
@ -166,15 +166,15 @@ _virNWFilterDefLoopDetect(virNWFilterObjListPtr nwfilters,
|
|||||||
* Returns 0 in case no loop was detected, -1 otherwise.
|
* Returns 0 in case no loop was detected, -1 otherwise.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
virNWFilterDefLoopDetect(virNWFilterObjListPtr nwfilters,
|
virNWFilterObjDefLoopDetect(virNWFilterObjListPtr nwfilters,
|
||||||
virNWFilterDefPtr def)
|
virNWFilterDefPtr def)
|
||||||
{
|
{
|
||||||
return _virNWFilterDefLoopDetect(nwfilters, def, def->name);
|
return _virNWFilterObjDefLoopDetect(nwfilters, def, def->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNWFilterTestUnassignDef(virNWFilterObjPtr nwfilter)
|
virNWFilterObjTestUnassignDef(virNWFilterObjPtr nwfilter)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virNWFilterDefLoopDetect(nwfilters, def) < 0) {
|
if (virNWFilterObjDefLoopDetect(nwfilters, def) < 0) {
|
||||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
"%s", _("filter would introduce a loop"));
|
"%s", _("filter would introduce a loop"));
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -306,9 +306,9 @@ virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters,
|
|||||||
|
|
||||||
|
|
||||||
static virNWFilterObjPtr
|
static virNWFilterObjPtr
|
||||||
virNWFilterLoadConfig(virNWFilterObjListPtr nwfilters,
|
virNWFilterObjLoadConfig(virNWFilterObjListPtr nwfilters,
|
||||||
const char *configDir,
|
const char *configDir,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
virNWFilterDefPtr def = NULL;
|
virNWFilterDefPtr def = NULL;
|
||||||
virNWFilterObjPtr nwfilter;
|
virNWFilterObjPtr nwfilter;
|
||||||
@ -347,8 +347,8 @@ virNWFilterLoadConfig(virNWFilterObjListPtr nwfilters,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNWFilterLoadAllConfigs(virNWFilterObjListPtr nwfilters,
|
virNWFilterObjLoadAllConfigs(virNWFilterObjListPtr nwfilters,
|
||||||
const char *configDir)
|
const char *configDir)
|
||||||
{
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
@ -364,7 +364,7 @@ virNWFilterLoadAllConfigs(virNWFilterObjListPtr nwfilters,
|
|||||||
if (!virFileStripSuffix(entry->d_name, ".xml"))
|
if (!virFileStripSuffix(entry->d_name, ".xml"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nwfilter = virNWFilterLoadConfig(nwfilters, configDir, entry->d_name);
|
nwfilter = virNWFilterObjLoadConfig(nwfilters, configDir, entry->d_name);
|
||||||
if (nwfilter)
|
if (nwfilter)
|
||||||
virNWFilterObjUnlock(nwfilter);
|
virNWFilterObjUnlock(nwfilter);
|
||||||
}
|
}
|
||||||
|
@ -79,11 +79,11 @@ virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters,
|
|||||||
virNWFilterDefPtr def);
|
virNWFilterDefPtr def);
|
||||||
|
|
||||||
int
|
int
|
||||||
virNWFilterTestUnassignDef(virNWFilterObjPtr nwfilter);
|
virNWFilterObjTestUnassignDef(virNWFilterObjPtr nwfilter);
|
||||||
|
|
||||||
int
|
int
|
||||||
virNWFilterLoadAllConfigs(virNWFilterObjListPtr nwfilters,
|
virNWFilterObjLoadAllConfigs(virNWFilterObjListPtr nwfilters,
|
||||||
const char *configDir);
|
const char *configDir);
|
||||||
|
|
||||||
void
|
void
|
||||||
virNWFilterObjLock(virNWFilterObjPtr obj);
|
virNWFilterObjLock(virNWFilterObjPtr obj);
|
||||||
|
@ -957,15 +957,15 @@ virNodeDeviceObjUnlock;
|
|||||||
|
|
||||||
|
|
||||||
# conf/virnwfilterobj.h
|
# conf/virnwfilterobj.h
|
||||||
virNWFilterLoadAllConfigs;
|
|
||||||
virNWFilterObjAssignDef;
|
virNWFilterObjAssignDef;
|
||||||
virNWFilterObjFindByName;
|
virNWFilterObjFindByName;
|
||||||
virNWFilterObjFindByUUID;
|
virNWFilterObjFindByUUID;
|
||||||
virNWFilterObjListFree;
|
virNWFilterObjListFree;
|
||||||
|
virNWFilterObjLoadAllConfigs;
|
||||||
virNWFilterObjLock;
|
virNWFilterObjLock;
|
||||||
virNWFilterObjRemove;
|
virNWFilterObjRemove;
|
||||||
|
virNWFilterObjTestUnassignDef;
|
||||||
virNWFilterObjUnlock;
|
virNWFilterObjUnlock;
|
||||||
virNWFilterTestUnassignDef;
|
|
||||||
|
|
||||||
|
|
||||||
# conf/virsecretobj.h
|
# conf/virsecretobj.h
|
||||||
|
@ -237,8 +237,7 @@ nwfilterStateInitialize(bool privileged,
|
|||||||
|
|
||||||
VIR_FREE(base);
|
VIR_FREE(base);
|
||||||
|
|
||||||
if (virNWFilterLoadAllConfigs(&driver->nwfilters,
|
if (virNWFilterObjLoadAllConfigs(&driver->nwfilters, driver->configDir) < 0)
|
||||||
driver->configDir) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
nwfilterDriverUnlock();
|
nwfilterDriverUnlock();
|
||||||
@ -290,8 +289,7 @@ nwfilterStateReload(void)
|
|||||||
virNWFilterWriteLockFilterUpdates();
|
virNWFilterWriteLockFilterUpdates();
|
||||||
virNWFilterCallbackDriversLock();
|
virNWFilterCallbackDriversLock();
|
||||||
|
|
||||||
virNWFilterLoadAllConfigs(&driver->nwfilters,
|
virNWFilterObjLoadAllConfigs(&driver->nwfilters, driver->configDir);
|
||||||
driver->configDir);
|
|
||||||
|
|
||||||
virNWFilterCallbackDriversUnlock();
|
virNWFilterCallbackDriversUnlock();
|
||||||
virNWFilterUnlockFilterUpdates();
|
virNWFilterUnlockFilterUpdates();
|
||||||
@ -595,7 +593,7 @@ nwfilterUndefine(virNWFilterPtr obj)
|
|||||||
if (virNWFilterUndefineEnsureACL(obj->conn, nwfilter->def) < 0)
|
if (virNWFilterUndefineEnsureACL(obj->conn, nwfilter->def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virNWFilterTestUnassignDef(nwfilter) < 0) {
|
if (virNWFilterObjTestUnassignDef(nwfilter) < 0) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s",
|
"%s",
|
||||||
_("nwfilter is in use"));
|
_("nwfilter is in use"));
|
||||||
|
Loading…
Reference in New Issue
Block a user