[PATCH 29/43] storage: convert virMutex to GMutex

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

 



Signed-off-by: Rafael Fonseca <r4f4rfs@xxxxxxxxx>
---
 src/conf/virstorageobj.h     |  2 +-
 src/storage/storage_driver.c | 11 ++++-------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/conf/virstorageobj.h b/src/conf/virstorageobj.h
index 54100ac22a..0f1f7c3d8d 100644
--- a/src/conf/virstorageobj.h
+++ b/src/conf/virstorageobj.h
@@ -35,7 +35,7 @@ typedef struct _virStorageDriverState virStorageDriverState;
 typedef virStorageDriverState *virStorageDriverStatePtr;
 
 struct _virStorageDriverState {
-    virMutex lock;
+    GMutex lock;
 
     /* pid file FD, ensures two copies of the driver can't use the same root */
     int lockFD;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 2db763caa5..3a2816dede 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -68,11 +68,11 @@ struct _virStorageVolStreamInfo {
 
 static void storageDriverLock(void)
 {
-    virMutexLock(&driver->lock);
+    g_mutex_lock(&driver->lock);
 }
 static void storageDriverUnlock(void)
 {
-    virMutexUnlock(&driver->lock);
+    g_mutex_unlock(&driver->lock);
 }
 
 
@@ -269,10 +269,7 @@ storageStateInitialize(bool privileged,
         return VIR_DRV_STATE_INIT_ERROR;
 
     driver->lockFD = -1;
-    if (virMutexInit(&driver->lock) < 0) {
-        VIR_FREE(driver);
-        return VIR_DRV_STATE_INIT_ERROR;
-    }
+    g_mutex_init(&driver->lock);
     storageDriverLock();
 
     if (!(driver->pools = virStoragePoolObjListNew()))
@@ -391,7 +388,7 @@ storageStateCleanup(void)
     VIR_FREE(driver->autostartDir);
     VIR_FREE(driver->stateDir);
     storageDriverUnlock();
-    virMutexDestroy(&driver->lock);
+    g_mutex_clear(&driver->lock);
     VIR_FREE(driver);
 
     return 0;
-- 
2.25.2






[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