[libvirt PATCH 04/10] virStorageVolObjNew: Move locking to usage site

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

 



This allows a later patch to replace virObjectLock/Unlock
pairs with automatic mutex management code.

Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/virstorageobj.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 108ae0aeb1..c837f96ae6 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -125,16 +125,10 @@ VIR_ONCE_GLOBAL_INIT(virStorageVolObj);
 static virStorageVolObj *
 virStorageVolObjNew(void)
 {
-    virStorageVolObj *obj;
-
     if (virStorageVolObjInitialize() < 0)
         return NULL;
 
-    if (!(obj = virObjectLockableNew(virStorageVolObjClass)))
-        return NULL;
-
-    virObjectLock(obj);
-    return obj;
+    return virObjectLockableNew(virStorageVolObjClass);
 }
 
 
@@ -638,6 +632,8 @@ virStoragePoolObjAddVol(virStoragePoolObj *obj,
         return -1;
     }
 
+    virObjectLock(volobj);
+
     g_hash_table_insert(volumes->objsKey, g_strdup(voldef->key), volobj);
     virObjectRef(volobj);
 
-- 
2.31.1




[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