Move into virnwfilterobj, rename the API to
virNWFilterObjSaveConfig,
and reorder the arguments.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/nwfilter_conf.c | 20 --------------------
src/conf/nwfilter_conf.h | 4 ----
src/conf/virnwfilterobj.c | 23 ++++++++++++++++++++++-
src/conf/virnwfilterobj.h | 4 ++++
src/libvirt_private.syms | 3 ++-
src/nwfilter/nwfilter_driver.c | 2 +-
6 files changed, 29 insertions(+), 27 deletions(-)
I don't see any benefit of moving the function, it operates only on
virNWFilterDefPtr so the current place is suitable and passing the whole
obj instead of def doesn't improve anything, unless there is some other
agenda and some future patches will benefit from this change.
Pavel
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 6b67c3a..8925b2b 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2780,26 +2780,6 @@ virNWFilterSaveXML(const char *configFile,
}
-int
-virNWFilterSaveConfig(const char *configFile,
- virNWFilterDefPtr def)
-{
- int ret = -1;
- char *xml;
-
- if (!(xml = virNWFilterDefFormat(def)))
- goto cleanup;
-
- if (virNWFilterSaveXML(configFile, def, xml) < 0)
- goto cleanup;
-
- ret = 0;
- cleanup:
- VIR_FREE(xml);
- return ret;
-}
-
-
int nCallbackDriver;
#define MAX_CALLBACK_DRIVER 10
static virNWFilterCallbackDriverPtr callbackDrvArray[MAX_CALLBACK_DRIVER];
diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index 5a3f008..2287689 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -585,10 +585,6 @@ virNWFilterSaveXML(const char *configFile,
virNWFilterDefPtr def,
const char *xml);
-int
-virNWFilterSaveConfig(const char *configFile,
- virNWFilterDefPtr def);
-
virNWFilterDefPtr
virNWFilterDefParseString(const char *xml);
diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index e37acf0..898ca7f 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -487,6 +487,27 @@ virNWFilterObjListExport(virConnectPtr conn,
}
+int
+virNWFilterObjSaveConfig(virNWFilterObjPtr obj,
+ const char *configFile)
+{
+ virNWFilterDefPtr def = obj->def;
+ int ret = -1;
+ char *xml;
+
+ if (!(xml = virNWFilterDefFormat(def)))
+ goto cleanup;
+
+ if (virNWFilterSaveXML(configFile, def, xml) < 0)
+ goto cleanup;
+
+ ret = 0;
+ cleanup:
+ VIR_FREE(xml);
+ return ret;
+}
+
+
static virNWFilterObjPtr
virNWFilterObjListLoadConfig(virNWFilterObjListPtr nwfilters,
const char *configDir,
@@ -515,7 +536,7 @@ virNWFilterObjListLoadConfig(virNWFilterObjListPtr nwfilters,
/* We generated a UUID, make it permanent by saving the config to disk */
if (!def->uuid_specified &&
- virNWFilterSaveConfig(configFile, def) < 0)
+ virNWFilterObjSaveConfig(obj, configFile) < 0)
goto error;
VIR_FREE(configFile);
diff --git a/src/conf/virnwfilterobj.h b/src/conf/virnwfilterobj.h
index 29d9086..f6a14de 100644
--- a/src/conf/virnwfilterobj.h
+++ b/src/conf/virnwfilterobj.h
@@ -98,6 +98,10 @@ virNWFilterObjListExport(virConnectPtr conn,
virNWFilterObjListFilter aclfilter);
int
+virNWFilterObjSaveConfig(virNWFilterObjPtr obj,
+ const char *configFile);
+
+int
virNWFilterObjListLoadAllConfigs(virNWFilterObjListPtr nwfilters,
const char *configDir);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 170ecce..4b334a9 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -740,7 +740,7 @@ virNWFilterRuleIsProtocolEthernet;
virNWFilterRuleIsProtocolIPv4;
virNWFilterRuleIsProtocolIPv6;
virNWFilterRuleProtocolTypeToString;
-virNWFilterSaveConfig;
+virNWFilterSaveXML;
virNWFilterTriggerVMFilterRebuild;
virNWFilterUnlockFilterUpdates;
virNWFilterUnRegisterCallbackDriver;
@@ -975,6 +975,7 @@ virNWFilterObjListNew;
virNWFilterObjListNumOfNWFilters;
virNWFilterObjListRemove;
virNWFilterObjLock;
+virNWFilterObjSaveConfig;
virNWFilterObjTestUnassignDef;
virNWFilterObjUnlock;
virNWFilterObjWantRemoved;
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 97d6952..31e4867 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -521,7 +521,7 @@ nwfilterDefineXML(virConnectPtr conn,
def = NULL;
objdef = virNWFilterObjGetDef(obj);
- if (virNWFilterSaveConfig(configFile, objdef) < 0) {
+ if (virNWFilterObjSaveConfig(obj, configFile) < 0) {
virNWFilterObjListRemove(driver->nwfilters, obj);
goto cleanup;
}
--
2.9.3
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list