[libvirt PATCH v2 10/10] storage: Use automatic mutex management

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/storage/storage_driver.c | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index ee710f6b76..e3e1604311 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -65,16 +65,6 @@ struct _virStorageVolStreamInfo {
     char *vol_path;
 };
 
-static void storageDriverLock(void)
-{
-    virMutexLock(&driver->lock);
-}
-static void storageDriverUnlock(void)
-{
-    virMutexUnlock(&driver->lock);
-}
-
-
 static void
 storagePoolRefreshFailCleanup(virStorageBackend *backend,
                               virStoragePoolObj *obj,
@@ -348,14 +338,13 @@ storageStateReload(void)
     if (!driver)
         return -1;
 
-    storageDriverLock();
-    virStoragePoolObjLoadAllState(driver->pools,
-                                  driver->stateDir);
-    virStoragePoolObjLoadAllConfigs(driver->pools,
-                                    driver->configDir,
-                                    driver->autostartDir);
-    storageDriverAutostart();
-    storageDriverUnlock();
+    VIR_WITH_MUTEX_LOCK_GUARD(&driver->lock) {
+        virStoragePoolObjLoadAllState(driver->pools, driver->stateDir);
+        virStoragePoolObjLoadAllConfigs(driver->pools,
+                                        driver->configDir,
+                                        driver->autostartDir);
+        storageDriverAutostart();
+    }
 
     return 0;
 }
-- 
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