[PATCH 23/43] tests: qemusecuritymock: convert virMutex to GMutex

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

 



Signed-off-by: Rafael Fonseca <r4f4rfs@xxxxxxxxx>
---
 tests/qemusecuritymock.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/tests/qemusecuritymock.c b/tests/qemusecuritymock.c
index ad182c7bf7..0aef565bf9 100644
--- a/tests/qemusecuritymock.c
+++ b/tests/qemusecuritymock.c
@@ -57,7 +57,7 @@ static int (*real_close)(int fd);
 
 
 /* Global mutex to avoid races */
-virMutex m = VIR_MUTEX_INITIALIZER;
+G_LOCK_DEFINE(m);
 
 /* Hash table to store XATTRs for paths. For simplicity, key is
  * "$path:$name" and value is just XATTR "$value". We don't need
@@ -134,7 +134,7 @@ virFileGetXAttrQuiet(const char *path,
 
     key = get_key(path, name);
 
-    virMutexLock(&m);
+    G_LOCK(m);
     init_syms();
     init_hash();
 
@@ -147,7 +147,7 @@ virFileGetXAttrQuiet(const char *path,
 
     ret = 0;
  cleanup:
-    virMutexUnlock(&m);
+    G_UNLOCK(m);
     VIR_FREE(key);
     return ret;
 }
@@ -192,7 +192,7 @@ int virFileSetXAttr(const char *path,
     key = get_key(path, name);
     val = g_strdup(value);
 
-    virMutexLock(&m);
+    G_LOCK(m);
     init_syms();
     init_hash();
 
@@ -202,7 +202,7 @@ int virFileSetXAttr(const char *path,
 
     ret = 0;
  cleanup:
-    virMutexUnlock(&m);
+    G_UNLOCK(m);
     VIR_FREE(val);
     VIR_FREE(key);
     return ret;
@@ -217,14 +217,14 @@ int virFileRemoveXAttr(const char *path,
 
     key = get_key(path, name);
 
-    virMutexLock(&m);
+    G_LOCK(m);
     init_syms();
     init_hash();
 
     if ((ret = virHashRemoveEntry(xattr_paths, key)) < 0)
         errno = ENODATA;
 
-    virMutexUnlock(&m);
+    G_UNLOCK(m);
     VIR_FREE(key);
     return ret;
 }
@@ -235,7 +235,7 @@ int virFileRemoveXAttr(const char *path,
         if (getenv(ENVVAR)) { \
             uint32_t *val; \
 \
-            virMutexLock(&m); \
+            G_LOCK(m); \
             init_hash(); \
 \
             memset(sb, 0, sizeof(*sb)); \
@@ -254,7 +254,7 @@ int virFileRemoveXAttr(const char *path,
                 sb->st_gid = *val >> 16; \
             } \
 \
-            virMutexUnlock(&m); \
+            G_UNLOCK(m); \
 \
             return 0; \
         } \
@@ -279,7 +279,7 @@ mock_chown(const char *path,
 
     *val = (gid << 16) + uid;
 
-    virMutexLock(&m);
+    G_LOCK(m);
     init_hash();
 
     if (virHashUpdateEntry(chown_paths, path, val) < 0)
@@ -288,7 +288,7 @@ mock_chown(const char *path,
 
     ret = 0;
  cleanup:
-    virMutexUnlock(&m);
+    G_UNLOCK(m);
     VIR_FREE(val);
     return ret;
 }
@@ -440,7 +440,7 @@ int checkPaths(const char **paths)
     bool xattr_fail = false;
     size_t i;
 
-    virMutexLock(&m);
+    G_LOCK(m);
     init_hash();
 
     for (i = 0; paths && paths[i]; i++) {
@@ -461,20 +461,20 @@ int checkPaths(const char **paths)
 
     ret = 0;
  cleanup:
-    virMutexUnlock(&m);
+    G_UNLOCK(m);
     return ret;
 }
 
 
 void freePaths(void)
 {
-    virMutexLock(&m);
+    G_LOCK(m);
     init_hash();
 
     virHashFree(chown_paths);
     virHashFree(xattr_paths);
     chown_paths = xattr_paths = NULL;
-    virMutexUnlock(&m);
+    G_UNLOCK(m);
 }
 
 
-- 
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