From nobody Mon Feb 9 16:51:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1586527003; cv=none; d=zohomail.com; s=zohoarc; b=F20CCfA5+U2u7AAGuK0MEv4eOmKRfvPlm0vcLUEreLhzk5TWVbVu1/b0Muh2wsVgi2/wZohH+VWLtFbFZveDksrrRRorBJ0YvIew0uP3HEacBrtATsSFwX6ATTDzGUv6pebiUnX9RnrdESeaICTS7rUCsVMPRi2lI5xcUoWC2x4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527003; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=B3PO9wqiy8o0Ig4NenujtTuE/KPUOOtceocZAA2tf2Y=; b=LR0zAPGxDR2nghucLE89hiaW2G+XX7D8TcLPUm3bjAkjslbIk84iwfQm0kR/8pu+ZMwKz442mvLR7nKE4EnxSa8GLZ/3LPkOqlkYmRUKDr7WrkydNOQmNEIpzPgJkVckpKljcRa/OQSDsDvRYMTZ/ijzJcW7NA5z0dYe8XdWixE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1586527003797583.4371903729885; Fri, 10 Apr 2020 06:56:43 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-141-HQiFahzHOUGYAWt69EgItw-1; Fri, 10 Apr 2020 09:56:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F0CE21060DB8; Fri, 10 Apr 2020 13:56:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C067B60C87; Fri, 10 Apr 2020 13:56:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 70151944DC; Fri, 10 Apr 2020 13:56:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADu1Ym023136 for ; Fri, 10 Apr 2020 09:56:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id B7979127513; Fri, 10 Apr 2020 13:56:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B3C15127512 for ; Fri, 10 Apr 2020 13:56:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B0268FF663 for ; Fri, 10 Apr 2020 13:56:01 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-9QqynN0uNp2XxOiH9xLN-g-1; Fri, 10 Apr 2020 09:55:59 -0400 Received: by mail-wr1-f67.google.com with SMTP id c15so2353349wro.11 for ; Fri, 10 Apr 2020 06:55:58 -0700 (PDT) Received: from localhost.localdomain (public-gprs377075.centertel.pl. [37.47.104.52]) by smtp.gmail.com with ESMTPSA id c11sm3066319wrt.24.2020.04.10.06.55.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527002; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=B3PO9wqiy8o0Ig4NenujtTuE/KPUOOtceocZAA2tf2Y=; b=FsKTQwQHlalEuNWCtyuQl2qdCcBtgig4+QcnJSPawN5gPaftO9YQxq4fQqcccEpQC+Wlcm qChCL8RnpIsF/eMXSXKPhrZmTwWuaF3redaXfJ6eVVgANSN63WtcG9FBwEYimEAtfJhHAL 8qqNzaeMEQSA/Zyn0ibXVKPICcQ0c5s= X-MC-Unique: HQiFahzHOUGYAWt69EgItw-1 X-MC-Unique: 9QqynN0uNp2XxOiH9xLN-g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JPpo5uNF69GG52qmfI9CjoB8wZ/WIYpPFZ7wOeB+ppc=; b=uePMAfaI6WKQ4iBwBDdROkD0xJdiE/V5PoQtcERTATDL0j8oFiIo4wg/H8yBZbR/Ke x7Mi/DjGdg/MToeu7rOwW6hWpDkwCdQz2vOw083yyQmwm+kMuhim45RUgu6oEt1P9Gz+ pTMR/PfpjgPGxkDP5R2rIYjN+pVycC0/NMLBsuQozYSX9BUaLlQ1V9MJzAME3Roo+d5B LQsR5A/HNKtG7Ncop6Nw6MySm0UR/OMIyJMr3GThFWB/G2M8Sj/ogS/7HqIrHsK/P5hc sRXC7hfc1J/7nZ00n9EwykJ1PZ1H4E5OVLyDaGHQ8T6SZTzq1BsL+d9Qw+V39AvkNyUL vBig== X-Gm-Message-State: AGi0PuYCvaaNGOXwdy0pL6MDtGcL/NJ/w9AhpC/2uwR0+cfpVGhyZYDv w0vrx0jnr8tWVTarDBm23Iz4Uskxi24= X-Google-Smtp-Source: APiQypIuRkoJKJp+gNfRqR1TYZ412r4P7lddJe4yIk+ZM34bBA7rE7Z9eZVFkFYAq6oVx5fTnI7xmA== X-Received: by 2002:a5d:658e:: with SMTP id q14mr4939207wru.92.1586526957601; Fri, 10 Apr 2020 06:55:57 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 23/43] tests: qemusecuritymock: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:50 +0200 Message-Id: <20200410135510.2148319-24-r4f4rfs@gmail.com> In-Reply-To: <20200410135510.2148319-1-r4f4rfs@gmail.com> References: <20200410135510.2148319-1-r4f4rfs@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADu1Ym023136 X-loop: libvir-list@redhat.com Cc: Rafael Fonseca X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Rafael Fonseca --- tests/qemusecuritymock.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/qemusecuritymock.c b/tests/qemusecuritymock.c index ad182c7bf7..0aef565bf9 100644 --- a/tests/qemusecuritymock.c +++ b/tests/qemusecuritymock.c @@ -57,7 +57,7 @@ static int (*real_close)(int fd); =20 =20 /* Global mutex to avoid races */ -virMutex m =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE(m); =20 /* Hash table to store XATTRs for paths. For simplicity, key is * "$path:$name" and value is just XATTR "$value". We don't need @@ -134,7 +134,7 @@ virFileGetXAttrQuiet(const char *path, =20 key =3D get_key(path, name); =20 - virMutexLock(&m); + G_LOCK(m); init_syms(); init_hash(); =20 @@ -147,7 +147,7 @@ virFileGetXAttrQuiet(const char *path, =20 ret =3D 0; cleanup: - virMutexUnlock(&m); + G_UNLOCK(m); VIR_FREE(key); return ret; } @@ -192,7 +192,7 @@ int virFileSetXAttr(const char *path, key =3D get_key(path, name); val =3D g_strdup(value); =20 - virMutexLock(&m); + G_LOCK(m); init_syms(); init_hash(); =20 @@ -202,7 +202,7 @@ int virFileSetXAttr(const char *path, =20 ret =3D 0; cleanup: - virMutexUnlock(&m); + G_UNLOCK(m); VIR_FREE(val); VIR_FREE(key); return ret; @@ -217,14 +217,14 @@ int virFileRemoveXAttr(const char *path, =20 key =3D get_key(path, name); =20 - virMutexLock(&m); + G_LOCK(m); init_syms(); init_hash(); =20 if ((ret =3D virHashRemoveEntry(xattr_paths, key)) < 0) errno =3D ENODATA; =20 - virMutexUnlock(&m); + G_UNLOCK(m); VIR_FREE(key); return ret; } @@ -235,7 +235,7 @@ int virFileRemoveXAttr(const char *path, if (getenv(ENVVAR)) { \ uint32_t *val; \ \ - virMutexLock(&m); \ + G_LOCK(m); \ init_hash(); \ \ memset(sb, 0, sizeof(*sb)); \ @@ -254,7 +254,7 @@ int virFileRemoveXAttr(const char *path, sb->st_gid =3D *val >> 16; \ } \ \ - virMutexUnlock(&m); \ + G_UNLOCK(m); \ \ return 0; \ } \ @@ -279,7 +279,7 @@ mock_chown(const char *path, =20 *val =3D (gid << 16) + uid; =20 - virMutexLock(&m); + G_LOCK(m); init_hash(); =20 if (virHashUpdateEntry(chown_paths, path, val) < 0) @@ -288,7 +288,7 @@ mock_chown(const char *path, =20 ret =3D 0; cleanup: - virMutexUnlock(&m); + G_UNLOCK(m); VIR_FREE(val); return ret; } @@ -440,7 +440,7 @@ int checkPaths(const char **paths) bool xattr_fail =3D false; size_t i; =20 - virMutexLock(&m); + G_LOCK(m); init_hash(); =20 for (i =3D 0; paths && paths[i]; i++) { @@ -461,20 +461,20 @@ int checkPaths(const char **paths) =20 ret =3D 0; cleanup: - virMutexUnlock(&m); + G_UNLOCK(m); return ret; } =20 =20 void freePaths(void) { - virMutexLock(&m); + G_LOCK(m); init_hash(); =20 virHashFree(chown_paths); virHashFree(xattr_paths); chown_paths =3D xattr_paths =3D NULL; - virMutexUnlock(&m); + G_UNLOCK(m); } =20 =20 --=20 2.25.2