On Fri, Apr 10, 2020 at 03:54:33PM +0200, Rafael Fonseca wrote:
Signed-off-by: Rafael Fonseca <r4f4rfs(a)gmail.com>
---
src/util/virtpm.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/util/virtpm.c b/src/util/virtpm.c
index c734bf941a..5fd6396f2f 100644
--- a/src/util/virtpm.c
+++ b/src/util/virtpm.c
@@ -91,7 +91,7 @@ virTPMCreateCancelPath(const char *devpath)
* executables for the swtpm; to be found on the host along with
* capabilties bitmap
*/
-static virMutex swtpm_tools_lock = VIR_MUTEX_INITIALIZER;
+G_LOCK_DEFINE_STATIC(swtpm_tools_lock);
static char *swtpm_path;
static struct stat swtpm_stat;
static virBitmapPtr swtpm_caps;
@@ -113,9 +113,9 @@ virTPMGetSwtpm(void)
if (!swtpm_path && virTPMEmulatorInit() < 0)
return NULL;
- virMutexLock(&swtpm_tools_lock);
+ G_LOCK(swtpm_tools_lock);
s = g_strdup(swtpm_path);
- virMutexUnlock(&swtpm_tools_lock);
+ G_UNLOCK(swtpm_tools_lock);
return s;
}
@@ -128,9 +128,9 @@ virTPMGetSwtpmSetup(void)
if (!swtpm_setup && virTPMEmulatorInit() < 0)
return NULL;
- virMutexLock(&swtpm_tools_lock);
+ G_LOCK(swtpm_tools_lock);
s = g_strdup(swtpm_setup);
- virMutexUnlock(&swtpm_tools_lock);
+ G_UNLOCK(swtpm_tools_lock);
return s;
}
@@ -143,9 +143,9 @@ virTPMGetSwtpmIoctl(void)
if (!swtpm_ioctl && virTPMEmulatorInit() < 0)
return NULL;
- virMutexLock(&swtpm_tools_lock);
+ G_LOCK(swtpm_tools_lock);
s = g_strdup(swtpm_ioctl);
- virMutexUnlock(&swtpm_tools_lock);
+ G_UNLOCK(swtpm_tools_lock);
return s;
}
@@ -284,7 +284,7 @@ virTPMEmulatorInit(void)
};
size_t i;
- virMutexLock(&swtpm_tools_lock);
+ G_LOCK(swtpm_tools_lock);
for (i = 0; i < G_N_ELEMENTS(prgs); i++) {
g_autofree char *path = NULL;
@@ -341,7 +341,7 @@ virTPMEmulatorInit(void)
ret = 0;
cleanup:
- virMutexUnlock(&swtpm_tools_lock);
+ G_UNLOCK(swtpm_tools_lock);
return ret;
}
--
2.25.2
Reviewed-by: Pavel Mores <pmores(a)redhat.com>