[libvirt PATCH 10/11] bhyve_driver: Use automatic mutex management

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/bhyve/bhyve_conf.c   |  7 ++-----
 src/bhyve/bhyve_driver.c | 12 ------------
 src/bhyve/bhyve_utils.h  |  3 ---
 3 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/src/bhyve/bhyve_conf.c b/src/bhyve/bhyve_conf.c
index 5eca0855f0..28981c90b7 100644
--- a/src/bhyve/bhyve_conf.c
+++ b/src/bhyve/bhyve_conf.c
@@ -85,11 +85,8 @@ virBhyveLoadDriverConfig(struct _virBhyveDriverConfig *cfg,
 struct _virBhyveDriverConfig *
 virBhyveDriverGetConfig(struct _bhyveConn *driver)
 {
-    struct _virBhyveDriverConfig *cfg;
-    bhyveDriverLock(driver);
-    cfg = virObjectRef(driver->config);
-    bhyveDriverUnlock(driver);
-    return cfg;
+    VIR_LOCK_GUARD lock = virLockGuardLock(&driver->lock);
+    return virObjectRef(driver->config);
 }
 
 static void
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 47ee98e650..f580e87419 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -70,18 +70,6 @@ VIR_LOG_INIT("bhyve.bhyve_driver");
 
 struct _bhyveConn *bhyve_driver = NULL;
 
-void
-bhyveDriverLock(struct _bhyveConn *driver)
-{
-    virMutexLock(&driver->lock);
-}
-
-void
-bhyveDriverUnlock(struct _bhyveConn *driver)
-{
-    virMutexUnlock(&driver->lock);
-}
-
 static int
 bhyveAutostartDomain(virDomainObj *vm, void *opaque)
 {
diff --git a/src/bhyve/bhyve_utils.h b/src/bhyve/bhyve_utils.h
index af7b15486a..5d6e198b09 100644
--- a/src/bhyve/bhyve_utils.h
+++ b/src/bhyve/bhyve_utils.h
@@ -73,6 +73,3 @@ struct bhyveAutostartData {
     struct _bhyveConn *driver;
     virConnectPtr conn;
 };
-
-void bhyveDriverLock(struct _bhyveConn *driver);
-void bhyveDriverUnlock(struct _bhyveConn *driver);
-- 
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