[libvirt] [PATCH 04/14] secret: Have virSecretObjNew return locked object

John Ferlan posted 14 patches 8 years, 9 months ago
[libvirt] [PATCH 04/14] secret: Have virSecretObjNew return locked object
Posted by John Ferlan 8 years, 9 months ago
Rather than have caller need to do it, have the object returned locked.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/conf/virsecretobj.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c
index 064e66c..348feb3 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -97,6 +97,8 @@ virSecretObjNew(void)
     if (!(secret = virObjectLockableNew(virSecretObjClass)))
         return NULL;
 
+    virObjectLock(secret);
+
     return secret;
 }
 
@@ -367,8 +369,6 @@ virSecretObjListAddLocked(virSecretObjListPtr secrets,
         if (!(secret = virSecretObjNew()))
             goto cleanup;
 
-        virObjectLock(secret);
-
         if (virHashAddEntry(secrets->objs, uuidstr, secret) < 0)
             goto cleanup;
 
-- 
2.9.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 04/14] secret: Have virSecretObjNew return locked object
Posted by Pavel Hrdina 8 years, 9 months ago
On Mon, Apr 24, 2017 at 02:00:13PM -0400, John Ferlan wrote:
> Rather than have caller need to do it, have the object returned locked.
> 
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/conf/virsecretobj.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

ACK

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list