]> xenbits.xensource.com Git - libvirt.git/commitdiff
bhyve_driver: Use automatic mutex management
authorTim Wiederhake <twiederh@redhat.com>
Mon, 7 Feb 2022 09:42:57 +0000 (10:42 +0100)
committerTim Wiederhake <twiederh@redhat.com>
Fri, 11 Feb 2022 10:04:07 +0000 (11:04 +0100)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/bhyve/bhyve_conf.c
src/bhyve/bhyve_driver.c
src/bhyve/bhyve_utils.h

index 5eca0855f07943fa35dd8553d923d90ca776d0b9..28981c90b750502769d799406e42d0c10b8b950a 100644 (file)
@@ -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
index 578fcfe1d2a288dba40bd74451b6d8f0f5797473..51973ae670002f0cd180b716e8ce8d63a3cc42ac 100644 (file)
@@ -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)
 {
index af7b15486ad755e02f0f610601075433fa566e97..5d6e198b09af3374853b535e889e0adcc8a50fbe 100644 (file)
@@ -73,6 +73,3 @@ struct bhyveAutostartData {
     struct _bhyveConn *driver;
     virConnectPtr conn;
 };
-
-void bhyveDriverLock(struct _bhyveConn *driver);
-void bhyveDriverUnlock(struct _bhyveConn *driver);