[PATCH 10/14] secret: Combine virSecretObjListAdd with Locked function

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

 



There's no need to separate, so just have one.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 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 3717552..5acda4c 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -301,7 +301,7 @@ virSecretObjListRemove(virSecretObjListPtr secrets,
 
 
 /*
- * virSecretObjListAddLocked:
+ * virSecretObjListAdd:
  * @secrets: list of secret objects
  * @newdef: new secret definition
  * @configDir: directory to place secret config files
@@ -309,15 +309,13 @@ virSecretObjListRemove(virSecretObjListPtr secrets,
  *
  * Add the new @newdef to the secret obj table hash
  *
- * This functions requires @secrets to be locked already!
- *
- * Returns: locked 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;
@@ -325,6 +323,8 @@ virSecretObjListAddLocked(virSecretObjListPtr secrets,
     char uuidstr[VIR_UUID_STRING_BUFLEN];
     char *configFile = NULL, *base64File = NULL;
 
+    virObjectLock(secrets);
+
     if (oldDef)
         *oldDef = NULL;
 
@@ -396,22 +396,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

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