[PATCH 15/36] remote_driver: Return 'virLockGuard' from 'remoteDriverLock'

Peter Krempa pkrempa at redhat.com
Thu Jan 5 16:30:04 UTC 2023


The function currently didn't have a return value. Returning the
'virLockGuard' struct allows the callers to use automatic unlocking of
the mutex.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/remote/remote_driver.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index b0dba9057b..8310326ad0 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -105,9 +105,17 @@ enum {
 };


-static void remoteDriverLock(struct private_data *driver)
+/**
+ * remoteDriverLock:
+ * @driver: private data of the remote driver
+ *
+ * Locks the internal mutex of the private driver. Callers may optionally use
+ * the returned virLockGuard struct to automatically unlock the driver.
+ */
+static virLockGuard
+remoteDriverLock(struct private_data *driver)
 {
-    virMutexLock(&driver->lock);
+    return virLockGuardLock(&driver->lock);
 }

 static void remoteDriverUnlock(struct private_data *driver)
-- 
2.38.1



More information about the libvir-list mailing list