]> xenbits.xensource.com Git - libvirt.git/commitdiff
remote_driver: Return 'virLockGuard' from 'remoteDriverLock'
authorPeter Krempa <pkrempa@redhat.com>
Fri, 25 Feb 2022 13:12:46 +0000 (14:12 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 6 Jan 2023 14:30:09 +0000 (15:30 +0100)
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@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/remote/remote_driver.c

index b0dba9057b69c0df6a967c7846ab71730bfe0e81..8310326ad0d62ec4a083e210a0142cafe5c461cf 100644 (file)
@@ -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)