There's no need to separate, so just have one.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/virsecretobj.c | 34 ++++++++++------------------------
1 file changed, 10 insertions(+), 24 deletions(-)
diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c
index e9a36b2..0311335 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -319,7 +319,7 @@ virSecretObjListRemove(virSecretObjListPtr secrets,
/*
- * virSecretObjListAddLocked:
+ * virSecretObjListAdd:
* @secrets: list of secret objects
* @newdef: new secret definition
* @configDir: directory to place secret config files
@@ -327,15 +327,13 @@ virSecretObjListRemove(virSecretObjListPtr secrets,
*
* Add the new @newdef to the secret obj table hash
*
- * This functions requires @secrets to be locked already!
- *
- * Returns pointer to secret or NULL if failure to add
+ * Returns: locked and ref'd secret or NULL if failure to add
*/
-static virSecretObjPtr
-virSecretObjListAddLocked(virSecretObjListPtr secrets,
- virSecretDefPtr newdef,
- const char *configDir,
- virSecretDefPtr *oldDef)
+virSecretObjPtr
+virSecretObjListAdd(virSecretObjListPtr secrets,
+ virSecretDefPtr newdef,
+ const char *configDir,
+ virSecretDefPtr *oldDef)
{
virSecretObjPtr obj;
virSecretDefPtr def;
@@ -343,6 +341,8 @@ virSecretObjListAddLocked(virSecretObjListPtr secrets,
char uuidstr[VIR_UUID_STRING_BUFLEN];
char *configFile = NULL, *base64File = NULL;
+ virObjectLock(secrets);
+
if (oldDef)
*oldDef = NULL;
@@ -414,22 +414,8 @@ virSecretObjListAddLocked(virSecretObjListPtr secrets,
virSecretObjEndAPI(&obj);
VIR_FREE(configFile);
VIR_FREE(base64File);
- return ret;
-}
-
-
-virSecretObjPtr
-virSecretObjListAdd(virSecretObjListPtr secrets,
- virSecretDefPtr newdef,
- const char *configDir,
- virSecretDefPtr *oldDef)
-{
- virSecretObjPtr obj;
-
- virObjectLock(secrets);
- obj = virSecretObjListAddLocked(secrets, newdef, configDir, oldDef);
virObjectUnlock(secrets);
- return obj;
+ return ret;
}
--
2.9.3