[PATCH 27/43] nwfilter: convert virMutex to GMutex

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

 



Signed-off-by: Rafael Fonseca <r4f4rfs@xxxxxxxxx>
---
 src/conf/virnwfilterobj.h      | 2 +-
 src/nwfilter/nwfilter_driver.c | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/conf/virnwfilterobj.h b/src/conf/virnwfilterobj.h
index a6bdfb3864..f862f78650 100644
--- a/src/conf/virnwfilterobj.h
+++ b/src/conf/virnwfilterobj.h
@@ -33,7 +33,7 @@ typedef virNWFilterObjList *virNWFilterObjListPtr;
 typedef struct _virNWFilterDriverState virNWFilterDriverState;
 typedef virNWFilterDriverState *virNWFilterDriverStatePtr;
 struct _virNWFilterDriverState {
-    virMutex lock;
+    GMutex lock;
     bool privileged;
 
     /* pid file FD, ensures two copies of the driver can't use the same root */
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 650ef19746..8dc928160b 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -70,11 +70,11 @@ static int nwfilterStateReload(void);
 
 static void nwfilterDriverLock(void)
 {
-    virMutexLock(&driver->lock);
+    g_mutex_lock(&driver->lock);
 }
 static void nwfilterDriverUnlock(void)
 {
-    virMutexUnlock(&driver->lock);
+    g_mutex_lock(&driver->lock);
 }
 
 #ifdef WITH_FIREWALLD
@@ -197,8 +197,7 @@ nwfilterStateInitialize(bool privileged,
         return VIR_DRV_STATE_INIT_ERROR;
 
     driver->lockFD = -1;
-    if (virMutexInit(&driver->lock) < 0)
-        goto err_free_driverstate;
+    g_mutex_init(&driver->lock);
 
     driver->privileged = privileged;
     if (!(driver->nwfilters = virNWFilterObjListNew()))
@@ -379,7 +378,7 @@ nwfilterStateCleanup(void)
     /* free inactive nwfilters */
     virNWFilterObjListFree(driver->nwfilters);
 
-    virMutexDestroy(&driver->lock);
+    g_mutex_clear(&driver->lock);
     VIR_FREE(driver);
 
     return 0;
-- 
2.25.2






[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