[PATCH v1 10/23] lock_daemon: Switch to wrapper locking functions

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

 



Lets use wrapper functions virLockDaemonLock and
virLockDaemonUnlock instead of virMutexLock and virMutexUnlock.
This has no functional impact, but it's easier to read (at least
for me).

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/locking/lock_daemon.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 56db959..3984b4d 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -125,6 +125,17 @@ virLockDaemonFree(virLockDaemonPtr lockd)
     VIR_FREE(lockd);
 }
 
+static void
+virLockDaemonLock(virLockDaemonPtr lockd)
+{
+    virMutexLock(&lockd->lock);
+}
+
+static void
+virLockDaemonUnlock(virLockDaemonPtr lockd)
+{
+    virMutexUnlock(&lockd->lock);
+}
 
 static void virLockDaemonLockSpaceDataFree(void *data,
                                            const void *key ATTRIBUTE_UNUSED)
@@ -275,9 +286,9 @@ int virLockDaemonAddLockSpace(virLockDaemonPtr lockd,
                               virLockSpacePtr lockspace)
 {
     int ret;
-    virMutexLock(&lockd->lock);
+    virLockDaemonLock(lockd);
     ret = virHashAddEntry(lockd->lockspaces, path, lockspace);
-    virMutexUnlock(&lockd->lock);
+    virLockDaemonUnlock(lockd);
     return ret;
 }
 
@@ -285,12 +296,12 @@ virLockSpacePtr virLockDaemonFindLockSpace(virLockDaemonPtr lockd,
                                            const char *path)
 {
     virLockSpacePtr lockspace;
-    virMutexLock(&lockd->lock);
+    virLockDaemonLock(lockd);
     if (path && STRNEQ(path, ""))
         lockspace = virHashLookup(lockd->lockspaces, path);
     else
         lockspace = lockd->defaultLockspace;
-    virMutexUnlock(&lockd->lock);
+    virLockDaemonUnlock(lockd);
     return lockspace;
 }
 
@@ -675,14 +686,14 @@ virLockDaemonClientFree(void *opaque)
 
         /* Release all locks associated with this
          * owner in all lockspaces */
-        virMutexLock(&lockDaemon->lock);
+        virLockDaemonLock(lockDaemon);
         virHashForEach(lockDaemon->lockspaces,
                        virLockDaemonClientReleaseLockspace,
                        &data);
         virLockDaemonClientReleaseLockspace(lockDaemon->defaultLockspace,
                                             "",
                                             &data);
-        virMutexUnlock(&lockDaemon->lock);
+        virLockDaemonUnlock(lockDaemon);
 
         /* If the client had some active leases when it
          * closed the connection, we must kill it off
-- 
2.4.9

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



[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]