From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586526952; cv=none; d=zohomail.com; s=zohoarc; b=lZ6jNdzo98nWCCjYGV+kOwFIv2LC/yHEUi95c5bXT2XkSnROm1kWXE269KUxYYmow3fCctyPFIOphGvdCpmX8okO3+p01QYuCx3WNuu1FzjahutbueWhHjw7lMR10aRe6wfnt6R2+oOcvfytAVQwNG/L2mOkaIRfmNljH2Z7YJc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526952; 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=kFZfW2uxs3+o5ZbEfHFivQievMWZCujVjs3VFI5ATRc=; b=QG4XoTxw0zu1LKwb3OerRM+VeTrLHf1JjfIC2LFGweuTlv+ZipvQfXRIzSTZHAHRcIW8/kx1aMBZGKavmgp0AF+Exew1874Z+W7uxDaG6uyKv3MKJDhgs+UY/NpugE6I0FCHbKpNcsrX6+xJ2h7YZ8Jl0KktwWuKbxSJS8ciHno= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586526952208609.0049325947426; Fri, 10 Apr 2020 06:55:52 -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-170-ymuIAhM4MLG2wYq5lElbtg-1; Fri, 10 Apr 2020 09:55:48 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 835FC800D5B; Fri, 10 Apr 2020 13:55:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 50CB3C0D8D; Fri, 10 Apr 2020 13:55:43 +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 43ED318089C8; Fri, 10 Apr 2020 13:55:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtbrI022871 for ; Fri, 10 Apr 2020 09:55:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 311EC20230A6; Fri, 10 Apr 2020 13:55:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C9B3202A940 for ; Fri, 10 Apr 2020 13:55:34 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 8A37B800294 for ; Fri, 10 Apr 2020 13:55:34 +0000 (UTC) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-9-jCZOmi2oO76USAGayfIguw-1; Fri, 10 Apr 2020 09:55:31 -0400 Received: by mail-wr1-f68.google.com with SMTP id 65so2413442wrl.1 for ; Fri, 10 Apr 2020 06:55:31 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526951; 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=kFZfW2uxs3+o5ZbEfHFivQievMWZCujVjs3VFI5ATRc=; b=Yhw24FKyKzpoDqJQbd/L1xay1h9Mwsl9aqEXX+Dgj+VSs+ZARYh+R1crbK9M3NQE22mIy+ vb8egOD6HQG4tt5XxPUCuSDKnhDgjCMRr16C5teyZObOjt3WWk2oJ4FQdDWSPxZyJuXdJ6 c25pQ+zSKLlmZhECKd5c5L8luLT4fRI= X-MC-Unique: ymuIAhM4MLG2wYq5lElbtg-1 X-MC-Unique: jCZOmi2oO76USAGayfIguw-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=yE4K2pelANBjsb/IKX7fcdrxUPDWr6T4JUa4Ry5GIRs=; b=Rb7wVwm8i5RW8djd8qTMSDoAxtXp4BWghfDXXH1tu0IxzX7+ThGw0mjyUngqnDtKq9 AX51AQotvPCk1/DGChIjRty2f39tV2IvPQ16cJ53L7b3Vph89ssGG5mkW/vnU8mm6mnJ GB4/t0zVByidH5D93aaMOLzT03f8mpVQ/6prIiaCvv/W11jlIQwXlbd4E2KlwylkcyiN aD0vj+ROC3oktevPG7YQcp0LzBbT85QWbgU/BkGu95auMxTRgQqRuIFWMApGu80GICU4 cJHu2ZiD2f+m367TW1sjlBeZj+TCPww4PmKn/cE7mw0ADT/pIBlY8iCoHMUqDYbQaH4i 4fyA== X-Gm-Message-State: AGi0PuaaqOl8VQU37c3N8Lcf6T30twNaz3QMzNCDMWy+MaLcjF1l+zAm r9w3xyIqIuy60OtCcWKuqe6QWj3jTSQ= X-Google-Smtp-Source: APiQypL5JeHIIeJcjedMJdqsPreGEPW6PjaNGM2Zw4aMqxjRHkOWwGlOJU5GESpVA62XhNhl40zP3w== X-Received: by 2002:adf:ee12:: with SMTP id y18mr4502280wrn.289.1586526930241; Fri, 10 Apr 2020 06:55:30 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 01/43] admin: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:28 +0200 Message-Id: <20200410135510.2148319-2-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.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtbrI022871 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.15 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 Reviewed-by: Pavel Mores --- src/admin/admin_server_dispatch.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/admin/admin_server_dispatch.c b/src/admin/admin_server_dis= patch.c index b3da577995..2515528779 100644 --- a/src/admin/admin_server_dispatch.c +++ b/src/admin/admin_server_dispatch.c @@ -45,7 +45,7 @@ typedef daemonAdmClientPrivate *daemonAdmClientPrivatePtr; /* Separate private data for admin connection */ struct daemonAdmClientPrivate { /* Just a placeholder, not that there is anything to be locked */ - virMutex lock; + GMutex lock; =20 virNetDaemonPtr dmn; }; @@ -55,7 +55,7 @@ remoteAdmClientFree(void *data) { struct daemonAdmClientPrivate *priv =3D data; =20 - virMutexDestroy(&priv->lock); + g_mutex_clear(&priv->lock); virObjectUnref(priv->dmn); VIR_FREE(priv); } @@ -91,11 +91,7 @@ remoteAdmClientNew(virNetServerClientPtr client G_GNUC_U= NUSED, if (VIR_ALLOC(priv) < 0) return NULL; =20 - if (virMutexInit(&priv->lock) < 0) { - VIR_FREE(priv); - virReportSystemError(errno, "%s", _("unable to init mutex")); - return NULL; - } + g_mutex_init(&priv->lock); =20 /* * We don't necessarily need to ref this object right now as there @@ -167,9 +163,9 @@ adminDispatchConnectOpen(virNetServerPtr server G_GNUC_= UNUSED, struct daemonAdmClientPrivate *priv =3D virNetServerClientGetPrivateData(client); int ret =3D -1; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 VIR_DEBUG("priv=3D%p dmn=3D%p", priv, priv->dmn); - virMutexLock(&priv->lock); =20 flags =3D args->flags; virCheckFlagsGoto(0, cleanup); @@ -178,7 +174,6 @@ adminDispatchConnectOpen(virNetServerPtr server G_GNUC_= UNUSED, cleanup: if (ret < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return ret; } =20 --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586526952; cv=none; d=zohomail.com; s=zohoarc; b=A0hiwwQEAmxvU+BHlgQqTLYvQvI4OEzkitYPz8bnQe+aHZm9gn1FdHZZZ5qcrKEbWCiKQj6fAES6JW7cg37eFflVyHThRmO3ptKixv238Q0QGplvWDFQW/KFjotKRni8UvRA9QiyknbCerA8pITZ+CrOEO8+3DzJBLR9q5CUKC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526952; 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=dqn7xfnQQ2UU4zIjP7jMTdeBd3tRjNeMqOsoinl19e4=; b=l50/XabNkwbrgY+jCgCwEk1D7C7/E/T7Z2uJc5FeKslyaOUUsvFnRqZguW+8Fw9oEqg1M+uo3ovbdBhR5Sp9aQTu6s8ji6Air5JSW8rEXWEhSmf5KW1pbMN58FznxbgKx9mWMID6bz5ftaan/uc02FjWu+9zapwJsEZb76itbZA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586526952581687.6416932655725; Fri, 10 Apr 2020 06:55:52 -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-357-rU5sa0ZwM5qKhkr6gWEwzA-1; Fri, 10 Apr 2020 09:55:49 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA74D107ACC7; Fri, 10 Apr 2020 13:55:43 +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 D77E596F88; Fri, 10 Apr 2020 13:55:42 +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 4464393088; Fri, 10 Apr 2020 13:55:39 +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 03ADtcYV022879 for ; Fri, 10 Apr 2020 09:55:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id E567712750F; Fri, 10 Apr 2020 13:55:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E1195127512 for ; Fri, 10 Apr 2020 13:55:35 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 20587101A55A for ; Fri, 10 Apr 2020 13:55:35 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-B8z9FEFQOtOkXKaXr3dpAg-1; Fri, 10 Apr 2020 09:55:32 -0400 Received: by mail-wm1-f65.google.com with SMTP id z6so2818731wml.2 for ; Fri, 10 Apr 2020 06:55:32 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526951; 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=dqn7xfnQQ2UU4zIjP7jMTdeBd3tRjNeMqOsoinl19e4=; b=jCn9Md2qGLZwuA9phfPimjFRMiraAOUBmvZemEEgxXSFO1YI8POyx+oDh8ImyipTkoF4Nq Is621vpu32+T5zlIUwqw42LwFC4IMCWY2Q55I1ytGqJK6hDQeDhaixe2nPSSrGelaNtWro 07BgPoWE91cqDy4cjpvzrCyY7USPGJI= X-MC-Unique: rU5sa0ZwM5qKhkr6gWEwzA-1 X-MC-Unique: B8z9FEFQOtOkXKaXr3dpAg-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=CF6p19CQI701/y3Xtd/Q8qqY5ZkxIP5eHURqnfI7qIY=; b=AEQUmcMybIlMQm3vs4JdhqnqIK24Qi4NA+zOL28ociA9IcKVkKMKdIScN5pRX+lsgx su1wtfQ2AeGe55bTfBRSI9/G3xUc3yAJb1um2Zg/zRzrDq6K6/sQmJEy8LNfQ7LTYu8L JiyHQc1pKLI5hv2MDTU0ZwPlYnJyLY+PSAT3r69UzSw3Km7re4T+0a/OH0LXdfzld8Ud fnymP6mR2xUlcLaz8Ob3G0Q47NLQCKExZ4vBo8jeMVzusi3d/B2vskZU14pCNQJWPUI6 GIbIiAxF8y+DvMmpzUvKf65yoZrxEkBlks+CMElLVC4RdBJYIR0tA3Fq22d4dV2NJqMD tmTA== X-Gm-Message-State: AGi0PuZEL3OU/auCAiwz4olVBSrvctUUW/glSgbWSIfw1XgFg62qqwm2 elQaK5Zz9fQ3vv6uE8N8DzvcaynlfIk= X-Google-Smtp-Source: APiQypISXyDEUe0KJqNu5AoE9aYQjOh3FhzixlLdrJUG0in61eHaiOtbEUseFVV5oTe5vA68iol7KQ== X-Received: by 2002:a1c:9c15:: with SMTP id f21mr5148682wme.18.1586526931435; Fri, 10 Apr 2020 06:55:31 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 02/43] bhyve: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:29 +0200 Message-Id: <20200410135510.2148319-3-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 03ADtcYV022879 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.13 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 Reviewed-by: Pavel Mores --- src/bhyve/bhyve_driver.c | 11 ++++------- src/bhyve/bhyve_utils.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index b6204c7fb9..6e9a79cb52 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -73,13 +73,13 @@ bhyveConnPtr bhyve_driver =3D NULL; void bhyveDriverLock(bhyveConnPtr driver) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } =20 void bhyveDriverUnlock(bhyveConnPtr driver) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } =20 static int @@ -1199,7 +1199,7 @@ bhyveStateCleanup(void) if (bhyve_driver->lockFD !=3D -1) virPidFileRelease(BHYVE_STATE_DIR, "driver", bhyve_driver->lockFD); =20 - virMutexDestroy(&bhyve_driver->lock); + g_mutex_clear(&bhyve_driver->lock); VIR_FREE(bhyve_driver); =20 return 0; @@ -1228,10 +1228,7 @@ bhyveStateInitialize(bool privileged, return VIR_DRV_STATE_INIT_ERROR; =20 bhyve_driver->lockFD =3D -1; - if (virMutexInit(&bhyve_driver->lock) < 0) { - VIR_FREE(bhyve_driver); - return VIR_DRV_STATE_INIT_ERROR; - } + g_mutex_init(&bhyve_driver->lock); =20 if (!(bhyve_driver->closeCallbacks =3D virCloseCallbacksNew())) goto cleanup; diff --git a/src/bhyve/bhyve_utils.h b/src/bhyve/bhyve_utils.h index f3e80b6121..a92ecb48c4 100644 --- a/src/bhyve/bhyve_utils.h +++ b/src/bhyve/bhyve_utils.h @@ -44,7 +44,7 @@ struct _virBhyveDriverConfig { }; =20 struct _bhyveConn { - virMutex lock; + GMutex lock; =20 virBhyveDriverConfigPtr config; =20 --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586526952; cv=none; d=zohomail.com; s=zohoarc; b=ek8yWQDowd98Xi69CFgcFn/TORIEGuJbHz29uc1A4P63WcLj0LJm751ulBcXiqwNMjvpyyK7LIMX04KKg8L9jMm2fQGhsmGFw8qxaWMmJapJlx6bkmbItxgZ2JCjHzfWMhQzY1kqcZYWai1cmYfMHqiOGFx5kSQFcyKtusznjaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526952; 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=S1ECwdDxVoFUeK42/S12heDTgfhIhhreZ5jMpamUiU0=; b=VIU9Ofsn64uu4M/KKJeLa2XKVLUFWLU6QN1EZmXAWfCZQvi9k4/yKjLBKwfEALaug/WjMaSpts5/jxLr1SLU//0OvxatEkJrVasOKS2qGtU09U1NvyofSuu2yH6Ra0lYR3+VzOvWV6GpSv/TC3lLa86cZaJpcGbATT85V4aONRE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586526952545769.0543549042004; Fri, 10 Apr 2020 06:55:52 -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-194-2UpVd3LOPy-MbswI_uJTHA-1; Fri, 10 Apr 2020 09:55:49 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A76B8104FB63; Fri, 10 Apr 2020 13:55:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58271D7696; Fri, 10 Apr 2020 13:55:43 +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 A817718089CD; Fri, 10 Apr 2020 13:55:39 +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 03ADtc9U022878 for ; Fri, 10 Apr 2020 09:55:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id E5885127515; Fri, 10 Apr 2020 13:55:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E1147127510 for ; Fri, 10 Apr 2020 13:55:36 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 3A961101A55F for ; Fri, 10 Apr 2020 13:55:36 +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-61-fFT1YnlNN7mismilF7c_kg-1; Fri, 10 Apr 2020 09:55:34 -0400 Received: by mail-wr1-f67.google.com with SMTP id u13so1901723wrp.3 for ; Fri, 10 Apr 2020 06:55:33 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526951; 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=S1ECwdDxVoFUeK42/S12heDTgfhIhhreZ5jMpamUiU0=; b=PIeO4KIyn+Vuu4ibHMONtHl2mWixqqGxHMeUv2pp0/zk07SuJmOKbdcaFZ03oABox52xjk OCslljlroNvaYrH15tvfmlWFQCdwq/krd4tGF0Il3DJ5IWsRZ72gZBaKidBE7caQg5ucYb LYXDkM2HnjRBVY3UrgtPxkElLGsfU2Q= X-MC-Unique: 2UpVd3LOPy-MbswI_uJTHA-1 X-MC-Unique: fFT1YnlNN7mismilF7c_kg-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=iuPXMwxiv2uUR+fWvreVncQ2fJIUyABx8axd9LoviVs=; b=jeEZ7PzjZyaoDxHzZrLdka+gXm4Tz9Y9V6qy3/QpZHS2nlbrwSWdHaVwadpcTfZqwA X+OUh/ADoCXYwvEp09kjL5Yd6vTVbd/+67+6VIxj2ly2QPILQjsD2kP0mwBxiKXE8qs/ zNS5LLut4W/fhUYoDy/BcMAYVw7K/YNbeMIe3Av4HVsLAcqk8e/8nSpQ3B8wALIpdUhn TBfJZnNEUEjg4x459H6MHFPBpaGUtodhmjz5rRKkBV+2a9g64ugh1/vpAYwVbyyNYf/h GdYuCcnVG/pSr6d6DxD28W3cvMdnUjBtA+mxLceeSdoS513XNsQlBqV9AQKcoKXOvLuo 4YNA== X-Gm-Message-State: AGi0PuavWuCULqIbjlPzXbW400/yF6meBw6bJZGWtGOcfN7muzwdHSjj WJ1TD3D4IoZ6cV/AgRpz4YcsZIhaKIk= X-Google-Smtp-Source: APiQypKewfx+/SunOtGkKa+kNJPEieZELLfYyEylwSATGfwjh/dvftlLUdt+Wb5jLgEdF1zGBxvq8g== X-Received: by 2002:a5d:658e:: with SMTP id q14mr4937768wru.92.1586526932562; Fri, 10 Apr 2020 06:55:32 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 03/43] conf: nwfilter_ipaddrmap: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:30 +0200 Message-Id: <20200410135510.2148319-4-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 03ADtc9U022878 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.11 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 --- src/conf/nwfilter_ipaddrmap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/conf/nwfilter_ipaddrmap.c b/src/conf/nwfilter_ipaddrmap.c index 672a58be3a..3c1927f9ff 100644 --- a/src/conf/nwfilter_ipaddrmap.c +++ b/src/conf/nwfilter_ipaddrmap.c @@ -32,7 +32,7 @@ =20 #define VIR_FROM_THIS VIR_FROM_NWFILTER =20 -static virMutex ipAddressMapLock =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE_STATIC(ipAddressMapLock); static virHashTablePtr ipAddressMap; =20 =20 @@ -55,7 +55,7 @@ virNWFilterIPAddrMapAddIPAddr(const char *ifname, char *a= ddr) =20 addrCopy =3D g_strdup(addr); =20 - virMutexLock(&ipAddressMapLock); + G_LOCK(ipAddressMapLock); =20 val =3D virHashLookup(ipAddressMap, ifname); if (!val) { @@ -76,7 +76,7 @@ virNWFilterIPAddrMapAddIPAddr(const char *ifname, char *a= ddr) ret =3D 0; =20 cleanup: - virMutexUnlock(&ipAddressMapLock); + G_UNLOCK(ipAddressMapLock); VIR_FREE(addrCopy); =20 return ret; @@ -102,7 +102,7 @@ virNWFilterIPAddrMapDelIPAddr(const char *ifname, const= char *ipaddr) int ret =3D -1; virNWFilterVarValuePtr val =3D NULL; =20 - virMutexLock(&ipAddressMapLock); + G_LOCK(ipAddressMapLock); =20 if (ipaddr !=3D NULL) { val =3D virHashLookup(ipAddressMap, ifname); @@ -121,7 +121,7 @@ virNWFilterIPAddrMapDelIPAddr(const char *ifname, const= char *ipaddr) ret =3D 0; } =20 - virMutexUnlock(&ipAddressMapLock); + G_UNLOCK(ipAddressMapLock); =20 return ret; } @@ -137,11 +137,11 @@ virNWFilterIPAddrMapGetIPAddr(const char *ifname) { virNWFilterVarValuePtr res; =20 - virMutexLock(&ipAddressMapLock); + G_LOCK(ipAddressMapLock); =20 res =3D virHashLookup(ipAddressMap, ifname); =20 - virMutexUnlock(&ipAddressMapLock); + G_UNLOCK(ipAddressMapLock); =20 return res; } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1586526969; cv=none; d=zohomail.com; s=zohoarc; b=TnA0Z8AFxmUkuJIo/hI7neUdfLpmwIpM/n6nVH4A9DH3YjicTrnveWlLtLU2bFobcszv7nxuGDdzucZi/jROygyXgP+0XSshTYdVXT6ZxBNFzkHlCbHT4YEVMh0N0c4tt76rRjtLTEim/Sdc8gtyjhrqRgk/INfJXBeAkHm6VAU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526969; 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=RmNs5YiTXO/L2Gdm3k171pCjy6haJpEiana+vjwvc4Y=; b=JqfPb1VLi1ye2fmv0RFJCOE1dETSQ3lCHAnLy97S4dPbjBcWxLGjTTRKAq/u+dm8NKstGvVHJDLaBOExqYrnk2M3bUdukGQDigg6yxn80BtI4bylgFfaXqA/LEa/bQ7eEOvASmowllKzoA55rfq5N6zzk+Rv7fdwQ7o1LcYL8E4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586526969716639.4371191766066; Fri, 10 Apr 2020 06:56:09 -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-486-emyKedM7PjWGYUVQ-pIFng-1; Fri, 10 Apr 2020 09:56:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC5B98017F6; Fri, 10 Apr 2020 13:55:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B4930272A3; Fri, 10 Apr 2020 13:55:59 +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 68A5C18089CF; Fri, 10 Apr 2020 13:55:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtdsb022916 for ; Fri, 10 Apr 2020 09:55:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id AB9FA10EE823; Fri, 10 Apr 2020 13:55:39 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7C8F10EE826 for ; Fri, 10 Apr 2020 13:55:37 +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 B5A16185A78E for ; Fri, 10 Apr 2020 13:55:37 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-402--MdHEBJiOGaLGE4GkGDohw-1; Fri, 10 Apr 2020 09:55:35 -0400 Received: by mail-wm1-f65.google.com with SMTP id a201so2441134wme.1 for ; Fri, 10 Apr 2020 06:55:35 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526968; 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=RmNs5YiTXO/L2Gdm3k171pCjy6haJpEiana+vjwvc4Y=; b=h3+Oc787Q8kS1eRQigSIB5iKzGpbpGflQ4hosQ6gjEA0F3cRjpXeGHn7l+AmzxRxROdTID jFeaSriPeQQyJ5DLXmYBzV323sk1krT5mfEcG7SQwEiuevMr1mQ/+AryaK+shVdtSOVBzG NP+pxDfiSkRG/6FzKDzvSAqM/bbO+Hw= X-MC-Unique: emyKedM7PjWGYUVQ-pIFng-1 X-MC-Unique: -MdHEBJiOGaLGE4GkGDohw-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=SHhxgxt3WYW0SLyJ1s4trYpsnNB6dJrOI0AIR6LDsWA=; b=d+pKxuD8R0rLspBW09tjlO7gk9pptUslKEoJcFsm0AmEdmfrQiR12gryiweDNLIxmS l3aGYFImfR8c0feriZRS/8YOTV3eCnMtuU7FD/a829vHphxcLa7lg6LiWwKGaZly48dK MRDmsRXdJRWcnqlujKUq8o0ayO4BJItfpXP6UqhlBzt8YE43Sq2e3+DwZRMNmZIsQlCh KVOrMVpCkj8A3ZhrlGX6k6oCCxcc3pPlIRaxbK1iKhAw5egBmWctaEF8W64xLoGS0Rxu dT2hDcIw9Hob3U7DtoXGS1c1C0YZOD9Af9AhZnq9SPpls8QOKFvrRA/JICXvGlWX/n48 0YCw== X-Gm-Message-State: AGi0PuZcuULuq2LL/DcCWj0zYbjQZGVdRNpnEKrSZ5L28jrmX9ChkOCx 2k8EWe22UiUK0A6AII3jzOeQYoVouNo= X-Google-Smtp-Source: APiQypJD/g7FQ1SIqAgu2gGf6q0Z35By0IjlzWIQxk4MOPVhA8kk0MaiQmJXuRF4Q6Tw10+GoAGlvQ== X-Received: by 2002:a7b:cbc6:: with SMTP id n6mr5644922wmi.155.1586526933724; Fri, 10 Apr 2020 06:55:33 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 04/43] conf: virchrdev: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:31 +0200 Message-Id: <20200410135510.2148319-5-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtdsb022916 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.84 on 10.5.11.23 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 Reviewed-by: Pavel Mores --- src/conf/virchrdev.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c index 800e82869e..8280f8e188 100644 --- a/src/conf/virchrdev.c +++ b/src/conf/virchrdev.c @@ -44,7 +44,7 @@ VIR_LOG_INIT("conf.chrdev"); /* structure holding information about character devices * open in a given domain */ struct _virChrdevs { - virMutex lock; + GMutex lock; virHashTablePtr hash; }; =20 @@ -238,12 +238,10 @@ static void virChrdevFDStreamCloseCb(virStreamPtr st = G_GNUC_UNUSED, void *opaque) { virChrdevStreamInfoPtr priv =3D opaque; - virMutexLock(&priv->devs->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->devs->loc= k); =20 /* remove entry from hash */ virHashRemoveEntry(priv->devs->hash, priv->path); - - virMutexUnlock(&priv->devs->lock); } =20 /** @@ -258,12 +256,7 @@ virChrdevsPtr virChrdevAlloc(void) if (VIR_ALLOC(devs) < 0) return NULL; =20 - if (virMutexInit(&devs->lock) < 0) { - virReportSystemError(errno, "%s", - _("Unable to init device stream mutex")); - VIR_FREE(devs); - return NULL; - } + g_mutex_init(&devs->lock); =20 /* there will hardly be any devices most of the time, the hash * does not have to be huge */ @@ -299,11 +292,11 @@ void virChrdevFree(virChrdevsPtr devs) if (!devs) return; =20 - virMutexLock(&devs->lock); + g_mutex_lock(&devs->lock); virHashForEach(devs->hash, virChrdevFreeClearCallbacks, NULL); virHashFree(devs->hash); - virMutexUnlock(&devs->lock); - virMutexDestroy(&devs->lock); + g_mutex_unlock(&devs->lock); + g_mutex_clear(&devs->lock); =20 VIR_FREE(devs); } @@ -334,6 +327,7 @@ int virChrdevOpen(virChrdevsPtr devs, char *path; int ret; bool added =3D false; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&devs->lock); =20 switch (source->type) { case VIR_DOMAIN_CHR_TYPE_PTY: @@ -354,12 +348,9 @@ int virChrdevOpen(virChrdevsPtr devs, return -1; } =20 - virMutexLock(&devs->lock); - if ((ent =3D virHashLookup(devs->hash, path))) { if (!force) { /* entry found, device is busy */ - virMutexUnlock(&devs->lock); return 1; } else { /* terminate existing connection */ @@ -378,13 +369,11 @@ int virChrdevOpen(virChrdevsPtr devs, =20 /* create the lock file */ if ((ret =3D virChrdevLockFileCreate(path)) < 0) { - virMutexUnlock(&devs->lock); return ret; } =20 /* obtain a reference to the stream */ if (virStreamRef(st) < 0) { - virMutexUnlock(&devs->lock); return -1; } =20 @@ -428,7 +417,6 @@ int virChrdevOpen(virChrdevsPtr devs, cbdata, virChrdevFDStreamCloseCbFree); =20 - virMutexUnlock(&devs->lock); return 0; =20 error: @@ -440,7 +428,6 @@ int virChrdevOpen(virChrdevsPtr devs, if (cbdata) VIR_FREE(cbdata->path); VIR_FREE(cbdata); - virMutexUnlock(&devs->lock); virChrdevHashEntryFree(ent); return -1; } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586526969; cv=none; d=zohomail.com; s=zohoarc; b=E9iNqfV7h0A0OLq5ScXgd23zXiDU5BfGZQJDuH8PwuDzgNSy7VCJm1+D10vOJ86h5Ed9IXZvu7YHHDQvqknCzAGWm+C7hHCJPJgMZj+hsJtCR0Lk69+NlRfETAikXnMWdwS19MK3JVVR6xBrMC/NQQmJ9fCC3Ps6SjQPLA7elR4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526969; 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=SQu4sET0LId0zCGdnhlqxQDl8zjyxkN16vcqD1hV3uA=; b=VcXgVAz3u13t9xQjyoD8BUpD9yzsxT/fi/QQYFJuK91TyGabvF4tbsd5415Vl3QOcacFVatBvaqWqWZfI4wD/ptIurWAudfJGzG0VzdYYXzjOD92pZXESwVXUaahYcsaH10QWDPHhCp/uC6Y6+CIKCO5xIZJGZtvkGZGcWKX2Fc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586526969835230.88061115112976; Fri, 10 Apr 2020 06:56:09 -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-344-tuuTFS50NWeNSGLc0UA5KQ-1; Fri, 10 Apr 2020 09:56:05 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F1168104FB65; Fri, 10 Apr 2020 13:55:59 +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 C42C6D7689; Fri, 10 Apr 2020 13:55:59 +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 804FF9308E; Fri, 10 Apr 2020 13:55:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtdpZ022914 for ; Fri, 10 Apr 2020 09:55:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id A935410EE828; Fri, 10 Apr 2020 13:55:39 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4FCE10EE823 for ; Fri, 10 Apr 2020 13:55:39 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 0CC748007AC for ; Fri, 10 Apr 2020 13:55:39 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-Y-8qscrWOn2zV3QG4senhw-1; Fri, 10 Apr 2020 09:55:37 -0400 Received: by mail-wm1-f66.google.com with SMTP id z6so2818963wml.2 for ; Fri, 10 Apr 2020 06:55:36 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526968; 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=SQu4sET0LId0zCGdnhlqxQDl8zjyxkN16vcqD1hV3uA=; b=e+qrqXMZf/t0EN05heWjTCa/kjNzlB7YIUtGlLT4FHnAfMejkOKxhbKn3I9QMKlhQNpNs9 Po1DITwV5l3nkrjUEQ8ovF0399qRt7RhubW3AUDo7y7++BxQ1w4crBS1vfhwhN0t8l6tdE mBd24ysBKzJi4urzk4vbPKxfRrSiEuo= X-MC-Unique: tuuTFS50NWeNSGLc0UA5KQ-1 X-MC-Unique: Y-8qscrWOn2zV3QG4senhw-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=hThINJ2uKJe93KDt8cvNqcdU2fDLQ/hMy+wM8E5wIaQ=; b=o9/FQSZ6n8h5fUSKvCea6ZBJv06W8SrAZxfXYHpY1zroNH2jtKcRVmfVP7buhy5UIq tN2geWrrKOHyK6BD+cjxNyaaf3aTuQX5+qmRCk2ze9DZ4WVIWZN6fpdLr3Dhn0DXeGZ9 wpLXTuOH0ydCK8nc9vyVXNdePyw81hA0DoFvIOrjqkY3wUkYlUCW8n+df68zGLAiCPqn k2GaW0v191vMe2N+CuDB8muFBfMhZFj82hs5Nd9o5JIGVIqrPyU4+n3XwJkxna8xwCyl YgAG5+sp1DebVSnWJA6s8EiuN13EgNQBJgoFefq4XZscECprh6z5ruK4Hny4r+1BCqpl tIgQ== X-Gm-Message-State: AGi0PubxfjFxl5F0fNaIOdeYKYBqkNr8L8GWmqcZoWFHDehTqduI6j/m /WVehrN2/GNpsCSHQbx/sB3G+zwEE8E= X-Google-Smtp-Source: APiQypJ2iDAuPuNPtJlWoaP7Izwxc1csAmExLZ1i5XIaVhd99yH+Mz85Uvakmn96F5hbnf2X8Vlmww== X-Received: by 2002:a1c:5448:: with SMTP id p8mr5135149wmi.173.1586526935050; Fri, 10 Apr 2020 06:55:35 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 05/43] esx: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:32 +0200 Message-Id: <20200410135510.2148319-6-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtdpZ022914 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.11 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 --- src/esx/esx_stream.c | 25 +++++++--------- src/esx/esx_vi.c | 68 +++++++++++++++----------------------------- src/esx/esx_vi.h | 6 ++-- 3 files changed, 36 insertions(+), 63 deletions(-) diff --git a/src/esx/esx_stream.c b/src/esx/esx_stream.c index fe3c42ae02..474c0f4739 100644 --- a/src/esx/esx_stream.c +++ b/src/esx/esx_stream.c @@ -203,6 +203,7 @@ esxStreamSend(virStreamPtr stream, const char *data, si= ze_t nbytes) int result =3D -1; esxStreamPrivate *priv =3D stream->privateData; int status; + g_autoptr(GMutexLocker) locker =3D NULL; =20 if (nbytes =3D=3D 0) return 0; @@ -217,7 +218,7 @@ esxStreamSend(virStreamPtr stream, const char *data, si= ze_t nbytes) return -1; } =20 - virMutexLock(&priv->curl->lock); + locker =3D g_mutex_locker_new(&priv->curl->lock); =20 priv->buffer =3D (char *)data; priv->buffer_size =3D nbytes; @@ -225,7 +226,7 @@ esxStreamSend(virStreamPtr stream, const char *data, si= ze_t nbytes) =20 if (stream->flags & VIR_STREAM_NONBLOCK) { if (esxStreamTransfer(priv, false) < 0) - goto cleanup; + return -1; =20 if (priv->buffer_used < priv->buffer_size) result =3D priv->buffer_size - priv->buffer_used; @@ -236,7 +237,7 @@ esxStreamSend(virStreamPtr stream, const char *data, si= ze_t nbytes) status =3D esxStreamTransfer(priv, true); =20 if (status < 0) - goto cleanup; + return -1; =20 if (status > 0) break; @@ -245,9 +246,6 @@ esxStreamSend(virStreamPtr stream, const char *data, si= ze_t nbytes) result =3D priv->buffer_size - priv->buffer_used; } =20 - cleanup: - virMutexUnlock(&priv->curl->lock); - return result; } =20 @@ -260,6 +258,7 @@ esxStreamRecvFlags(virStreamPtr stream, int result =3D -1; esxStreamPrivate *priv =3D stream->privateData; int status; + g_autoptr(GMutexLocker) locker =3D NULL; =20 virCheckFlags(0, -1); =20 @@ -276,7 +275,7 @@ esxStreamRecvFlags(virStreamPtr stream, return -1; } =20 - virMutexLock(&priv->curl->lock); + locker =3D g_mutex_locker_new(&priv->curl->lock); =20 priv->buffer =3D data; priv->buffer_size =3D nbytes; @@ -296,7 +295,7 @@ esxStreamRecvFlags(virStreamPtr stream, result =3D priv->buffer_used; } else if (stream->flags & VIR_STREAM_NONBLOCK) { if (esxStreamTransfer(priv, false) < 0) - goto cleanup; + return -1; =20 if (priv->buffer_used > 0) result =3D priv->buffer_used; @@ -307,7 +306,7 @@ esxStreamRecvFlags(virStreamPtr stream, status =3D esxStreamTransfer(priv, true); =20 if (status < 0) - goto cleanup; + return -1; =20 if (status > 0) break; @@ -316,9 +315,6 @@ esxStreamRecvFlags(virStreamPtr stream, result =3D priv->buffer_used; } =20 - cleanup: - virMutexUnlock(&priv->curl->lock); - return result; } =20 @@ -346,11 +342,12 @@ esxStreamClose(virStreamPtr stream, bool finish) { int result =3D 0; esxStreamPrivate *priv =3D stream->privateData; + g_autoptr(GMutexLocker) locker =3D NULL; =20 if (!priv) return 0; =20 - virMutexLock(&priv->curl->lock); + locker =3D g_mutex_locker_new(&priv->curl->lock); =20 if (finish && priv->backlog_used > 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -360,8 +357,6 @@ esxStreamClose(virStreamPtr stream, bool finish) =20 stream->privateData =3D NULL; =20 - virMutexUnlock(&priv->curl->lock); - esxFreeStreamPrivate(&priv); =20 return result; diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 16690edfbe..ed6c6c28cd 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -112,7 +112,7 @@ ESX_VI__TEMPLATE__FREE(CURL, if (item->headers) curl_slist_free_all(item->headers); =20 - virMutexDestroy(&item->lock); + g_mutex_clear(&item->lock); }) =20 static size_t @@ -356,11 +356,7 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri= *parsedUri) parsedUri->proxy_port); } =20 - if (virMutexInit(&curl->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize CURL mutex")); - return -1; - } + g_mutex_init(&curl->lock); =20 return 0; } @@ -392,7 +388,7 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, = char **content, range =3D g_strdup_printf("%llu-", offset); } =20 - virMutexLock(&curl->lock); + g_mutex_lock(&curl->lock); =20 curl_easy_setopt(curl->handle, CURLOPT_URL, url); curl_easy_setopt(curl->handle, CURLOPT_RANGE, range); @@ -402,7 +398,7 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, = char **content, =20 responseCode =3D esxVI_CURL_Perform(curl, url); =20 - virMutexUnlock(&curl->lock); + g_mutex_unlock(&curl->lock); =20 if (responseCode < 0) { goto cleanup; @@ -433,14 +429,13 @@ int esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, const char *content) { int responseCode =3D 0; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&curl->lock); =20 if (!content) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")= ); return -1; } =20 - virMutexLock(&curl->lock); - curl_easy_setopt(curl->handle, CURLOPT_URL, url); curl_easy_setopt(curl->handle, CURLOPT_RANGE, NULL); curl_easy_setopt(curl->handle, CURLOPT_READDATA, &content); @@ -449,8 +444,6 @@ esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, co= nst char *content) =20 responseCode =3D esxVI_CURL_Perform(curl, url); =20 - virMutexUnlock(&curl->lock); - if (responseCode < 0) { return -1; } else if (responseCode !=3D 200 && responseCode !=3D 201) { @@ -494,7 +487,7 @@ esxVI_SharedCURL_Lock(CURL *handle G_GNUC_UNUSED, curl_= lock_data data, return; } =20 - virMutexLock(&shared->locks[i]); + g_mutex_lock(&shared->locks[i]); } =20 static void @@ -522,7 +515,7 @@ esxVI_SharedCURL_Unlock(CURL *handle G_GNUC_UNUSED, cur= l_lock_data data, return; } =20 - virMutexUnlock(&shared->locks[i]); + g_mutex_unlock(&shared->locks[i]); } =20 /* esxVI_SharedCURL_Alloc */ @@ -543,7 +536,7 @@ ESX_VI__TEMPLATE__FREE(SharedCURL, curl_share_cleanup(item->handle); =20 for (i =3D 0; i < G_N_ELEMENTS(item->locks); ++i) - virMutexDestroy(&item->locks[i]); + g_mutex_clear(&item->locks[i]); }) =20 int @@ -583,22 +576,18 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_= CURL *curl) CURL_LOCK_DATA_DNS); =20 for (i =3D 0; i < G_N_ELEMENTS(shared->locks); ++i) { - if (virMutexInit(&shared->locks[i]) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize a CURL (share) mute= x")); - return -1; - } + g_mutex_init(&shared->locks[i]); } } =20 - virMutexLock(&curl->lock); + g_mutex_lock(&curl->lock); =20 curl_easy_setopt(curl->handle, CURLOPT_SHARE, shared->handle); =20 curl->shared =3D shared; ++shared->count; =20 - virMutexUnlock(&curl->lock); + g_mutex_unlock(&curl->lock); =20 return 0; } @@ -606,6 +595,8 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CU= RL *curl) int esxVI_SharedCURL_Remove(esxVI_SharedCURL *shared, esxVI_CURL *curl) { + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&curl->lock); + if (!curl->handle) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot unshare uninitialized CURL handle")); @@ -623,15 +614,11 @@ esxVI_SharedCURL_Remove(esxVI_SharedCURL *shared, esx= VI_CURL *curl) return -1; } =20 - virMutexLock(&curl->lock); - curl_easy_setopt(curl->handle, CURLOPT_SHARE, NULL); =20 curl->shared =3D NULL; --shared->count; =20 - virMutexUnlock(&curl->lock); - return 0; } =20 @@ -661,6 +648,8 @@ ESX_VI__TEMPLATE__FREE(MultiCURL, int esxVI_MultiCURL_Add(esxVI_MultiCURL *multi, esxVI_CURL *curl) { + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&curl->lock); + if (!curl->handle) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot add uninitialized CURL handle to a multi = handle")); @@ -684,21 +673,19 @@ esxVI_MultiCURL_Add(esxVI_MultiCURL *multi, esxVI_CUR= L *curl) =20 } =20 - virMutexLock(&curl->lock); - curl_multi_add_handle(multi->handle, curl->handle); =20 curl->multi =3D multi; ++multi->count; =20 - virMutexUnlock(&curl->lock); - return 0; } =20 int esxVI_MultiCURL_Remove(esxVI_MultiCURL *multi, esxVI_CURL *curl) { + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&curl->lock); + if (!curl->handle) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot remove uninitialized CURL handle from a " @@ -718,15 +705,11 @@ esxVI_MultiCURL_Remove(esxVI_MultiCURL *multi, esxVI_= CURL *curl) return -1; } =20 - virMutexLock(&curl->lock); - curl_multi_remove_handle(multi->handle, curl->handle); =20 curl->multi =3D NULL; --multi->count; =20 - virMutexUnlock(&curl->lock); - return 0; } =20 @@ -809,7 +792,7 @@ ESX_VI__TEMPLATE__ALLOC(Context) ESX_VI__TEMPLATE__FREE(Context, { if (item->sessionLock) - virMutexDestroy(item->sessionLock); + g_mutex_clear(item->sessionLock); =20 esxVI_CURL_Free(&item->curl); VIR_FREE(item->url); @@ -870,11 +853,7 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *= url, goto cleanup; =20 =20 - if (virMutexInit(ctx->sessionLock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize session mutex")); - goto cleanup; - } + g_mutex_init(ctx->sessionLock); =20 if (esxVI_RetrieveServiceContent(ctx, &ctx->service) < 0) goto cleanup; @@ -1262,7 +1241,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char = *methodName, if (esxVI_Response_Alloc(response) < 0) return -1; =20 - virMutexLock(&ctx->curl->lock); + g_mutex_lock(&ctx->curl->lock); =20 curl_easy_setopt(ctx->curl->handle, CURLOPT_URL, ctx->url); curl_easy_setopt(ctx->curl->handle, CURLOPT_RANGE, NULL); @@ -1273,7 +1252,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char = *methodName, =20 (*response)->responseCode =3D esxVI_CURL_Perform(ctx->curl, ctx->url); =20 - virMutexUnlock(&ctx->curl->lock); + g_mutex_unlock(&ctx->curl->lock); =20 if ((*response)->responseCode < 0) goto cleanup; @@ -1908,13 +1887,14 @@ esxVI_EnsureSession(esxVI_Context *ctx) esxVI_DynamicProperty *dynamicProperty =3D NULL; esxVI_UserSession *currentSession =3D NULL; char *escapedPassword =3D NULL; + g_autoptr(GMutexLocker) locker =3D NULL; =20 if (!ctx->sessionLock) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no m= utex")); return -1; } =20 - virMutexLock(ctx->sessionLock); + locker =3D g_mutex_locker_new(ctx->sessionLock); =20 if (!ctx->session) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no s= ession")); @@ -1969,8 +1949,6 @@ esxVI_EnsureSession(esxVI_Context *ctx) result =3D 0; =20 cleanup: - virMutexUnlock(ctx->sessionLock); - VIR_FREE(escapedPassword); esxVI_String_Free(&propertyNameList); esxVI_ObjectContent_Free(&sessionManager); diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h index b960c0900a..949f90a43d 100644 --- a/src/esx/esx_vi.h +++ b/src/esx/esx_vi.h @@ -115,7 +115,7 @@ struct _esxVI_ParsedHostCpuIdInfo { =20 struct _esxVI_CURL { CURL *handle; - virMutex lock; + GMutex lock; struct curl_slist *headers; char error[CURL_ERROR_SIZE]; esxVI_SharedCURL *shared; @@ -137,7 +137,7 @@ int esxVI_CURL_Upload(esxVI_CURL *curl, const char *url= , const char *content); =20 struct _esxVI_SharedCURL { CURLSH *handle; - virMutex locks[3]; /* share, cookie, dns */ + GMutex locks[3]; /* share, cookie, dns */ size_t count; /* number of added easy handle */ }; =20 @@ -184,7 +184,7 @@ struct _esxVI_Context { esxVI_ProductLine productLine; unsigned long productVersion; /* =3D 1000000 * major + 1000 * minor + = micro */ esxVI_UserSession *session; /* ... except the session ... */ - virMutexPtr sessionLock; /* ... that is protected by this mutex */ + GMutex *sessionLock; /* ... that is protected by this mutex */ esxVI_Datacenter *datacenter; char *datacenterPath; /* including folders */ esxVI_ComputeResource *computeResource; --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586526973; cv=none; d=zohomail.com; s=zohoarc; b=hA0IXkLCTRGEWy8Dnfp0uFzzLxgfbkAoxpU+qb1rKvcFnSNggaA6DL3kcyrAQQUauRO+7v5iTbaWEALEQT9EuUFMxBRYG5u0xCGU/Y2p+TSTfAEueBDi6fKz2mnZQ55LQ/+CXP6XvF0rCM6lsNUd5kFyMLAWqlAICzrFWDBIbWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526973; 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=LSzwH3JuPvF72nX/kpCxFz3SJs2YnKhqAoZiogZCbdA=; b=YZhbzMPOVNtQpWBP4zJqtfAdSDFa4hLdNh4A2XlWJr3NfUKGQkyxUbngM5d/9XwKgpGzhuFzeCz68djZgYksrU5v22QQ7JE0z/oFUTCumu9hpAW2vIkS7gUlR4gd5xJl/vi7IbwOIn2NmMrtn+kqcR9EwcnfpEgJQxEMsmpUXUc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586526973093843.6390363171116; Fri, 10 Apr 2020 06:56:13 -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-77-BqBqmBr4NimEfl5cQVnDMg-1; Fri, 10 Apr 2020 09:56:10 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5CFFA104FB63; Fri, 10 Apr 2020 13:56:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 255BD5DA66; Fri, 10 Apr 2020 13:56:04 +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 AEA5F18089D6; Fri, 10 Apr 2020 13:56:03 +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 03ADteTT022930 for ; Fri, 10 Apr 2020 09:55:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 45B5A12750F; Fri, 10 Apr 2020 13:55:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 42034127510 for ; Fri, 10 Apr 2020 13:55:40 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 2149B185A78E for ; Fri, 10 Apr 2020 13:55:40 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-53--RBpu8t9PaqW5fLyeZen7w-1; Fri, 10 Apr 2020 09:55:37 -0400 Received: by mail-wm1-f66.google.com with SMTP id y24so2804028wma.4 for ; Fri, 10 Apr 2020 06:55:37 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526971; 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=LSzwH3JuPvF72nX/kpCxFz3SJs2YnKhqAoZiogZCbdA=; b=iybdY5Gf/Ei5rmZuOFj8l5Bkf9hqEI2BdYMdolBIbOf2MNBDwI4xTsHoJBN5KteikiB10A gJSIKyNW/iwYrS7EHBJJQJ4WXxjP66JdS1ElLYItR+YMumO/4vZLK4IKrXnGyIEu9vpKO3 mSMjM3WpUfLSDKYYWtY5jU8B3A/kqZY= X-MC-Unique: BqBqmBr4NimEfl5cQVnDMg-1 X-MC-Unique: -RBpu8t9PaqW5fLyeZen7w-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=RLX6gmfXzG0jYym7LAE9WMcFuiH9bT2sdpcSfBlQb7Y=; b=GmCuRbwqgPf3PMUmUvP0tHystGWGXIfhI5y/jf9WWwfuZcwG+33LhVqZHm/gpI+o8C ZPXHYPSJR7DpnMKWPnJydOe5x+w2M4nkcAs6EPXAbjR+iVJWdfNoIUdT2RCcVhhEVqeG FggQVlE218lHnvQWrzaAricXPekjQoU9F8CsUtqWfGeOcx8rpcgjFUONVfc5Leo/ZACI QIItGGVeTBSN7SswOrcwpRSxLcp+BKOy1UPIs1RE8W8cVsPtfxYxjjrS+vMIiGg/ROU7 Jw7GozbWuJT0piCfYO0UD1zZsx/a6bJn0Sc/9xYHcSN+6+OF3Rw5U2EKN2JHbJn2y3ek xpEw== X-Gm-Message-State: AGi0PuYWZqcItXSCrP9oJdmeDhiB+pNwvBWTXEqS/a5R9xVhl6Uk1fmh JxHx3Zlx+IabnVbuTcT9t4yV30yqW/c= X-Google-Smtp-Source: APiQypLVQLzQr9PeurAf777TnJYwRDoFf0umvaXZJurl8kdUoWjWKyJw0pFGaOG05IF1yhUihkCrcQ== X-Received: by 2002:a1c:2842:: with SMTP id o63mr5216247wmo.73.1586526936437; Fri, 10 Apr 2020 06:55:36 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 06/43] util: virtpm: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:33 +0200 Message-Id: <20200410135510.2148319-7-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 03ADteTT022930 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.14 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 Reviewed-by: Pavel Mores --- 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 =3D 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; =20 - virMutexLock(&swtpm_tools_lock); + G_LOCK(swtpm_tools_lock); s =3D g_strdup(swtpm_path); - virMutexUnlock(&swtpm_tools_lock); + G_UNLOCK(swtpm_tools_lock); =20 return s; } @@ -128,9 +128,9 @@ virTPMGetSwtpmSetup(void) if (!swtpm_setup && virTPMEmulatorInit() < 0) return NULL; =20 - virMutexLock(&swtpm_tools_lock); + G_LOCK(swtpm_tools_lock); s =3D g_strdup(swtpm_setup); - virMutexUnlock(&swtpm_tools_lock); + G_UNLOCK(swtpm_tools_lock); =20 return s; } @@ -143,9 +143,9 @@ virTPMGetSwtpmIoctl(void) if (!swtpm_ioctl && virTPMEmulatorInit() < 0) return NULL; =20 - virMutexLock(&swtpm_tools_lock); + G_LOCK(swtpm_tools_lock); s =3D g_strdup(swtpm_ioctl); - virMutexUnlock(&swtpm_tools_lock); + G_UNLOCK(swtpm_tools_lock); =20 return s; } @@ -284,7 +284,7 @@ virTPMEmulatorInit(void) }; size_t i; =20 - virMutexLock(&swtpm_tools_lock); + G_LOCK(swtpm_tools_lock); =20 for (i =3D 0; i < G_N_ELEMENTS(prgs); i++) { g_autofree char *path =3D NULL; @@ -341,7 +341,7 @@ virTPMEmulatorInit(void) ret =3D 0; =20 cleanup: - virMutexUnlock(&swtpm_tools_lock); + G_UNLOCK(swtpm_tools_lock); =20 return ret; } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1586526974; cv=none; d=zohomail.com; s=zohoarc; b=MyfaCMG/tV1kKbI59wbeM6yeSfz3wFGPoMxGlC65R0XzqnYNoPaUWsjjGhd/z/azf6Kce7ZV/DyeVfxwr2nAXDWjIqxo5VSofYqhbUOU17uae3xnTNBTCwvz7JRDjUjNT4La429aKq+zOZ1fUuqwTh3Xe2WB+lxhMsbm9/F0Hqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526974; 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=zYy2fmrg0Ycy1awlKU3yZhLJsYj0C0/tIoI0fxD4+hU=; b=KBHDLMxrQPWdA2PW6wlKSTC90IhDW2pq1xGl+tvif6hr5dgVHcnbcWzkrbDHu3CvY91OjMoqC9BKcSncmdHDpmdmODcC+uhCrAGqOwZUbqZwRFVoyDbAUrCeiXfjsMEBYKymgpoKDhAjkNPRVOqcFJf/Sx7SVKnYQf+51y+6lUo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586526974419104.33721899583838; Fri, 10 Apr 2020 06:56:14 -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-12-UCGylcxFP0exh88d1yiwZw-1; Fri, 10 Apr 2020 09:56:10 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 313D618B5F73; Fri, 10 Apr 2020 13:56:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04D465DA66; Fri, 10 Apr 2020 13:56:05 +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 9B98018089D8; Fri, 10 Apr 2020 13:56:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtfsH022946 for ; Fri, 10 Apr 2020 09:55:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id DA481200AD4C; Fri, 10 Apr 2020 13:55:41 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5FB32024517 for ; Fri, 10 Apr 2020 13:55:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 B494F8007A4 for ; Fri, 10 Apr 2020 13:55:41 +0000 (UTC) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-399-Dg8ZMRC0MvSimIsZphkFUw-1; Fri, 10 Apr 2020 09:55:39 -0400 Received: by mail-wr1-f42.google.com with SMTP id g3so2413174wrx.2 for ; Fri, 10 Apr 2020 06:55:38 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526973; 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=zYy2fmrg0Ycy1awlKU3yZhLJsYj0C0/tIoI0fxD4+hU=; b=HppYqUkeer2qfl7+QiKynjKovEOPrBgl/fPxk7CvOLkBu1Vs+psvOwA59ANhSlVNAEiOzh g5y2vHPwOZo3yllp2wKUE5NSdh+1W+FHUDW6F5qS7p3vwWuyp/SciSeLDmHIzjmzSNfA2g mR5ISNw/7wG8w6QC2zxgFf42VmUDM5A= X-MC-Unique: UCGylcxFP0exh88d1yiwZw-1 X-MC-Unique: Dg8ZMRC0MvSimIsZphkFUw-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=hua2CQnFBXLcn5Yprcd0XEUvB55XUzt2U3ELEn1TQ1Q=; b=C1aj75CANGUrExVKwAZBZFnWFgO2cgRMejqb2gYwgYrDUguVlQJQeTiW3U5d+C2Sol cxfwYHPdfY9O8f8Rtmntecs9RwgENs0EBtyJJ4IZ0fM/Lk7uIbWR719hB08V7Fq0Nwo3 R56ZSI5A6uXWUUtWjkkKA6Dx6O1hmt6O7WgrhX8RIzxIGobgMtY7tYyeqniGZItYHEXQ 81y/MuxFLQJaQ3+gs1WVQFzvIeUk5koeNYV4jEP3gq9Oqk+qK50K3Tb3DTzv11nMJpVj wuebfd72SsuSHsrvDZZACZy2nQU8ACIcZ3U0CkTQ4hJYBkJ2zE4S3PyKqVofqVaND0AV bWLA== X-Gm-Message-State: AGi0PubhKaaz806Voe0FKs/CCDsFivlBg5oHauik/Fbvcn1tnQ3S+kPx gqFoKnrefLnTuYWUlKYKg4iXoGVxEYE= X-Google-Smtp-Source: APiQypLWFT32dh1NlvodzY1p8GR9uurcVKUbjsJdHKnztwv5rm/8csx5VEHxEGTrwMA7qykACFFfcg== X-Received: by 2002:adf:ed86:: with SMTP id c6mr4537353wro.286.1586526937645; Fri, 10 Apr 2020 06:55:37 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 07/43] vbox: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:34 +0200 Message-Id: <20200410135510.2148319-8-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.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtfsH022946 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.14 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 --- src/vbox/vbox_common.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index e98ae04ec0..98d6978c51 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -58,7 +58,7 @@ VIR_LOG_INIT("vbox.vbox_common"); static vboxUniformedAPI gVBoxAPI; =20 static virClassPtr vboxDriverClass; -static virMutex vbox_driver_lock =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE_STATIC(vbox_driver_lock); static vboxDriverPtr vbox_driver; static vboxDriverPtr vboxDriverObjNew(void); =20 @@ -233,7 +233,7 @@ vboxSdkUninitialize(void) static vboxDriverPtr vboxGetDriverConnection(void) { - virMutexLock(&vbox_driver_lock); + G_LOCK(vbox_driver_lock); =20 if (vbox_driver) { virObjectRef(vbox_driver); @@ -253,14 +253,14 @@ vboxGetDriverConnection(void) if (!virObjectUnref(vbox_driver)) vbox_driver =3D NULL; =20 - virMutexUnlock(&vbox_driver_lock); + G_UNLOCK(vbox_driver_lock); =20 return NULL; } =20 vbox_driver->connectionCount++; =20 - virMutexUnlock(&vbox_driver_lock); + G_UNLOCK(vbox_driver_lock); =20 return vbox_driver; } @@ -268,7 +268,7 @@ vboxGetDriverConnection(void) static void vboxDestroyDriverConnection(void) { - virMutexLock(&vbox_driver_lock); + G_LOCK(vbox_driver_lock); =20 if (!vbox_driver) goto cleanup; @@ -281,7 +281,7 @@ vboxDestroyDriverConnection(void) vbox_driver =3D NULL; =20 cleanup: - virMutexUnlock(&vbox_driver_lock); + G_UNLOCK(vbox_driver_lock); } =20 static int openSessionForMachine(vboxDriverPtr data, const unsigned char *= dom_uuid, --=20 2.25.2 From nobody Sun Feb 8 16:05:40 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=1586526980; cv=none; d=zohomail.com; s=zohoarc; b=H0T0p4aGepILJ761j8Q1j5XpK2/ztVJGskoT378tNzdrBnGP6iDSs3GrtbB3uWCGaiZhivUfAhSimOV66zChfnRcLjyRn70Zi6N1XmHuF/Ocdnjen5Fto6d5t7Ua+um1aEaop61vCz3j4eWVGkS9sc8StvRA9sJGRnxMGgg/GjU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526980; 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=vzcSI17PExR9vM1AbkyKflBFIg/dCcBHifFIzugsJmQ=; b=DCFHX4nGPGPFFYIHN81Q+OGPdeslnN5zuq9lsP4dNW5fUcsQOE5sqQyiyO8USerBXVEAAkUg1KJKZ8ETtG8ZItOyj0cQM1ti4Jbc1jZy6SzLLs20krfCzW25xX+KjYXuTCW+6wub66jnmj1dExcmkrX8EMFbKgr6FXUm5unJVoI= 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 1586526980240891.5499211948813; Fri, 10 Apr 2020 06:56:20 -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-423-_9DX52NfNYKus8GIvqAkgw-1; Fri, 10 Apr 2020 09:56:13 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0215A18B5F77; Fri, 10 Apr 2020 13:56:08 +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 BD60D5C557; Fri, 10 Apr 2020 13:56:07 +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 6FDD393091; Fri, 10 Apr 2020 13:56:07 +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 03ADtgsM022960 for ; Fri, 10 Apr 2020 09:55:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id C6345127512; Fri, 10 Apr 2020 13:55:42 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C29A6127510 for ; Fri, 10 Apr 2020 13:55:42 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 A9D63101A55D for ; Fri, 10 Apr 2020 13:55:42 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-188-xXLOYRdMNGKbtmPsDynKtQ-1; Fri, 10 Apr 2020 09:55:40 -0400 Received: by mail-wm1-f65.google.com with SMTP id r26so2831911wmh.0 for ; Fri, 10 Apr 2020 06:55:40 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526978; 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=vzcSI17PExR9vM1AbkyKflBFIg/dCcBHifFIzugsJmQ=; b=eAbaS55zi4pka+UQ3/WtnDmTrLnVRbL0rXmN95btuLknfXLlGj8azg0wXM+Unf67VtUfVl xv8+7OJx2bVkBQXuIjLJKwMlSxikbIf4NR9kbt31xk9PBYxuwLaksJ56mrRFhaoLe5I8nt rG6P0CHUdYtMMF32RPvsLx5XU8oTOTM= X-MC-Unique: _9DX52NfNYKus8GIvqAkgw-1 X-MC-Unique: xXLOYRdMNGKbtmPsDynKtQ-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=nk8/24cAGItny9zidgFFVKFLJZ7FO/T2WLY89VrRZ7s=; b=NYNqFCJEzHxONbqlJBIw0OpVsmEM10SQRDLbQ4ob4s0bJSbOUiTCiz8ETTwhwYQb3y hkQpkL4Qp55WGid/r6FLWOI5XvTfkuETKc60+hvV3Cjn/BmoD2YSGzN3pSQhv3ryMD9x FJT9qMUUZfH10ttkICgreMlSglcigGVBaQ2Dp6UTaQCe/eIZcKdercIxEsJtuuudOM1M ldsK71V92BqZo+44iqw+R/Q3wlwLOCBQc/3w4oRKP74MSYt4BYF+54Vyh5k9to5uvZFg jjvwnDtIHP3f4je/CzvwgpSDx69dDIYvyddDWPLVusgtBxuuwMYz6XkVy7zth3myj1by melg== X-Gm-Message-State: AGi0PuaUnvxNmhhp0nZq+CCruojG7OTeZKjt3UQsDQcacpCIh5qexTl4 He5jUN9Ik4tsQZNQOzmIHvO967p4rDk= X-Google-Smtp-Source: APiQypI1m6jGoKYYxsdcDjY7DiBolUCf9no8/0hqwJcANNg7eiTgge9x73x3jCswle9Wl+KG7ggwvg== X-Received: by 2002:a1c:6545:: with SMTP id z66mr5112264wmb.81.1586526938816; Fri, 10 Apr 2020 06:55:38 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 08/43] util: virnodesuspend: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:35 +0200 Message-Id: <20200410135510.2148319-9-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 03ADtgsM022960 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.16 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 --- src/util/virnodesuspend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c index 544a29783c..f336b3aa98 100644 --- a/src/util/virnodesuspend.c +++ b/src/util/virnodesuspend.c @@ -49,18 +49,18 @@ VIR_LOG_INIT("util.nodesuspend"); static unsigned int nodeSuspendTargetMask; static bool nodeSuspendTargetMaskInit; =20 -static virMutex virNodeSuspendMutex =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE_STATIC(virNodeSuspendMutex); =20 static bool aboutToSuspend; =20 static void virNodeSuspendLock(void) { - virMutexLock(&virNodeSuspendMutex); + G_LOCK(virNodeSuspendMutex); } =20 static void virNodeSuspendUnlock(void) { - virMutexUnlock(&virNodeSuspendMutex); + G_UNLOCK(virNodeSuspendMutex); } =20 =20 --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586526981; cv=none; d=zohomail.com; s=zohoarc; b=lEfj6xFrM6Irec2NmhotS5UxJr67wiQFVzC+YxMW/ql0sE8mvdql31WYAm5P90TEZnZbVlQTD2e+pecqaZ8qnVNnSsvee8RVASb3917c7DNlanQYOU7mIJOzwsidnNIHIQW1rQ/owxtvOhjSgX7L2ViJyHp+jHVayh+L5yj07IE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526981; 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=7lYaYP7jPh9OEna7GC0HxYxbBg72BbpV1uMO88lPnwI=; b=YZavlBcDSUNx9q77NltxnHOWy/agCv8NKZl+riUSLqnoo6Gnex0kENeXCc9uc/pVmG3mYknhz1jGFenlNMn3fx/ClZQASV7UBeGz4FNtFelczSxaE9I4sC9GZAAs4guhYm9mykxOTw3SkuMMUKZpwy0HteFZ46cqgo1ZuGPfshY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586526981555737.0030748809338; Fri, 10 Apr 2020 06:56:21 -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-127-xzwjABGDOumqHkStsT6XFw-1; Fri, 10 Apr 2020 09:56:16 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AEE78017FF; Fri, 10 Apr 2020 13:56:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7A40101D484; Fri, 10 Apr 2020 13:56:09 +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 5DBC4180612F; Fri, 10 Apr 2020 13:56:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtiEI022977 for ; Fri, 10 Apr 2020 09:55:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7CC57200AD4C; Fri, 10 Apr 2020 13:55:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77B672028CD6 for ; Fri, 10 Apr 2020 13:55:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 5D5A8802D05 for ; Fri, 10 Apr 2020 13:55:44 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-V4Rh7RcTN26Ez2o4fgtuBA-1; Fri, 10 Apr 2020 09:55:41 -0400 Received: by mail-wr1-f66.google.com with SMTP id a25so2423675wrd.0 for ; Fri, 10 Apr 2020 06:55:41 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526980; 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=7lYaYP7jPh9OEna7GC0HxYxbBg72BbpV1uMO88lPnwI=; b=cIdAiREvGxqCbDvVM8mHhrazjPfAUsJMJDYj02kuEHmuPnwzCGCcZGzxwgKIFGRlIDzw6m tXcKmJwSW6SCZv87BylrfJ/rS0ezqceZiy21NIFU4KUzZPVwRSSva1yskZHpXfVierNMt6 UdT9gAMJNAFIN055OINaGwhSL3C2eKg= X-MC-Unique: xzwjABGDOumqHkStsT6XFw-1 X-MC-Unique: V4Rh7RcTN26Ez2o4fgtuBA-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=EpWuDEHNFkhEJVr8t10MPSKi2a/ffLCMn6Out48vDUQ=; b=oX/Bqwlneis0Hz/YhCqhQlbDEH2xnTjqHp/mqyjtik5VZqihbiWQ1R7/6UoUtJkYnv qBVSYX/xKCy7rJjuXtGVzZd77dJfH7i01KKly2rgyRdirW78MDQ0LaG/Ai6dv5s1gTIj HDAXRcP1x9/BtCwYkaL1oHj/vDqhkwW3d0fYt+XjddY9o5mzxAN3+13ZDoQa/Ln7K0Z/ h/8cBJPgBICSrb5ebvWur7joR+tj0QLirGcH+ZB770stYYwmn/5xaMA0Fw4tYN96dFsy /3ej8WbTYarAO7kBDFa4yBh7Umk6Y6k6QxDn/8X9Ydf+UGYJOmM21iZpxxkY0chMJNkG eAgQ== X-Gm-Message-State: AGi0PuYEdM/nHjXOLYigQ4Kp5PYb2VNqLtj+fF3pwGfbgpUxWO1n8GeV SFnv3tA4ypsfEBbEGi2ASfz6OgCJyxU= X-Google-Smtp-Source: APiQypIC6RtTbsO3cwJhAlsdSdN9fS8R6WJNRgGlfGgB6y1HimFdsd5MqVvFEI4aZhqp0B9wlEx42A== X-Received: by 2002:adf:f3c5:: with SMTP id g5mr4702412wrp.230.1586526940188; Fri, 10 Apr 2020 06:55:40 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 09/43] libxl: convert virMutex to GMutex in libxlPrivate Date: Fri, 10 Apr 2020 15:54:36 +0200 Message-Id: <20200410135510.2148319-10-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.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtiEI022977 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.84 on 10.5.11.22 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 --- src/libxl/libxl_conf.h | 6 +++--- src/libxl/libxl_driver.c | 9 ++------- tests/testutilsxen.c | 9 ++------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index 07b3373170..b29752ad0c 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -106,7 +106,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(libxlDriverConfig, virObj= ectUnref); =20 =20 struct _libxlDriverPrivate { - virMutex lock; + GMutex lock; =20 virHostdevManagerPtr hostdevMgr; /* Require lock to get reference on 'config', @@ -225,11 +225,11 @@ libxlBuildDomainConfig(virPortAllocatorRangePtr graph= icsports, static inline void libxlDriverLock(libxlDriverPrivatePtr driver) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } =20 static inline void libxlDriverUnlock(libxlDriverPrivatePtr driver) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 980984b199..dae20cf453 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -520,7 +520,7 @@ libxlStateCleanup(void) virPidFileRelease(libxl_driver->config->stateDir, "driver", libxl_= driver->lockFD); =20 virObjectUnref(libxl_driver->config); - virMutexDestroy(&libxl_driver->lock); + g_mutex_clear(&libxl_driver->lock); VIR_FREE(libxl_driver); =20 return 0; @@ -669,12 +669,7 @@ libxlStateInitialize(bool privileged, return VIR_DRV_STATE_INIT_ERROR; =20 libxl_driver->lockFD =3D -1; - if (virMutexInit(&libxl_driver->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); - VIR_FREE(libxl_driver); - return VIR_DRV_STATE_INIT_ERROR; - } + g_mutex_init(&libxl_driver->lock); =20 libxl_driver->inhibitCallback =3D callback; libxl_driver->inhibitOpaque =3D opaque; diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c index d50c3003da..fcc7009f74 100644 --- a/tests/testutilsxen.c +++ b/tests/testutilsxen.c @@ -87,12 +87,7 @@ libxlDriverPrivatePtr testXLInitDriver(void) { libxlDriverPrivatePtr driver =3D g_new0(libxlDriverPrivate, 1); =20 - if (virMutexInit(&driver->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", "cannot initialize mutex"); - g_free(driver); - return NULL; - } + g_mutex_init(&driver->lock); =20 if (!(driver->config =3D libxlDriverConfigNew())) return NULL; @@ -114,6 +109,6 @@ void testXLFreeDriver(libxlDriverPrivatePtr driver) { virObjectUnref(driver->config); virObjectUnref(driver->xmlopt); - virMutexDestroy(&driver->lock); + g_mutex_clear(&driver->lock); g_free(driver); } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586526982; cv=none; d=zohomail.com; s=zohoarc; b=GNYxAOTfXCRdXJ+6Eml2BzfoFi0iUOKZJrAN1EtCQyAX0484PPk39T/tk+iATcGLWYElMjRaO7D8S0vTB8h+pyLe+hAJ2nhyv3A1YwUC438UjARb+wKyqhPzOo7SkQPt3uKYn5ickA7jmY3h7pkIIETjifd4torQRoZAkJaP5/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526982; 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=DVPEUh6tjMppZUfI0B2Oi2+AinSzNU8Gq0mcOCwbgfg=; b=lZW6DsZj4FHdedeUs/wKcxKU4B+BW/OUHZMocEweD8C2d8TFzsFfQu8v7/4MH9ZskXIvol1wcb9vVw/1LXh/PZ8iA9AzN90Wk5iSOO2T86G2e4rI7Z8MERZIMliwSYIkimgjyIGchded/kCvS1v2WJ9F4fZ37NOgDDAAk0ms+1o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586526982554353.86170012998116; Fri, 10 Apr 2020 06:56:22 -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-241-wxnCj8r2OwS8GLdcAbnWHQ-1; Fri, 10 Apr 2020 09:56:19 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C471E107ACC9; Fri, 10 Apr 2020 13:56:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A65A5DA75; Fri, 10 Apr 2020 13:56:13 +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 5553B1803C33; Fri, 10 Apr 2020 13:56:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtjTK022992 for ; Fri, 10 Apr 2020 09:55:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7CE1F10EE826; Fri, 10 Apr 2020 13:55:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78AF310EE823 for ; Fri, 10 Apr 2020 13:55:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 5704F185A78E for ; Fri, 10 Apr 2020 13:55:45 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-497-3hj1NVHAMPO4r_bWZ8zyug-1; Fri, 10 Apr 2020 09:55:42 -0400 Received: by mail-wr1-f65.google.com with SMTP id f13so2344303wrm.13 for ; Fri, 10 Apr 2020 06:55:42 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526981; 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=DVPEUh6tjMppZUfI0B2Oi2+AinSzNU8Gq0mcOCwbgfg=; b=HiPFZq14wu9OWsfu0hoM0ZQxZDXJnmnID2MLk5lsZQYFmeoCGUc8x0FSLNYg8V9U8QXd+4 KQeyBR2UuF+L18hJXrRximIJAFHxbbg0Cjg6M718WG9sX3kKZ+37KCFUjxS+pBZZAl7W2X AMQeoybwE81zuLjXvNkf5Wyfs2YXrrI= X-MC-Unique: wxnCj8r2OwS8GLdcAbnWHQ-1 X-MC-Unique: 3hj1NVHAMPO4r_bWZ8zyug-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=3Oq6sZFjQNurBnRarOiKO3C+QgBfXyfLYBYDygiBBOs=; b=XxDPsD8G9H6HePX51MnV5HHUDodPzaFaxp7Zip4dZwzOxU0qqoh/J26nrVzjQXyEL8 xnnfRBI8lEyiz4x4dZiKFNBv/ZfaGuaQe41/ODBvstiN3wozPRkibkPyaaowtBWRGtXJ EhC2+/6qDkFJUYx9FwxLoihgts/HJyj0hSEx3dcYCNyuEZCV3OnZ2wWGTWngaN0clMCO 0dTiBXdjanHOtZRK7xQuNoo4Y62jMkgnD6N4dt5MFFbv+PdKT9VJVp7MO7Y8ulK6gkwe z41pl1PdEWb84NVLXt62IMDvCXcSCEM+zce9ydT51XbLZLAFGpBIR5Fk0vFOH4RsTqOh iC+A== X-Gm-Message-State: AGi0Pub6EIhi1d9KysWcYydbiPZCross1Xh9VfKDqWaPs3sRakKivP3S H4WIeppdF8oLZvBeVT5MAmwEzlTsm8s= X-Google-Smtp-Source: APiQypLnEze5a5q/dY4BZDmHZ/Vxmz2cJjn2PSLfkfCNK3g2Xt+UfbPgyXKlN5IOMahr30lHlsPyuA== X-Received: by 2002:a5d:6204:: with SMTP id y4mr5034966wru.410.1586526941500; Fri, 10 Apr 2020 06:55:41 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 10/43] vz: vz_driver: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:37 +0200 Message-Id: <20200410135510.2148319-11-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtjTK022992 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.14 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 --- src/vz/vz_driver.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index d882b91def..058e5b8614 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -67,7 +67,7 @@ static virClassPtr vzDriverClass; static bool vz_driver_privileged; /* pid file FD, ensures two copies of the driver can't use the same root */ static int vz_driver_lock_fd =3D -1; -static virMutex vz_driver_lock; +G_LOCK_DEFINE_STATIC(vz_driver_lock); static vzDriverPtr vz_driver; static vzConnPtr vz_conn_list; =20 @@ -177,11 +177,11 @@ vzGetDriverConnection(void) "%s", _("vz state driver is not active")); return NULL; } - virMutexLock(&vz_driver_lock); + G_LOCK(vz_driver_lock); if (!vz_driver) vz_driver =3D vzDriverObjNew(); virObjectRef(vz_driver); - virMutexUnlock(&vz_driver_lock); + G_UNLOCK(vz_driver_lock); =20 return vz_driver; } @@ -192,10 +192,10 @@ vzDestroyDriverConnection(void) vzDriverPtr driver; vzConnPtr privconn_list; =20 - virMutexLock(&vz_driver_lock); + G_LOCK(vz_driver_lock); driver =3D g_steal_pointer(&vz_driver); privconn_list =3D g_steal_pointer(&vz_conn_list); - virMutexUnlock(&vz_driver_lock); + G_UNLOCK(vz_driver_lock); =20 while (privconn_list) { vzConnPtr privconn =3D privconn_list; @@ -389,10 +389,10 @@ vzConnectOpen(virConnectPtr conn, if (!(privconn->closeCallback =3D virNewConnectCloseCallbackData())) goto error; =20 - virMutexLock(&vz_driver_lock); + G_LOCK(vz_driver_lock); privconn->next =3D vz_conn_list; vz_conn_list =3D privconn; - virMutexUnlock(&vz_driver_lock); + G_UNLOCK(vz_driver_lock); =20 return VIR_DRV_OPEN_SUCCESS; =20 @@ -413,7 +413,7 @@ vzConnectClose(virConnectPtr conn) if (!privconn) return 0; =20 - virMutexLock(&vz_driver_lock); + G_LOCK(vz_driver_lock); for (curr =3D vz_conn_list; curr; prev =3D &curr->next, curr =3D curr-= >next) { if (curr =3D=3D privconn) { *prev =3D curr->next; @@ -421,7 +421,7 @@ vzConnectClose(virConnectPtr conn) } } =20 - virMutexUnlock(&vz_driver_lock); + G_UNLOCK(vz_driver_lock); =20 virObjectUnref(privconn->closeCallback); virObjectUnref(privconn->driver); @@ -4094,7 +4094,6 @@ vzStateCleanup(void) vz_driver =3D NULL; if (vz_driver_lock_fd !=3D -1) virPidFileRelease(VZ_STATEDIR, "driver", vz_driver_lock_fd); - virMutexDestroy(&vz_driver_lock); prlsdkDeinit(); } return 0; @@ -4132,17 +4131,10 @@ vzStateInitialize(bool privileged, return VIR_DRV_STATE_INIT_ERROR; } =20 - if (virMutexInit(&vz_driver_lock) < 0) - goto error; - /* Failing to create driver here is not fatal and only means * that next driver client will try once more when connecting */ vz_driver =3D vzDriverObjNew(); return VIR_DRV_STATE_INIT_COMPLETE; - - error: - vzStateCleanup(); - return VIR_DRV_STATE_INIT_ERROR; } =20 static virStateDriver vzStateDriver =3D { --=20 2.25.2 From nobody Sun Feb 8 16:05:40 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=1586526978; cv=none; d=zohomail.com; s=zohoarc; b=UJMLjAyrTuuAC9tl+cN1kzUbABDjSJbv2Q47gbqL9iUVMZBDo6I+AVLr6HdylZuhSrTJyYp8h7Dc4b2oxTeLwDv4gcLEMfZF4lqRCQRUD/FWB3CqLQufOwqszQjmV33x1CkYJ2NZm7YiUOKr5BNgZo/CpUXrlH1Irrqquh8cLoQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526978; 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=5yIfH4oFVGfdV3tZIM2d728y+6DrDOhGs2B/2ZcEN+o=; b=BS76g7x3vdcCoWWqjoPjdDb+vVknxrv0wT61j3cCw/pX0AatCtxDdtjNHq149cZRGcfEBt0kXLqU+O1zbvMBY4aYGx0kul3ASRsfDxYVaJKbkHXm3p5LaA9bGxfr4Ihc//M4YS4aWCfH9MIisvg4Zpx4RJ6WrEo0mrmABNUmJhI= 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 1586526978110171.52522900778126; Fri, 10 Apr 2020 06:56:18 -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-473-4NkqrVUHMcyKbKTY7O7XBg-1; Fri, 10 Apr 2020 09:56:14 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B47AF104FB6C; Fri, 10 Apr 2020 13:56:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 866249E0D6; Fri, 10 Apr 2020 13:56:08 +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 3023C180880C; Fri, 10 Apr 2020 13:56:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtlNB023004 for ; Fri, 10 Apr 2020 09:55:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id F30972166B35; Fri, 10 Apr 2020 13:55:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EEE932166B34 for ; Fri, 10 Apr 2020 13:55:46 +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 D0725802D05 for ; Fri, 10 Apr 2020 13:55:46 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-492-kn1J0IgeOn-DpsCmErndTw-1; Fri, 10 Apr 2020 09:55:44 -0400 Received: by mail-wr1-f65.google.com with SMTP id 65so2413984wrl.1 for ; Fri, 10 Apr 2020 06:55:44 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526976; 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=5yIfH4oFVGfdV3tZIM2d728y+6DrDOhGs2B/2ZcEN+o=; b=h2KDgpKwgXYuRo4krbUr/EEKHvgQLu6tBjDE8tvYRH2vaAIyiqZ1tYjkjJOm7yrzd0XQbJ X3qCGhPfbsUbhLIx5HjKclZCnkDo5I9/JJu5v9nP1qJwQc7O4Hnl6yRCISrzXcbjuv7bsC HxnKt/OIl+SNd5+V3KHiORJoQHqrrhA= X-MC-Unique: 4NkqrVUHMcyKbKTY7O7XBg-1 X-MC-Unique: kn1J0IgeOn-DpsCmErndTw-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=uKqnIs9VIez/4n8nNAEBJMfdFOWImZOH4pLXTibob/U=; b=jEMjPqnPuDGnCOQS/8iy/8RT5kg4fFN0WOROKTuSKYsorEq4I9uew5Dhjx1xPFLPln rbuq3FmJWKdMjydcTQKfNN+7B0/pWJJXjRWy24oD7F6reiJRY+yD28ayhZWKAdA6slwN tZAjYJTvIsy5U3nSMEnoShXXcCDQGsoND2dUSd0oxlqiLUbWxgUOkjIT5VB+QNPoYyiF ZdytjZeDqg4U78BbL00/KIWnM1UB2szm8zXuyNcehd1B9qCg7wEfJ+iIdRA4aEXP/kHJ cjscghsipRpiEde+IJtauU3kbYXjMuECzJNO5xl2/weVOhiQxZNLvVncrRlie/5DPaYq 7I9A== X-Gm-Message-State: AGi0Pua5omOyr36jIASu5g+JnuDLm7g2u4lDIsRYUtOpjZBfG067AKFX L4gUotYghdQPJ7JBBb0U+N0mzkUhlXA= X-Google-Smtp-Source: APiQypIIyt6uX1sYcxOuPJPZcsbQxp3bbKUlvAxtVjenED6iFy0zMEUcKdKtqHPrbJgqX49RVX06lA== X-Received: by 2002:a5d:4746:: with SMTP id o6mr4739512wrs.304.1586526942704; Fri, 10 Apr 2020 06:55:42 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 11/43] locking: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:38 +0200 Message-Id: <20200410135510.2148319-12-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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtlNB023004 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.13 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 --- src/locking/lock_daemon.c | 32 +++++++++--------------------- src/locking/lock_daemon.h | 2 +- src/locking/lock_daemon_dispatch.c | 32 ++++++++---------------------- 3 files changed, 18 insertions(+), 48 deletions(-) diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index 4eff63014a..69aa1f688a 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -59,7 +59,7 @@ VIR_LOG_INIT("locking.lock_daemon"); #define VIR_LOCK_DAEMON_NUM_LOCKSPACES 3 =20 struct _virLockDaemon { - virMutex lock; + GMutex lock; virNetDaemonPtr dmn; virHashTablePtr lockspaces; virLockSpacePtr defaultLockspace; @@ -89,7 +89,7 @@ virLockDaemonFree(virLockDaemonPtr lockd) if (!lockd) return; =20 - virMutexDestroy(&lockd->lock); + g_mutex_clear(&lockd->lock); virObjectUnref(lockd->dmn); virHashFree(lockd->lockspaces); virLockSpaceFree(lockd->defaultLockspace); @@ -100,13 +100,13 @@ virLockDaemonFree(virLockDaemonPtr lockd) static inline void virLockDaemonLock(virLockDaemonPtr lockd) { - virMutexLock(&lockd->lock); + g_mutex_lock(&lockd->lock); } =20 static inline void virLockDaemonUnlock(virLockDaemonPtr lockd) { - virMutexUnlock(&lockd->lock); + g_mutex_unlock(&lockd->lock); } =20 static void virLockDaemonLockSpaceDataFree(void *data) @@ -123,12 +123,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool p= rivileged) if (VIR_ALLOC(lockd) < 0) return NULL; =20 - if (virMutexInit(&lockd->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); - VIR_FREE(lockd); - return NULL; - } + g_mutex_init(&lockd->lock); =20 if (!(lockd->dmn =3D virNetDaemonNew())) goto error; @@ -220,12 +215,7 @@ virLockDaemonNewPostExecRestart(virJSONValuePtr object= , bool privileged) if (VIR_ALLOC(lockd) < 0) return NULL; =20 - if (virMutexInit(&lockd->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); - VIR_FREE(lockd); - return NULL; - } + g_mutex_init(&lockd->lock); =20 if (!(lockd->lockspaces =3D virHashCreate(VIR_LOCK_DAEMON_NUM_LOCKSPAC= ES, virLockDaemonLockSpaceDataFree= ))) @@ -450,7 +440,7 @@ virLockDaemonClientFree(void *opaque) } } =20 - virMutexDestroy(&priv->lock); + g_mutex_clear(&priv->lock); VIR_FREE(priv->ownerName); VIR_FREE(priv); } @@ -469,11 +459,7 @@ virLockDaemonClientNew(virNetServerClientPtr client, if (VIR_ALLOC(priv) < 0) return NULL; =20 - if (virMutexInit(&priv->lock) < 0) { - VIR_FREE(priv); - virReportSystemError(errno, "%s", _("unable to init mutex")); - return NULL; - } + g_mutex_init(&priv->lock); =20 if (virNetServerClientGetUNIXIdentity(client, &clientuid, @@ -508,7 +494,7 @@ virLockDaemonClientNew(virNetServerClientPtr client, return priv; =20 error: - virMutexDestroy(&priv->lock); + g_mutex_clear(&priv->lock); VIR_FREE(priv); return NULL; } diff --git a/src/locking/lock_daemon.h b/src/locking/lock_daemon.h index 7d30551c32..2405ef2036 100644 --- a/src/locking/lock_daemon.h +++ b/src/locking/lock_daemon.h @@ -30,7 +30,7 @@ typedef struct _virLockDaemonClient virLockDaemonClient; typedef virLockDaemonClient *virLockDaemonClientPtr; =20 struct _virLockDaemonClient { - virMutex lock; + GMutex lock; bool restricted; =20 pid_t ownerPid; diff --git a/src/locking/lock_daemon_dispatch.c b/src/locking/lock_daemon_d= ispatch.c index 1a53772366..1587785606 100644 --- a/src/locking/lock_daemon_dispatch.c +++ b/src/locking/lock_daemon_dispatch.c @@ -48,8 +48,7 @@ virLockSpaceProtocolDispatchAcquireResource(virNetServerP= tr server G_GNUC_UNUSED virNetServerClientGetPrivateData(client); virLockSpacePtr lockspace; unsigned int newFlags; - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 virCheckFlagsGoto(VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED | VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE,= cleanup); @@ -90,7 +89,6 @@ virLockSpaceProtocolDispatchAcquireResource(virNetServerP= tr server G_GNUC_UNUSED cleanup: if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -107,8 +105,7 @@ virLockSpaceProtocolDispatchCreateResource(virNetServer= Ptr server G_GNUC_UNUSED, virLockDaemonClientPtr priv =3D virNetServerClientGetPrivateData(client); virLockSpacePtr lockspace; - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 virCheckFlagsGoto(0, cleanup); =20 @@ -139,7 +136,6 @@ virLockSpaceProtocolDispatchCreateResource(virNetServer= Ptr server G_GNUC_UNUSED, cleanup: if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -156,8 +152,7 @@ virLockSpaceProtocolDispatchDeleteResource(virNetServer= Ptr server G_GNUC_UNUSED, virLockDaemonClientPtr priv =3D virNetServerClientGetPrivateData(client); virLockSpacePtr lockspace; - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 virCheckFlagsGoto(0, cleanup); =20 @@ -188,7 +183,6 @@ virLockSpaceProtocolDispatchDeleteResource(virNetServer= Ptr server G_GNUC_UNUSED, cleanup: if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -205,8 +199,7 @@ virLockSpaceProtocolDispatchNew(virNetServerPtr server = G_GNUC_UNUSED, virLockDaemonClientPtr priv =3D virNetServerClientGetPrivateData(client); virLockSpacePtr lockspace; - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 virCheckFlagsGoto(0, cleanup); =20 @@ -244,7 +237,6 @@ virLockSpaceProtocolDispatchNew(virNetServerPtr server = G_GNUC_UNUSED, cleanup: if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -260,8 +252,7 @@ virLockSpaceProtocolDispatchRegister(virNetServerPtr se= rver G_GNUC_UNUSED, unsigned int flags =3D args->flags; virLockDaemonClientPtr priv =3D virNetServerClientGetPrivateData(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 virCheckFlagsGoto(0, cleanup); =20 @@ -289,7 +280,6 @@ virLockSpaceProtocolDispatchRegister(virNetServerPtr se= rver G_GNUC_UNUSED, cleanup: if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -306,8 +296,7 @@ virLockSpaceProtocolDispatchReleaseResource(virNetServe= rPtr server G_GNUC_UNUSED virLockDaemonClientPtr priv =3D virNetServerClientGetPrivateData(client); virLockSpacePtr lockspace; - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 virCheckFlagsGoto(0, cleanup); =20 @@ -340,7 +329,6 @@ virLockSpaceProtocolDispatchReleaseResource(virNetServe= rPtr server G_GNUC_UNUSED cleanup: if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -356,8 +344,7 @@ virLockSpaceProtocolDispatchRestrict(virNetServerPtr se= rver G_GNUC_UNUSED, unsigned int flags =3D args->flags; virLockDaemonClientPtr priv =3D virNetServerClientGetPrivateData(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 virCheckFlagsGoto(0, cleanup); =20 @@ -379,7 +366,6 @@ virLockSpaceProtocolDispatchRestrict(virNetServerPtr se= rver G_GNUC_UNUSED, cleanup: if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -395,8 +381,7 @@ virLockSpaceProtocolDispatchCreateLockSpace(virNetServe= rPtr server G_GNUC_UNUSED virLockDaemonClientPtr priv =3D virNetServerClientGetPrivateData(client); virLockSpacePtr lockspace; - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (priv->restricted) { virReportError(VIR_ERR_OPERATION_DENIED, "%s", @@ -424,6 +409,5 @@ virLockSpaceProtocolDispatchCreateLockSpace(virNetServe= rPtr server G_GNUC_UNUSED cleanup: if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586526982; cv=none; d=zohomail.com; s=zohoarc; b=P1PDs/tYSEjkRbDghXpVgj/iFoZ1vBG6JXf7lUDrQ948Eg4ELOKUf4frHp2BCHmyVXN5cZAmR0fUyWoqB52bkzIIE75R8bLE23MutuqbG741hz7/9nWNyHVrwOTYDODT6cYKWeAMf6hI3am8fVrEWZjBBmk+9wuOHAh0FRKSCnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526982; 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=ZCoVmlc0x1VBv+fGKm8+h0rFqfSFgf4Iue74DypJuMg=; b=iF5oB8+jLkG6BjdYWNEyjzX970Tm8GNsXHCIlZkePCZ9SamdH3X7dm4LC5YNL4vnXMqk84C3e1XI7Q+8+qiy7JHZs9/cELO5RcDFcudZHCJxc8Ah64LV1IEQ1CZ2VMkjhNiY8DaZlm4H77ZicHr3XOy5oPX2p13FGnQ1VGhpX8I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586526982035293.2876318345442; Fri, 10 Apr 2020 06:56:22 -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-446-Z-Mv-kSqP6CsLwHB185XIg-1; Fri, 10 Apr 2020 09:56:18 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 501F118B5F80; Fri, 10 Apr 2020 13:56:12 +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 2081A1036B52; Fri, 10 Apr 2020 13:56:12 +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 B662F9308E; Fri, 10 Apr 2020 13:56:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtl68023011 for ; Fri, 10 Apr 2020 09:55:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id D351610EE826; Fri, 10 Apr 2020 13:55:47 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF69310EE823 for ; Fri, 10 Apr 2020 13:55:47 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 B6D52185A78F for ; Fri, 10 Apr 2020 13:55:47 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-cbCfK-YuMVWekwDgoF2Olw-1; Fri, 10 Apr 2020 09:55:45 -0400 Received: by mail-wr1-f65.google.com with SMTP id 65so2414025wrl.1 for ; Fri, 10 Apr 2020 06:55:45 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526980; 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=ZCoVmlc0x1VBv+fGKm8+h0rFqfSFgf4Iue74DypJuMg=; b=EWTqyrP5H2AbQjL+7AJqKsS7JvPtesth/W+YEhrfsWIKaaPmShajpdMW+fbuWJqmvV5SZi n9RotmfGXRPgi7iNIn/IyWeMW3cyctvDlgx1r215XMaMdf5IHfN1jjgJesEZy6L3FbRptZ 1XwyESWeux7lfs0Gfj1xWvtl4zuzBdc= X-MC-Unique: Z-Mv-kSqP6CsLwHB185XIg-1 X-MC-Unique: cbCfK-YuMVWekwDgoF2Olw-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=9FczAh4RlEGQIGfnjKBDBivPgTTk9+KS5/2ZwHROd18=; b=VDjMIv8LHKaA3Vgny+U64tPf7cLvThMCiUrqqc3sMwXh5gIZy08j1PPNOxjydtJmWs IIzjer/+Zz4t/SQJBzRq8w2Qci7rItgQ334CA7ibpRUjrEtwqXo8i3921CXNlKcCXZVh kyFB4bRf5Wimic0IsAGJI6VOknGKIpLF84UrowlYSoRIx0OA0nv2psDPYQ+Sl03ETEfz Ys1a2BiX9uNSBlH8mK2AvZAeVGRr6qTA4oqbEGnoyiKnLscGhwmKYVXy7126nKHG3vbb 0ZmZoOKn0bqxl9IvADOnCcVjrL177jkWNz3gB1k5Ssl8st1kl/ws2tDFuOHLwsi4x3IG lRog== X-Gm-Message-State: AGi0PuYV9Czk0zGjIhU25EuFgaqfGUZCzOssyBsJ/zqaGPjJcqLpQuZJ ixtp7o+8/tWWyzpvQx6IQ39um23/W6A= X-Google-Smtp-Source: APiQypKB7LASS+01OWOeAMKfpcryDEVrnVniyS4sXpm+hknR3Z6NeCrKJlFOrCukIZUHPsMc4G/saA== X-Received: by 2002:a5d:658e:: with SMTP id q14mr4938428wru.92.1586526943838; Fri, 10 Apr 2020 06:55:43 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 12/43] logging: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:39 +0200 Message-Id: <20200410135510.2148319-13-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtl68023011 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.84 on 10.5.11.22 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 --- src/logging/log_daemon.c | 26 ++++++-------------------- src/logging/log_daemon.h | 2 +- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index f37054706e..f4b94adf17 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -56,7 +56,7 @@ VIR_LOG_INIT("logging.log_daemon"); =20 struct _virLogDaemon { - virMutex lock; + GMutex lock; virNetDaemonPtr dmn; virLogHandlerPtr handler; }; @@ -86,7 +86,7 @@ virLogDaemonFree(virLogDaemonPtr logd) return; =20 virObjectUnref(logd->handler); - virMutexDestroy(&logd->lock); + g_mutex_clear(&logd->lock); virObjectUnref(logd->dmn); =20 VIR_FREE(logd); @@ -119,12 +119,7 @@ virLogDaemonNew(virLogDaemonConfigPtr config, bool pri= vileged) if (VIR_ALLOC(logd) < 0) return NULL; =20 - if (virMutexInit(&logd->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); - VIR_FREE(logd); - return NULL; - } + g_mutex_init(&logd->lock); =20 if (!(logd->dmn =3D virNetDaemonNew())) goto error; @@ -222,12 +217,7 @@ virLogDaemonNewPostExecRestart(virJSONValuePtr object,= bool privileged, if (VIR_ALLOC(logd) < 0) return NULL; =20 - if (virMutexInit(&logd->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); - VIR_FREE(logd); - return NULL; - } + g_mutex_init(&logd->lock); =20 if (!(child =3D virJSONValueObjectGet(object, "daemon"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -325,7 +315,7 @@ virLogDaemonClientFree(void *opaque) priv, (unsigned long long)priv->clientPid); =20 - virMutexDestroy(&priv->lock); + g_mutex_clear(&priv->lock); VIR_FREE(priv); } =20 @@ -343,11 +333,7 @@ virLogDaemonClientNew(virNetServerClientPtr client, if (VIR_ALLOC(priv) < 0) return NULL; =20 - if (virMutexInit(&priv->lock) < 0) { - VIR_FREE(priv); - virReportSystemError(errno, "%s", _("unable to init mutex")); - return NULL; - } + g_mutex_init(&priv->lock); =20 if (virNetServerClientGetUNIXIdentity(client, &clientuid, diff --git a/src/logging/log_daemon.h b/src/logging/log_daemon.h index fa661e1793..a66b2ff245 100644 --- a/src/logging/log_daemon.h +++ b/src/logging/log_daemon.h @@ -30,7 +30,7 @@ typedef struct _virLogDaemonClient virLogDaemonClient; typedef virLogDaemonClient *virLogDaemonClientPtr; =20 struct _virLogDaemonClient { - virMutex lock; + GMutex lock; =20 pid_t clientPid; }; --=20 2.25.2 From nobody Sun Feb 8 16:05:40 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=1586526990; cv=none; d=zohomail.com; s=zohoarc; b=n/JZTrPDs+WPVpgPQv6VY9KL9XbgoZOnXuKpyCDnlkt+sAF9M2MNUwSlWeOT1EEDjIhytA7U+N+Sve2YMWrHyPNCnzQAIr9XLkeHWQtB+p9EPpkSCOGQq0FqXYUPyz8QzK6AHXZIj8HbZIH4tPMNM6WuPlTNBfOu2LGhT7Eqh8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526990; 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=zDff4L9bgEiLO9IDFQFSFB/PemVTxYeOr5/jaXn2wGE=; b=HkZc3NjDUbgdczzbuhRXk84ob9Ec5uG/QKTv5j1o0EX1hsAhpWLY4udgLKt8l1czlEee7/4SXHZuFRtHnw/vfc3KvYZMLF8Ch6cKxlWzHlQZH3qztAdrOvxOknwzbRgDRD24NPpAjXtwdW+ZgofYcoU1vksZDRo1VCWpwARpgqQ= 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 1586526990102279.000057085103; Fri, 10 Apr 2020 06:56:30 -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-103-sfBAH4-PNdCOD5TMuCavGw-1; Fri, 10 Apr 2020 09:56:24 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 761951137844; Fri, 10 Apr 2020 13:56:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B6E29B92E; Fri, 10 Apr 2020 13:56:17 +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 F01661803C43; Fri, 10 Apr 2020 13:56:16 +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 03ADtq7L023052 for ; Fri, 10 Apr 2020 09:55:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2891A127512; Fri, 10 Apr 2020 13:55:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2448E12750F for ; Fri, 10 Apr 2020 13:55:52 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 06A84800297 for ; Fri, 10 Apr 2020 13:55:52 +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-4-SVOfSzvlOX2RDPSLXYWopQ-1; Fri, 10 Apr 2020 09:55:46 -0400 Received: by mail-wr1-f67.google.com with SMTP id h9so2370670wrc.8 for ; Fri, 10 Apr 2020 06:55:46 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526988; 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=zDff4L9bgEiLO9IDFQFSFB/PemVTxYeOr5/jaXn2wGE=; b=HSZHLw6ksj1WZiTLwWlGesFgXC8PLgHYOaOzlbu13iXi3UonHuQcHPUY4KBCbueL/TPNWd yaMk2RYHSWXAXupukmvPydQf8yJc/WeOA2M88Mlfn6dL9Tb4HnY0IeWEtx1KZp6+5KOyoI e/UBYYhfyI7wy6voz6+G5faTUlrpNRI= X-MC-Unique: sfBAH4-PNdCOD5TMuCavGw-1 X-MC-Unique: SVOfSzvlOX2RDPSLXYWopQ-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=KRnuvEIxRrl6p8jETHhmFKmM8GPD6clatYZAA+nQBPA=; b=WS9d5RjnmqmqLS7NRocW4VP+DyjHn+PQqu1MuRHN40AggAnvHL3QDsGyvjEaggqJWt C8RTKuKpMeUlQlIuqHLTgdYkTB4EbbOolcF5Vxz4NqmEk2eU0grY6aonXHxiCMsNc6J9 FdlSBP94NtQZXDYmicqlbcjguTZg4yyYtis2vqfQKGeseORGqjNygYQYhChuITr+gyVx r+19g3yiwPB3c1jGhBp0lQPWDaAHGh8D7m4zo0pXhLaV1d6SFkk0SIUBrdCNh/Q+W33q xZbCPHn4pdm9M7oJbvHAb7qqCGbUwbCpvRxCwM4ZQ8mVcMxFwWFqtFhLy+cpHaZfssvc 1LJg== X-Gm-Message-State: AGi0PuaE+d9aqAYKTlVEMUDri+W+sIDATXauzF4xq34KfxTVjmu9ptR8 I1gl0gHiTjW5XvooyXJc6HtD5W8QBPQ= X-Google-Smtp-Source: APiQypLI05RkHW9TlqJ+ZSbIbqOzAEWxyyuu9/5J1PQDIsgLJDCoxkjqzx/KEbI7ZCNfW55m7JMWWw== X-Received: by 2002:adf:ecc2:: with SMTP id s2mr5066493wro.73.1586526944995; Fri, 10 Apr 2020 06:55:44 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 13/43] conf: nwfilter_conf: convert virRWLock to GRWLock Date: Fri, 10 Apr 2020 15:54:40 +0200 Message-Id: <20200410135510.2148319-14-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 03ADtq7L023052 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.11 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 --- src/conf/nwfilter_conf.c | 21 +++++++++++---------- src/conf/nwfilter_conf.h | 5 ++++- src/libvirt_private.syms | 3 ++- src/lxc/lxc_driver.c | 4 ++-- src/nwfilter/nwfilter_driver.c | 6 +++--- src/nwfilter/nwfilter_gentech_driver.c | 2 +- src/qemu/qemu_driver.c | 12 ++++++------ src/qemu/qemu_migration.c | 2 +- src/qemu/qemu_process.c | 4 ++-- 9 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 680f4184c3..405cedd002 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -154,27 +154,33 @@ static const struct int_map chain_priorities[] =3D { /* * only one filter update allowed */ -static virRWLock updateLock; +static GRWLock updateLock; static bool initialized; =20 void virNWFilterReadLockFilterUpdates(void) { - virRWLockRead(&updateLock); + g_rw_lock_reader_lock(&updateLock); } =20 =20 void virNWFilterWriteLockFilterUpdates(void) { - virRWLockWrite(&updateLock); + g_rw_lock_writer_lock(&updateLock); } =20 =20 void -virNWFilterUnlockFilterUpdates(void) +virNWFilterReadUnlockFilterUpdates(void) { - virRWLockUnlock(&updateLock); + g_rw_lock_reader_unlock(&updateLock); +} + +void +virNWFilterWriteUnlockFilterUpdates(void) +{ + g_rw_lock_writer_unlock(&updateLock); } =20 =20 @@ -3090,9 +3096,6 @@ virNWFilterConfLayerInit(virNWFilterTriggerRebuildCal= lback cb, =20 initialized =3D true; =20 - if (virRWLockInit(&updateLock) < 0) - return -1; - return 0; } =20 @@ -3103,8 +3106,6 @@ virNWFilterConfLayerShutdown(void) if (!initialized) return; =20 - virRWLockDestroy(&updateLock); - initialized =3D false; rebuildCallback =3D NULL; rebuildOpaque =3D NULL; diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h index 13db58e380..875c3a1e0d 100644 --- a/src/conf/nwfilter_conf.h +++ b/src/conf/nwfilter_conf.h @@ -582,7 +582,10 @@ void virNWFilterReadLockFilterUpdates(void); =20 void -virNWFilterUnlockFilterUpdates(void); +virNWFilterWriteUnlockFilterUpdates(void); + +void +virNWFilterReadUnlockFilterUpdates(void); =20 typedef int (*virNWFilterTriggerRebuildCallback)(void *opaque); =20 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ec367653d5..c95c1a078c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -874,6 +874,7 @@ virNWFilterJumpTargetTypeToString; virNWFilterPrintStateMatchFlags; virNWFilterPrintTCPFlags; virNWFilterReadLockFilterUpdates; +virNWFilterReadUnlockFilterUpdates; virNWFilterRuleActionTypeToString; virNWFilterRuleDirectionTypeToString; virNWFilterRuleIsProtocolEthernet; @@ -882,8 +883,8 @@ virNWFilterRuleIsProtocolIPv6; virNWFilterRuleProtocolTypeToString; virNWFilterSaveConfig; virNWFilterTriggerRebuild; -virNWFilterUnlockFilterUpdates; virNWFilterWriteLockFilterUpdates; +virNWFilterWriteUnlockFilterUpdates; =20 =20 # conf/nwfilter_ipaddrmap.h diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 851894c459..7b232b4bac 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1030,7 +1030,7 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom, virDomainObjEndAPI(&vm); virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(cfg); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); return ret; } =20 @@ -1158,7 +1158,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn, virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(caps); virObjectUnref(cfg); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); return dom; } =20 diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 1c407727db..650ef19746 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -333,7 +333,7 @@ nwfilterStateReload(void) =20 virNWFilterObjListLoadAllConfigs(driver->nwfilters, driver->configDir); =20 - virNWFilterUnlockFilterUpdates(); + virNWFilterWriteUnlockFilterUpdates(); =20 virNWFilterBuildAll(driver, false); =20 @@ -602,7 +602,7 @@ nwfilterDefineXML(virConnectPtr conn, if (obj) virNWFilterObjUnlock(obj); =20 - virNWFilterUnlockFilterUpdates(); + virNWFilterWriteUnlockFilterUpdates(); nwfilterDriverUnlock(); return nwfilter; } @@ -643,7 +643,7 @@ nwfilterUndefine(virNWFilterPtr nwfilter) if (obj) virNWFilterObjUnlock(obj); =20 - virNWFilterUnlockFilterUpdates(); + virNWFilterWriteUnlockFilterUpdates(); nwfilterDriverUnlock(); return ret; } diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter= _gentech_driver.c index 6789a4a3fa..4b369e5b1a 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -807,7 +807,7 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverState= Ptr driver, } } =20 - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); virMutexUnlock(&updateMutex); =20 return rc; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 31f199fdef..d6ed6d3b3f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1796,7 +1796,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr= conn, virDomainObjEndAPI(&vm); virObjectEventStateQueue(driver->domainEventState, event); virObjectEventStateQueue(driver->domainEventState, event2); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); return dom; } =20 @@ -7053,7 +7053,7 @@ qemuDomainRestoreFlags(virConnectPtr conn, if (vm && ret < 0) qemuDomainRemoveInactiveJob(driver, vm); virDomainObjEndAPI(&vm); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); return ret; } =20 @@ -7590,7 +7590,7 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned = int flags) =20 cleanup: virDomainObjEndAPI(&vm); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); return ret; } =20 @@ -8802,7 +8802,7 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom, =20 cleanup: virDomainObjEndAPI(&vm); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); return ret; } =20 @@ -8920,7 +8920,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr d= om, virDomainDeviceDefFree(dev_copy); virDomainDeviceDefFree(dev); virDomainObjEndAPI(&vm); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); return ret; } =20 @@ -16695,7 +16695,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr sna= pshot, virObjectEventStateQueue(driver->domainEventState, event); virObjectEventStateQueue(driver->domainEventState, event2); virDomainObjEndAPI(&vm); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); virCPUDefFree(origCPU); virDomainDefFree(config); virDomainDefFree(inactiveConfig); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index bc280e856a..5057aa2528 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2716,7 +2716,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, virDomainObjEndAPI(&vm); virObjectEventStateQueue(driver->domainEventState, event); qemuMigrationCookieFree(mig); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); virErrorRestore(&origErr); return ret; =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8ea470f75f..803994afe8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8196,7 +8196,7 @@ qemuProcessReconnect(void *opaque) qemuDomainRemoveInactiveJob(driver, obj); } virDomainObjEndAPI(&obj); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); virIdentitySetCurrent(NULL); return; =20 @@ -8272,7 +8272,7 @@ qemuProcessReconnectHelper(virDomainObjPtr obj, qemuDomainRemoveInactiveJobLocked(src->driver, obj); =20 virDomainObjEndAPI(&obj); - virNWFilterUnlockFilterUpdates(); + virNWFilterReadUnlockFilterUpdates(); g_clear_object(&data->identity); VIR_FREE(data); return -1; --=20 2.25.2 From nobody Sun Feb 8 16:05:40 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=1586526981; cv=none; d=zohomail.com; s=zohoarc; b=M3IYpYUHoBaorPbLCkLXX92CJseEo8D+YHGdFRnD3mM/IPQNMR5jA8rEypVWzF6+cn5A+Ixp3VJ1sXvbDjYvpipepcB/G6tvZG22N0JsBveIraD6hpD75ncE+eF9mMYv4Tp/hiILNHPxscC/tfb3PwhjuR1gcUHsjt4JGE1Kt8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526981; 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=3H1orohtb717iPPOqHlMWU3Gn0jUE2AAph1DxjvaYUs=; b=dq9K5tmItjHpe3QnOs5+WKiaYvWB0cwIJBPkGqgW1OCKkzS/FR27FxYH4r+KVMLnO/HV19sONa0ZpU4umo0HlwiLdlz831YecShETZ+fpkFA+r2Bn7Yscfrub6R79M5hda/kwkpCss/qRjqLaMdjFH0a/EmRiINfHxpGs+k9ksc= 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 1586526981570429.15691130386836; Fri, 10 Apr 2020 06:56:21 -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-507-QYm0o6TpPUmXJtSnZ0WGpw-1; Fri, 10 Apr 2020 09:56:18 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B789C1050943; Fri, 10 Apr 2020 13:56:12 +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 87548272A5; Fri, 10 Apr 2020 13:56:12 +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 3A30593091; Fri, 10 Apr 2020 13:56:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtokq023034 for ; Fri, 10 Apr 2020 09:55:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 87C872166B35; Fri, 10 Apr 2020 13:55:50 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 837F12166B34 for ; Fri, 10 Apr 2020 13:55:50 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 69CA7800294 for ; Fri, 10 Apr 2020 13:55:50 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-32-6aV7z6zgPFCcDKW4CW64wg-1; Fri, 10 Apr 2020 09:55:47 -0400 Received: by mail-wm1-f66.google.com with SMTP id x4so2579871wmj.1 for ; Fri, 10 Apr 2020 06:55:47 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526980; 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=3H1orohtb717iPPOqHlMWU3Gn0jUE2AAph1DxjvaYUs=; b=jUR9LHOUEjaRGbUon4xNnxvp+weP1TPfeB9+tW7rCMkToxRLffQWknUwh4EWw2Sktavl5b i3cU7IgEvYp2wfcI03lhsIPvJddvYlxdQuaB197IwwqrldHSofKseVjNuYUVp9YtYYpdv9 WqSOFOiWlqNwPzHdqQvuC4GpVhxOMH8= X-MC-Unique: QYm0o6TpPUmXJtSnZ0WGpw-1 X-MC-Unique: 6aV7z6zgPFCcDKW4CW64wg-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=RpqVII2pgHAL2Bsa0tEK7Xp/9TsIfEgroLgFtHY13+I=; b=i25l3zrJLyAKZWe8O6YjqUDbow8mo2xUYjd/gNgZrHytvzcUS9dWdKJs0WycDx2rFM WifM/BjfZxhFCQynTvb9ZuumUeUcSTZX59fLH33yWh08Ub3b5btwMjRzb/L3Hsx0ddEW EBaY1CNYbO4SfWi0ZTlcAgRXlYbw6waT0EZTvjJkI3vb+lb/P7CDI7vGtfTaAA+Zbze8 WokdeucD9Z7cxycJuXRqmzp0pcSEoelE9UMONeJSJkjE85pjDsD8Qwx1NiEKSr2w1rgE U3hYJp6FnLX/Uu+82UBXpZzdUSbd5UFtTwkk3rg/ftDjsRcOLnXK33+FY7lPDnWUaNjo ub0Q== X-Gm-Message-State: AGi0Pubu4i4ztzvpG8F9yqzSWKomQIHy6/gHmnZvDPa1f4x/lgXH29Dd d3Mf/ICgxgPdwHWuZ338zQ7/TzU6t5s= X-Google-Smtp-Source: APiQypLDbZOWc51OSlD8RsynNe1wIXVQ3Vzu6lssuwO2F4oIR8ay5fKYLM2Aii7AVezdO5IZiLabsA== X-Received: by 2002:a1c:bad4:: with SMTP id k203mr5212703wmf.15.1586526946213; Fri, 10 Apr 2020 06:55:46 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 14/43] util: virlog: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:41 +0200 Message-Id: <20200410135510.2148319-15-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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtokq023034 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.84 on 10.5.11.23 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 --- src/util/virlog.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index e4944d1258..2c98a4cca8 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -125,19 +125,19 @@ static void virLogOutputToFd(virLogSourcePtr src, /* * Logs accesses must be serialized though a mutex */ -virMutex virLogMutex; +G_LOCK_DEFINE(virLogMutex); =20 void virLogLock(void) { - virMutexLock(&virLogMutex); + G_LOCK(virLogMutex); } =20 =20 void virLogUnlock(void) { - virMutexUnlock(&virLogMutex); + G_UNLOCK(virLogMutex); } =20 =20 @@ -247,9 +247,6 @@ virLogPriorityString(virLogPriority lvl) static int virLogOnceInit(void) { - if (virMutexInit(&virLogMutex) < 0) - return -1; - virLogLock(); virLogDefaultPriority =3D VIR_LOG_DEFAULT; =20 --=20 2.25.2 From nobody Sun Feb 8 16:05:40 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=1586526986; cv=none; d=zohomail.com; s=zohoarc; b=I598rSzIw0Cvd1kwOAbhq083SrKQIIsqatnLGB9BplGQ4mxz5w0BjFNFqCBgYMcAJRp9mDCUbu+UXr1ibbuXqlcWnupj0zsgi3jgIWzcGVzeJtFRVN0EiAeW3WOteLKJZxsb1k+M+RNKH6fxIG/cGCsYhOnjayEPrjwoJI8RVJQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526986; 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=QJNcsJBMQoRGlS93D9vk54xidfIUzSaLu/SVgA/VoWY=; b=cjYiFzJuYua6phpdwqe92oF+49flpOi0hiYcd5O6rgEKQ5WSdEO/YRzhjmY2D9sK7talAUJVn5+DyZtAXj9ah7h8HHLeOgvx1Q4eBlOQFXKFQ2hbgRF7exXW8RgsLH0e/1amZE0csOq48BJdn8fMiYTOfK0mV8KAyKnupltl7AA= 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 1586526986284585.9170447954949; Fri, 10 Apr 2020 06:56:26 -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-379-Jz_TGPkRPKaoHuuZdJCK9A-1; Fri, 10 Apr 2020 09:56:22 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 695B010509A1; Fri, 10 Apr 2020 13:56:16 +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 3CFA8101D484; Fri, 10 Apr 2020 13:56:16 +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 E0A8F93098; Fri, 10 Apr 2020 13:56:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtphN023045 for ; Fri, 10 Apr 2020 09:55:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id B9C092166B35; Fri, 10 Apr 2020 13:55:51 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B5D8C2166B34 for ; Fri, 10 Apr 2020 13:55:51 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 9C512101A55D for ; Fri, 10 Apr 2020 13:55:51 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-154-MbAReuxJNPCkwLKKyACSQA-1; Fri, 10 Apr 2020 09:55:49 -0400 Received: by mail-wr1-f66.google.com with SMTP id g3so2413658wrx.2 for ; Fri, 10 Apr 2020 06:55:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526985; 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=QJNcsJBMQoRGlS93D9vk54xidfIUzSaLu/SVgA/VoWY=; b=e9AelUWQ90DMeaeg2o9r24KXWnYpLnfvaLZKeP9oaU5HWWTO7j17YM2JyKbUOSR8kv4cv9 mkZNSbU55L5t8HWHFb8oyN95NsoBU2u34Luvy8ZEYukZpGCY9ZarLcPPI+5hNiVfZ0aHgG +ToOOlm0EhU53JMkZ//RQDoMNxo6Zu0= X-MC-Unique: Jz_TGPkRPKaoHuuZdJCK9A-1 X-MC-Unique: MbAReuxJNPCkwLKKyACSQA-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=kjBslTJx5UZZ5zAcW3qwdLQYFJke9jU9IQBVkAEsmH8=; b=QgchjQSdKONHLCtrSfQBwByKXSkjvhdWwfBnQMpVZDKn1YMe65MCumZgl6EBoqsKt4 RxqPeTDoAf0NGSL7FY6HxAtip+Sal327W9+3ffWqrD4/bt6i5MsNfEfz+DA1NUz+ZEyj ySIqpnRmzsHRYBizetP2v5cV37tXzEu4YOCmJOWt7EzWCKvDzHgvNcWwyezkPi2Xo/x8 QebgV/VO2Dk/5IEMiy5xA68apbW2PT1bu8gwOlxmeS65xo2s8DvHMkgsHFRpcG4J/iN7 bxZGanepv+aoYV1W77dfARYLcN5PpzJwKxfz4TyWujxJThASa+wackQx+JilzEukfLUn 6RIg== X-Gm-Message-State: AGi0PuYHWpQKF+2IVFpJuCnfjljkO+p8bFAXnxbNmkUAk8q41a3zy7It ctCMKJbtR0Z7waW7BAntXWak32MUOJk= X-Google-Smtp-Source: APiQypJ2YdFutSs6lkbrwd7q3sIu2v8pxlNgd6Agk+IlyY6HGsZgaGNIDyav0WiFbgBHmxy53JzwIw== X-Received: by 2002:adf:ed86:: with SMTP id c6mr4537857wro.286.1586526947390; Fri, 10 Apr 2020 06:55:47 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 15/43] test: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:42 +0200 Message-Id: <20200410135510.2148319-16-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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtphN023045 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.84 on 10.5.11.22 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 --- src/test/test_driver.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 7759847c2d..1c23d569d5 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -125,7 +125,7 @@ typedef struct _testDriver testDriver; typedef testDriver *testDriverPtr; =20 static testDriverPtr defaultPrivconn; -static virMutex defaultLock =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE_STATIC(defaultLock); =20 static virClassPtr testDriverClass; static void testDriverDispose(void *obj); @@ -1334,10 +1334,10 @@ testOpenDefault(virConnectPtr conn) xmlXPathContextPtr ctxt =3D NULL; size_t i; =20 - virMutexLock(&defaultLock); + G_LOCK(defaultLock); if (defaultPrivconn) { conn->privateData =3D virObjectRef(defaultPrivconn); - virMutexUnlock(&defaultLock); + G_UNLOCK(defaultLock); return VIR_DRV_OPEN_SUCCESS; } =20 @@ -1379,7 +1379,7 @@ testOpenDefault(virConnectPtr conn) defaultPrivconn =3D privconn; ret =3D VIR_DRV_OPEN_SUCCESS; cleanup: - virMutexUnlock(&defaultLock); + G_UNLOCK(defaultLock); xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); return ret; @@ -1445,11 +1445,11 @@ testConnectAuthenticate(virConnectPtr conn, static void testDriverCloseInternal(testDriverPtr driver) { - virMutexLock(&defaultLock); + G_LOCK(defaultLock); bool disposed =3D !virObjectUnref(driver); if (disposed && driver =3D=3D defaultPrivconn) defaultPrivconn =3D NULL; - virMutexUnlock(&defaultLock); + G_UNLOCK(defaultLock); } =20 =20 --=20 2.25.2 From nobody Sun Feb 8 16:05:40 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=1586526990; cv=none; d=zohomail.com; s=zohoarc; b=eEqXdBGUnT+qQ6sPM5+MvtwbgYwyIDMX3qqxuvuFhfgkNJF9cYl89rD7fQodILIQcgZv6yFXzJw6+Q3FHhqD09c35ZUvEVt/yJnHqvNyyw8iVqRhdopJQ+D29iBEYAnoWNoOvty41nf2v7FQhFMNgSiJiHOuENz8Hkq3f3i5HP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526990; 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=yW69Nm3Xh76yt4ew7IyU4peSXyIirpi5m/sOh4ThWGg=; b=G+N38cbqaaxXekx8Bpv66XIhPOSEFPmA3+5H5ffRiGfV6bHOvrOUrzzNhmqJdYPHgSLuNp1UWCqjDXxEgDc+KyvPSy5vbfEMM8ZA3j1KD57X4EdRlS6vbySlaqQ126rKe/5XxT7ePhcFNreztITOuWsaFMvui1u191U3fQxfgdM= 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 1586526990864820.3146501509093; Fri, 10 Apr 2020 06:56:30 -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-367-GCtS5CNpPautvAnyMswr7Q-1; Fri, 10 Apr 2020 09:56:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 11C0510509B9; Fri, 10 Apr 2020 13:56:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8E00B19D8; Fri, 10 Apr 2020 13:56:20 +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 7455518034E9; Fri, 10 Apr 2020 13:56:20 +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 03ADtuZe023075 for ; Fri, 10 Apr 2020 09:55:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5E21712750F; Fri, 10 Apr 2020 13:55:56 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 59E84127510 for ; Fri, 10 Apr 2020 13:55:54 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 058C6101A55A for ; Fri, 10 Apr 2020 13:55:54 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-230-tdT_X72wM6y3C6C8SCrJew-1; Fri, 10 Apr 2020 09:55:51 -0400 Received: by mail-wm1-f67.google.com with SMTP id h2so2561388wmb.4 for ; Fri, 10 Apr 2020 06:55:51 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526989; 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=yW69Nm3Xh76yt4ew7IyU4peSXyIirpi5m/sOh4ThWGg=; b=H0cN8AXlN2A/Z0i8oQ8LEJ4oQBQ0er5piu3ce7SHolxd0WTUlHrfcX3G3OtqiPTMpvAA5L xYAUHj7vQY/n9Oo80bdHqKHVE57ttJN0K2ngLgM+08jG5X9i97QeD3FSh6AYnOTelZ/Yoq SFz13yRra6zU4XddVG0SI3guf6oqvgw= X-MC-Unique: GCtS5CNpPautvAnyMswr7Q-1 X-MC-Unique: tdT_X72wM6y3C6C8SCrJew-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=mJeBMwICVMvopD2YrFMZQjleU0VuIdjcFysnz4vlMIk=; b=siOO05ihgPV0kvGoOZEgEO0TdNztRGSkotY7YCQ4LmAhBc5PxTwbBhZLZBPpmdEcDh 71NMbv12kQUMW3mewWt/zMWlS0Loz9ATXybuPPh7kUf8utnurOgmHnkSNxHlaI5C/zBt BXulbRgG0exztyV9gcDuAWNGtdatK7wFdwfZSeHOfL2aGGRyZZWY0ooFnaQiXiVDYzV0 jAWEdqpT+4K9xYeeBWPxDiSP7jSy17oDibZcxS5mJAz36UTDefpwAnVSemlYVj7E9Ye4 a4cfkR212cF7ObPMZH474WXgIEBxj4zZ4GZ9Iv+cZP2vQL7EgewqZm1L3vkNCYtK9BNk IujQ== X-Gm-Message-State: AGi0PuaTcl7LfSAfyZXANiFpDYT7H7sXM/W4Z6nebBl3KuvuulQM8ItY YU9/qJ4KSjt2Y0Ls3a8LfcZVGfdcxR8= X-Google-Smtp-Source: APiQypJvWK7FI4xY0dUPR3Oiwt656zzYo2aKE69DEZFezCdt7Rok0swpB7Q9j4+fzjZg61xh/b2A8A== X-Received: by 2002:a7b:ce0b:: with SMTP id m11mr5380942wmc.67.1586526948784; Fri, 10 Apr 2020 06:55:48 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 16/43] nwfilter: nwfilter_dhcpsnoop: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:43 +0200 Message-Id: <20200410135510.2148319-17-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 03ADtuZe023075 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.15 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 --- src/conf/virnwfilterobj.c | 15 ++++------ src/nwfilter/nwfilter_dhcpsnoop.c | 48 +++++++++++++------------------ 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c index c9e224061d..e4b90dcdb7 100644 --- a/src/conf/virnwfilterobj.c +++ b/src/conf/virnwfilterobj.c @@ -34,7 +34,7 @@ VIR_LOG_INIT("conf.virnwfilterobj"); =20 struct _virNWFilterObj { - virMutex lock; + GRecMutex lock; =20 bool wantRemoved; =20 @@ -56,12 +56,7 @@ virNWFilterObjNew(void) if (VIR_ALLOC(obj) < 0) return NULL; =20 - if (virMutexInitRecursive(&obj->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); - VIR_FREE(obj); - return NULL; - } + g_rec_mutex_init(&obj->lock); =20 virNWFilterObjLock(obj); return obj; @@ -98,7 +93,7 @@ virNWFilterObjFree(virNWFilterObjPtr obj) virNWFilterDefFree(obj->def); virNWFilterDefFree(obj->newDef); =20 - virMutexDestroy(&obj->lock); + g_rec_mutex_clear(&obj->lock); =20 VIR_FREE(obj); } @@ -554,12 +549,12 @@ virNWFilterObjListLoadAllConfigs(virNWFilterObjListPt= r nwfilters, void virNWFilterObjLock(virNWFilterObjPtr obj) { - virMutexLock(&obj->lock); + g_rec_mutex_lock(&obj->lock); } =20 =20 void virNWFilterObjUnlock(virNWFilterObjPtr obj) { - virMutexUnlock(&obj->lock); + g_rec_mutex_unlock(&obj->lock); } diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcp= snoop.c index 953d8936a4..191d85b2a4 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -80,26 +80,26 @@ struct virNWFilterSnoopState { /* thread management */ virHashTablePtr snoopReqs; virHashTablePtr ifnameToKey; - virMutex snoopLock; /* protects SnoopReqs and IfNameToKey= */ + GRecMutex snoopLock; /* protects SnoopReqs and IfNameToKey= */ virHashTablePtr active; - virMutex activeLock; /* protects Active */ + GMutex activeLock; /* protects Active */ }; =20 # define virNWFilterSnoopLock() \ do { \ - virMutexLock(&virNWFilterSnoopState.snoopLock); \ + g_rec_mutex_lock(&virNWFilterSnoopState.snoopLock); \ } while (0) # define virNWFilterSnoopUnlock() \ do { \ - virMutexUnlock(&virNWFilterSnoopState.snoopLock); \ + g_rec_mutex_unlock(&virNWFilterSnoopState.snoopLock); \ } while (0) # define virNWFilterSnoopActiveLock() \ do { \ - virMutexLock(&virNWFilterSnoopState.activeLock); \ + g_mutex_lock(&virNWFilterSnoopState.activeLock); \ } while (0) # define virNWFilterSnoopActiveUnlock() \ do { \ - virMutexUnlock(&virNWFilterSnoopState.activeLock); \ + g_mutex_unlock(&virNWFilterSnoopState.activeLock); \ } while (0) =20 # define VIR_IFKEY_LEN ((VIR_UUID_STRING_BUFLEN) + (VIR_MAC_STRING_BUFLE= N)) @@ -136,7 +136,7 @@ struct _virNWFilterSnoopReq { virErrorPtr threadError; =20 virNWFilterSnoopThreadStatus threadStatus; - virCond threadStatusCond; + GCond threadStatusCond; =20 int jobCompletionStatus; /* the number of submitted jobs in the worker's queue */ @@ -152,7 +152,7 @@ struct _virNWFilterSnoopReq { * - threadStatus * (for refctr, see above) */ - virMutex lock; + GRecMutex lock; }; =20 /* @@ -567,20 +567,17 @@ virNWFilterSnoopReqNew(const char *ifkey) =20 req->threadStatus =3D THREAD_STATUS_NONE; =20 - if (virStrcpyStatic(req->ifkey, ifkey) < 0|| - virMutexInitRecursive(&req->lock) < 0) + if (virStrcpyStatic(req->ifkey, ifkey) < 0) goto err_free_req; =20 - if (virCondInit(&req->threadStatusCond) < 0) - goto err_destroy_mutex; + g_rec_mutex_init(&req->lock); + + g_cond_init(&req->threadStatusCond); =20 virNWFilterSnoopReqGet(req); =20 return req; =20 - err_destroy_mutex: - virMutexDestroy(&req->lock); - err_free_req: VIR_FREE(req); =20 @@ -610,8 +607,8 @@ virNWFilterSnoopReqFree(virNWFilterSnoopReqPtr req) /* free all req data */ virNWFilterBindingDefFree(req->binding); =20 - virMutexDestroy(&req->lock); - virCondDestroy(&req->threadStatusCond); + g_rec_mutex_clear(&req->lock); + g_cond_clear(&req->threadStatusCond); virFreeError(req->threadError); =20 VIR_FREE(req); @@ -623,7 +620,7 @@ virNWFilterSnoopReqFree(virNWFilterSnoopReqPtr req) static void virNWFilterSnoopReqLock(virNWFilterSnoopReqPtr req) { - virMutexLock(&req->lock); + g_rec_mutex_lock(&req->lock); } =20 /* @@ -632,7 +629,7 @@ virNWFilterSnoopReqLock(virNWFilterSnoopReqPtr req) static void virNWFilterSnoopReqUnlock(virNWFilterSnoopReqPtr req) { - virMutexUnlock(&req->lock); + g_rec_mutex_unlock(&req->lock); } =20 /* @@ -1381,7 +1378,7 @@ virNWFilterDHCPSnoopThread(void *req0) req->threadStatus =3D THREAD_STATUS_OK; } =20 - virCondSignal(&req->threadStatusCond); + g_cond_signal(&req->threadStatusCond); =20 virNWFilterSnoopReqUnlock(req); =20 @@ -1667,11 +1664,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr tec= hdriver, } =20 /* sync with thread */ - if (virCondWait(&req->threadStatusCond, &req->lock) < 0) { - virReportSystemError(errno, "%s", - _("unable to wait on dhcp snoop thread")); - goto exit_snoop_cancel; - } + g_cond_wait(&req->threadStatusCond, (GMutex *)&req->lock); =20 if (req->threadStatus !=3D THREAD_STATUS_OK) { virErrorRestore(&req->threadError); @@ -2039,9 +2032,8 @@ virNWFilterDHCPSnoopInit(void) =20 VIR_DEBUG("Initializing DHCP snooping"); =20 - if (virMutexInitRecursive(&virNWFilterSnoopState.snoopLock) < 0 || - virMutexInit(&virNWFilterSnoopState.activeLock) < 0) - return -1; + g_rec_mutex_init(&virNWFilterSnoopState.snoopLock); + g_mutex_init(&virNWFilterSnoopState.activeLock); =20 virNWFilterSnoopState.ifnameToKey =3D virHashCreate(0, NULL); virNWFilterSnoopState.active =3D virHashCreate(0, NULL); --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586526991; cv=none; d=zohomail.com; s=zohoarc; b=Oq8UqsM1KnVX5p63iU+lkfgBMynZ3qzZKUq/WveKuhBIGlyKTiuW4AfTBW/AXjgafx4w3g+ef3CfGQiWKpKQdGdsW8eLDKRfyzr4ygzfTrzNpz6dSVxYHTPAxBprGQ1fKLyz+BetscY5Abnxr/ZEcgg+K7/f8+v9a9x6bUR8B9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526991; 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=Lm/fsL20zepyvWyq3dzIuiowBGEW55+4Rm52Y2g81EI=; b=YFeLiCj3M71cFo5A/oJX7Odc9twbODSSN4K3i20Kr8/nN0d92SZHz3n10a+2h/r5V1ScVbBYKl9aQB4H21WktjyaSyli8TTOkEge+75lw2yQXo2S6QyaQL0pDkKAxFsXmxQ7cCSvCZWhJzRjJpdNeCq+bFEDJbycuZW1brU80Ck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 15865269919361004.7852767210849; Fri, 10 Apr 2020 06:56:31 -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-336-fygKr3DFMUi48xmTlCpcsQ-1; Fri, 10 Apr 2020 09:56:27 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1B0A28018B4; Fri, 10 Apr 2020 13:56:21 +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 E3B90272A5; Fri, 10 Apr 2020 13:56:20 +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 9228D93091; Fri, 10 Apr 2020 13:56:20 +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 03ADtwd1023093 for ; Fri, 10 Apr 2020 09:55:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id D0796127512; Fri, 10 Apr 2020 13:55:58 +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 CCD4F12750F for ; Fri, 10 Apr 2020 13:55:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 AD2A08FF67D for ; Fri, 10 Apr 2020 13:55:58 +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-71-FZhjcaaQMhSIb2OJeL2CoA-1; Fri, 10 Apr 2020 09:55:51 -0400 Received: by mail-wr1-f67.google.com with SMTP id p10so2382170wrt.6 for ; Fri, 10 Apr 2020 06:55:51 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526990; 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=Lm/fsL20zepyvWyq3dzIuiowBGEW55+4Rm52Y2g81EI=; b=eN4+hwoH4N3Nj0zDCvrPetWlIHOfv3vC11RZQuL/k5KSs2QugEy3XUuh1QUFiADzdkvVPG Pwdv6fZpJT52UMNoQCL4r8pRmLgdRdJbbz0CbUnXNCAfEoiRfWBWHFcNj8Mn3Cxe1vzEuk 0R1ImQTxrRjuEMbEE+i8vfWw3U6xdbQ= X-MC-Unique: fygKr3DFMUi48xmTlCpcsQ-1 X-MC-Unique: FZhjcaaQMhSIb2OJeL2CoA-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=6z+Ua2XzysMGFmvpL1wEJ44ndDGR7OLAfopTfBb85Pg=; b=phSCgscuRUQIfKHJRQSJveXLKQk3WuUL+v2l0EYimd0P/G8Z9bP5zQLsxieKkh+aar zkZ+Ng+qLmkmcf8ruJAJgDrhFVY8phGiMfKXWjGW2N8Su1ZIf/jb/WDY1+UQuaIdCsrh R7K+peakK01y1bYhA5b2Oi4xnJYLcGoJixcojHOHnePkTbwQ/GOqCc5M6Hu+2lKPSd5V wOGkggMDkoHrU+w3G+T3Qk8EFkwppde7hh0j4PQ3Xruk+33KGDrMmyoSiwsBYY0lBby+ uzz3ASsaNR/XTgU9w+T/1IdaQNObkbzV0aaSSFcIXVekBwIPHG2h76dRxZXYIEl0q0MH fCjA== X-Gm-Message-State: AGi0PuY/BuFQAJwTJeQFLcX4IVWIu4YYPv/tLOPgvvrKVOcEoTtz11Ev FkvW2IY0bm50XF5lHa71Dv68aycIprY= X-Google-Smtp-Source: APiQypIppB3746FOJPOxe9ZHQABE8eVsB3ZCJvZUx2sUWMm+eakI+YfkKPGGGdOFa+VpdmRrqC5OqA== X-Received: by 2002:a5d:6850:: with SMTP id o16mr4574851wrw.309.1586526950257; Fri, 10 Apr 2020 06:55:50 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 17/43] nwfilter: nwfilter_gentech_driver: convert virMutex to GRecMutex Date: Fri, 10 Apr 2020 15:54:44 +0200 Message-Id: <20200410135510.2148319-18-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 03ADtwd1023093 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.84 on 10.5.11.23 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 --- src/nwfilter/nwfilter_gentech_driver.c | 38 ++++++++------------------ 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter= _gentech_driver.c index 4b369e5b1a..fd98d7f07e 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -69,14 +69,12 @@ static virNWFilterTechDriverPtr filter_tech_drivers[] = =3D { * hash table as is done for virDomainObjList. You can then get * lockless lookup of objects by name. */ -static virMutex updateMutex; +static GRecMutex updateMutex; =20 int virNWFilterTechDriversInit(bool privileged) { size_t i =3D 0; VIR_DEBUG("Initializing NWFilter technology drivers"); - if (virMutexInitRecursive(&updateMutex) < 0) - return -1; =20 while (filter_tech_drivers[i]) { if (!(filter_tech_drivers[i]->flags & TECHDRV_FLAG_INITIALIZED)) @@ -95,7 +93,6 @@ void virNWFilterTechDriversShutdown(void) filter_tech_drivers[i]->shutdown(); i++; } - virMutexDestroy(&updateMutex); } =20 =20 @@ -753,9 +750,7 @@ virNWFilterInstantiateFilterInternal(virNWFilterDriverS= tatePtr driver, bool *foundNewFilter) { int ifindex; - int rc; - - virMutexLock(&updateMutex); + g_autoptr(GRecMutexLocker) locker =3D g_rec_mutex_locker_new(&updateMu= tex); =20 /* after grabbing the filter update lock check for the interface; if it's not there anymore its filters will be or are being removed @@ -765,20 +760,14 @@ virNWFilterInstantiateFilterInternal(virNWFilterDrive= rStatePtr driver, /* interfaces / VMs can disappear during filter instantiation; don't mark it as an error */ virResetLastError(); - rc =3D 0; - goto cleanup; + return 0; } =20 - rc =3D virNWFilterInstantiateFilterUpdate(driver, teardownOld, - binding, - ifindex, - useNewFilter, - false, foundNewFilter); - - cleanup: - virMutexUnlock(&updateMutex); - - return rc; + return virNWFilterInstantiateFilterUpdate(driver, teardownOld, + binding, + ifindex, + useNewFilter, + false, foundNewFilter); } =20 =20 @@ -789,9 +778,10 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverStat= ePtr driver, { int rc; bool foundNewFilter =3D false; + g_autoptr(GRecMutexLocker) locker =3D NULL; =20 virNWFilterReadLockFilterUpdates(); - virMutexLock(&updateMutex); + locker =3D g_rec_mutex_locker_new(&updateMutex); =20 rc =3D virNWFilterInstantiateFilterUpdate(driver, true, binding, ifindex, @@ -808,7 +798,6 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverState= Ptr driver, } =20 virNWFilterReadUnlockFilterUpdates(); - virMutexUnlock(&updateMutex); =20 return rc; } @@ -930,11 +919,8 @@ _virNWFilterTeardownFilter(const char *ifname) int virNWFilterTeardownFilter(virNWFilterBindingDefPtr binding) { - int ret; - virMutexLock(&updateMutex); - ret =3D _virNWFilterTeardownFilter(binding->portdevname); - virMutexUnlock(&updateMutex); - return ret; + g_autoptr(GRecMutexLocker) locker =3D g_rec_mutex_locker_new(&updateMu= tex); + return _virNWFilterTeardownFilter(binding->portdevname); } =20 enum { --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586526988; cv=none; d=zohomail.com; s=zohoarc; b=kZoj9lMDcd9l2GSL/asQrBhpYaYhGqLrpYvK5tyWJ+WlLLILXa0H2vSIwlPCFgHznqQ5HKsbHyXy42GwJV/01VKkAF2oFm3aJB5pz/epUXm0GjONGJ8G6a25LSMUPDTqXAHx698+zMvZ1Lm+QjtoQ4Ywqu3HzYrnp+J02iseCrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526988; 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=y+Bq7VRGO2zQUg9ZcznZ/btDgUeuMiBc0ih1N1PgnCI=; b=DTXQOHonwOrVYTECni/SDtkDU/b6sSosw07v4EhLIAiktK/Uovlxeqgivfgc484/ugBQkOCkghCnE9JSFK1E2YOIeemfks9zfwKjogJUsiFOK9ukGdCQSGXBHW2HIFJdRc7JgWwW4BGXgNmVmY9jcYWFHRRWsZGrWPApavRMzxQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586526988543555.6230902894499; Fri, 10 Apr 2020 06:56:28 -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-159-XPS74TwoNd-17Re_lEWTHA-1; Fri, 10 Apr 2020 09:56:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1BB22DB2C; Fri, 10 Apr 2020 13:56:17 +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 E39C0272A5; Fri, 10 Apr 2020 13:56:16 +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 94CE893097; Fri, 10 Apr 2020 13:56:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADtv4L023087 for ; Fri, 10 Apr 2020 09:55:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 856E910EE828; Fri, 10 Apr 2020 13:55:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8160610EE826 for ; Fri, 10 Apr 2020 13:55:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 9B90F185A78F for ; Fri, 10 Apr 2020 13:55:55 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-QzPo8GT8PJOJe7PZJ_qMnQ-1; Fri, 10 Apr 2020 09:55:53 -0400 Received: by mail-wm1-f65.google.com with SMTP id x4so2580061wmj.1 for ; Fri, 10 Apr 2020 06:55:52 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526986; 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=y+Bq7VRGO2zQUg9ZcznZ/btDgUeuMiBc0ih1N1PgnCI=; b=MriUya+4hZlWtkemqHn4nikMbw7LlGvHqKvqntHBAzd9E9fjIN/BZjZ0TKaDB6/SKPM05/ e+vpCLMQbxXhXbvLgv5JOWPnn+K22Usk3MRe7ilmBqzJ5S9++JT2mtR3SDJRAo/l20pjcN bzKt76bEtRVP5aqf/3lS+X86RtJfNiU= X-MC-Unique: XPS74TwoNd-17Re_lEWTHA-1 X-MC-Unique: QzPo8GT8PJOJe7PZJ_qMnQ-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=invnmFSvmDkqzTN60j/EZ3EoAsC5AYlGJbGS99ysjYs=; b=lMTnDQi9Zg7z14tP2SkN1jdpoIufubZ2Ns+8/Y+SNo0pH/U1hEnJ8rmvZDpBDtNIoD 3UTl8z1jkimBws2yBWUYZzi7XJ4gcgd0nOewfhqMo5MUA9T7iHNmkVUuB7iTKy/JkX55 H2cBv3nWBo9kvmSkhJg6LZDGeX7X6tHPgY323WMOStTYl8t1srRIN7503vLYmyuO4Dob +AB5MV1VYIaqnUUqYBFa+7czLVnXMiykBgC4KP+5eTWMlR38LHVkpGVaA47/+VddL6yo TuVstdLysT7jdsJFhMHUG9Ra5YC7ykhDIy81TQ+XK/QSXFyW7i0b6zQRs75rBoP80O1k UoXA== X-Gm-Message-State: AGi0PuaZEE45Yu0Rb8wjBQ4MOsECqJ47DmJx3M1lUICudfO5k7aTt6if qWF50hRE9WO4xAp+PsgZI2cUgZ33910= X-Google-Smtp-Source: APiQypIOqYKkL3x7O/N2ziriN9v1TFWv+zBuR1CMa2k52+gmd4WDZvxV7Xq1MFtuKbBDeVeHPuGmeg== X-Received: by 2002:a7b:c642:: with SMTP id q2mr5451960wmk.41.1586526951572; Fri, 10 Apr 2020 06:55:51 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 18/43] lxc: lxc_fuse: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:45 +0200 Message-Id: <20200410135510.2148319-19-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADtv4L023087 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.84 on 10.5.11.23 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 --- src/lxc/lxc_fuse.c | 13 +++++-------- src/lxc/lxc_fuse.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index e73b4d0690..e35086c859 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -262,11 +262,10 @@ static struct fuse_operations lxcProcOper =3D { =20 static void lxcFuseDestroy(virLXCFusePtr fuse) { - virMutexLock(&fuse->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&fuse->lock); fuse_unmount(fuse->mountpoint, fuse->ch); fuse_destroy(fuse->fuse); fuse->fuse =3D NULL; - virMutexUnlock(&fuse->lock); } =20 static void lxcFuseRun(void *opaque) @@ -291,8 +290,7 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def) =20 fuse->def =3D def; =20 - if (virMutexInit(&fuse->lock) < 0) - goto cleanup2; + g_mutex_init(&fuse->lock); =20 fuse->mountpoint =3D g_strdup_printf("%s/%s.fuse/", LXC_STATE_DIR, def= ->name); =20 @@ -327,8 +325,7 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def) return ret; cleanup1: VIR_FREE(fuse->mountpoint); - virMutexDestroy(&fuse->lock); - cleanup2: + g_mutex_clear(&fuse->lock); VIR_FREE(fuse); goto cleanup; } @@ -351,10 +348,10 @@ void lxcFreeFuse(virLXCFusePtr *f) if (fuse) { /* exit fuse_loop, lxcFuseRun thread may try to destroy * fuse->fuse at the same time,so add a lock here. */ - virMutexLock(&fuse->lock); + g_mutex_lock(&fuse->lock); if (fuse->fuse) fuse_exit(fuse->fuse); - virMutexUnlock(&fuse->lock); + g_mutex_unlock(&fuse->lock); =20 VIR_FREE(fuse->mountpoint); VIR_FREE(*f); diff --git a/src/lxc/lxc_fuse.h b/src/lxc/lxc_fuse.h index e9cfd9a20a..47ca7197fc 100644 --- a/src/lxc/lxc_fuse.h +++ b/src/lxc/lxc_fuse.h @@ -48,7 +48,7 @@ struct virLXCFuse { char *mountpoint; struct fuse *fuse; struct fuse_chan *ch; - virMutex lock; + GMutex lock; }; typedef struct virLXCFuse *virLXCFusePtr; =20 --=20 2.25.2 From nobody Sun Feb 8 16:05:40 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=1586526995; cv=none; d=zohomail.com; s=zohoarc; b=NFTLvR/uNsx+tmSLtafTcFVVr0MiPEF450Nt/nsTmOztatwTFMDE5pK44K6u93G1y2C5aSv47o2UCCMJ4pZ2uJVNTj2Vqrz+d552N/PdWc0rZm9H9gBTXG8RokmGZ7gZUAF9oodXWvCwfkDhUHxWJUuwod6CfYUlaqaE1tZsGok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526995; 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=7CjHuyBOllDQjQAcn3i/7vpMZukXH7ZZtAfdqpYWEog=; b=ArUX0FVtKQn0HLtUptr2PTni7zkWKwZXH7Gnx4+O5lcrQNDj4dcPnxnc38ETbtHy4ll0IiZIOWtAMQkYk5hk+LLoGhvtTdOaHcd8SO2+CIcIAiZP3iiFPk4GnnmVoKZHs2kJDFwC6xFMMVYb4C5QrE2967Ic2u5ZE9ay/Hr/VZ8= 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 1586526995286407.61451350815537; Fri, 10 Apr 2020 06:56:35 -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-329-HwuvuSc4M1SBXAPrE1DRAA-1; Fri, 10 Apr 2020 09:56:30 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A5049DB2E; Fri, 10 Apr 2020 13:56:24 +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 77B215C557; Fri, 10 Apr 2020 13:56:24 +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 2A55493A90; Fri, 10 Apr 2020 13:56:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADu2YO023141 for ; Fri, 10 Apr 2020 09:56:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id F10912166B36; Fri, 10 Apr 2020 13:56:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ECE582166B34 for ; Fri, 10 Apr 2020 13:55:56 +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 9DC338007A4 for ; Fri, 10 Apr 2020 13:55:56 +0000 (UTC) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-ss3bfyEGNW2JFXqGg9z_Dg-1; Fri, 10 Apr 2020 09:55:54 -0400 Received: by mail-wm1-f68.google.com with SMTP id x25so2592096wmc.0 for ; Fri, 10 Apr 2020 06:55:53 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526993; 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=7CjHuyBOllDQjQAcn3i/7vpMZukXH7ZZtAfdqpYWEog=; b=fRfaNv9AIHCWRfaOtDubaqpZ3w3eM/C+03urFwHJnH6WSbzBxZXK3H0nbErf+uiHA/DZoS xpQtRc29W9GUax/9040Nn+NvdafCcd/+QTexVLAXqHifvw2xO/Q6m+0NWznfjFKwLj425j qSKWKrQRjktAIrtHlixl+CTq8dTBb50= X-MC-Unique: HwuvuSc4M1SBXAPrE1DRAA-1 X-MC-Unique: ss3bfyEGNW2JFXqGg9z_Dg-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=FA82rId+cf2ARlZu9zgOLc+DKaEssS14av5jv6Lc4gs=; b=jA29i7bJUePkNHxIr6V9DTqpLSTYJ1T8z0LJ1Up2io0x6vHxPe9NTJ4u9r+y7ZYZT8 D5uqI7RYq9dI0odeVxIlBARUo3V4EH7KlWD7GDfyCDOXqEDoIk0AhC0nuK2Y2XjGtT6M 9cFuH+wKZIekRd1e3DA9mFSPRLo1LicvSTosmB8iRlLx26l9H9NlahZrM8gYNQOS+6aY 4/sLjFpNbQ/0AetKo3x1Qy/aGxSpTfc1tgSP/3hCtbVg7Oxo6y5NJCGJMEiBbAkVzB9m bj/gu5iMUzDzkwVLJFytScPqd1n8H4XfCl3DT+luUqNu2QNNFAtJyPPX/G42FOxhrn33 IFHQ== X-Gm-Message-State: AGi0PuZ4fE+rXg1nKA32D19ejImdb35ju/G9sNzCAkGhb6dp81k5tPfL 6CLVhic8SeYnhZTEYugT6RGSLdNSyVY= X-Google-Smtp-Source: APiQypJsHNeYQgIIaUo4IJ6zWvfXzKfll6O3eYhf+WQwdtt2INO/fHs9mUDW7ZC+yTzmIPp3eI7JQg== X-Received: by 2002:a7b:c010:: with SMTP id c16mr5596052wmb.73.1586526952668; Fri, 10 Apr 2020 06:55:52 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 19/43] lxc: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:46 +0200 Message-Id: <20200410135510.2148319-20-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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADu2YO023141 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.16 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 --- src/lxc/lxc_conf.h | 6 +++--- src/lxc/lxc_controller.c | 25 ++++++++++--------------- src/lxc/lxc_driver.c | 7 ++----- tests/testutilslxc.c | 9 ++------- 4 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h index f2f0e0a570..27cb861c08 100644 --- a/src/lxc/lxc_conf.h +++ b/src/lxc/lxc_conf.h @@ -64,7 +64,7 @@ struct _virLXCDriverConfig { }; =20 struct _virLXCDriver { - virMutex lock; + GMutex lock; =20 /* Require lock to get reference on 'config', * then lockless thereafter */ @@ -116,9 +116,9 @@ virDomainXMLOptionPtr lxcDomainXMLConfInit(virLXCDriver= Ptr driver); =20 static inline void lxcDriverLock(virLXCDriverPtr driver) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } static inline void lxcDriverUnlock(virLXCDriverPtr driver) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 453b435dd6..f7394c53a6 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -161,12 +161,7 @@ virLXCControllerDriverNew(void) { virLXCDriverPtr driver =3D g_new0(virLXCDriver, 1); =20 - if (virMutexInit(&driver->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); - g_free(driver); - return NULL; - } + g_mutex_init(&driver->lock); =20 driver->caps =3D virLXCDriverCapsInit(NULL); driver->xmlopt =3D lxcDomainXMLConfInit(driver); @@ -182,7 +177,7 @@ virLXCControllerDriverFree(virLXCDriverPtr driver) return; virObjectUnref(driver->xmlopt); virObjectUnref(driver->caps); - virMutexDestroy(&driver->lock); + g_mutex_clear(&driver->lock); g_free(driver); } =20 @@ -1034,7 +1029,7 @@ static int lxcControllerClearCapabilities(void) } =20 static bool wantReboot; -static virMutex lock =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE_STATIC(lock); =20 =20 static void virLXCControllerSignalChildIO(virNetDaemonPtr dmn, @@ -1049,13 +1044,13 @@ static void virLXCControllerSignalChildIO(virNetDae= monPtr dmn, VIR_DEBUG("Got sig child %d vs %lld", ret, (long long)ctrl->initpid); if (ret =3D=3D ctrl->initpid) { virNetDaemonQuit(dmn); - virMutexLock(&lock); + G_LOCK(lock); if (WIFSIGNALED(status) && WTERMSIG(status) =3D=3D SIGHUP) { VIR_DEBUG("Status indicates reboot"); wantReboot =3D true; } - virMutexUnlock(&lock); + G_UNLOCK(lock); } } =20 @@ -1169,7 +1164,7 @@ static void virLXCControllerConsoleEPoll(int watch, i= nt fd, int events, void *op { virLXCControllerConsolePtr console =3D opaque; =20 - virMutexLock(&lock); + G_LOCK(lock); VIR_DEBUG("IO event watch=3D%d fd=3D%d events=3D%d fromHost=3D%zu from= cont=3D%zu", watch, fd, events, console->fromHostLen, @@ -1209,14 +1204,14 @@ static void virLXCControllerConsoleEPoll(int watch,= int fd, int events, void *op } =20 cleanup: - virMutexUnlock(&lock); + G_UNLOCK(lock); } =20 static void virLXCControllerConsoleIO(int watch, int fd, int events, void = *opaque) { virLXCControllerConsolePtr console =3D opaque; =20 - virMutexLock(&lock); + G_LOCK(lock); VIR_DEBUG("IO event watch=3D%d fd=3D%d events=3D%d fromHost=3D%zu from= cont=3D%zu", watch, fd, events, console->fromHostLen, @@ -1290,7 +1285,7 @@ static void virLXCControllerConsoleIO(int watch, int = fd, int events, void *opaqu } =20 virLXCControllerConsoleUpdateWatch(console); - virMutexUnlock(&lock); + G_UNLOCK(lock); return; =20 error: @@ -1298,7 +1293,7 @@ static void virLXCControllerConsoleIO(int watch, int = fd, int events, void *opaqu virEventRemoveHandle(console->hostWatch); console->contWatch =3D console->hostWatch =3D -1; virNetDaemonQuit(console->daemon); - virMutexUnlock(&lock); + G_UNLOCK(lock); } =20 =20 diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 7b232b4bac..3253c08117 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1494,10 +1494,7 @@ static int lxcStateInitialize(bool privileged, if (VIR_ALLOC(lxc_driver) < 0) return VIR_DRV_STATE_INIT_ERROR; lxc_driver->lockFD =3D -1; - if (virMutexInit(&lxc_driver->lock) < 0) { - VIR_FREE(lxc_driver); - return VIR_DRV_STATE_INIT_ERROR; - } + g_mutex_init(&lxc_driver->lock); =20 if (!(lxc_driver->domains =3D virDomainObjListNew())) goto cleanup; @@ -1631,7 +1628,7 @@ static int lxcStateCleanup(void) virPidFileRelease(lxc_driver->config->stateDir, "driver", lxc_driv= er->lockFD); =20 virObjectUnref(lxc_driver->config); - virMutexDestroy(&lxc_driver->lock); + g_mutex_clear(&lxc_driver->lock); VIR_FREE(lxc_driver); =20 return 0; diff --git a/tests/testutilslxc.c b/tests/testutilslxc.c index b5e2f542e7..1e04263d1f 100644 --- a/tests/testutilslxc.c +++ b/tests/testutilslxc.c @@ -63,12 +63,7 @@ testLXCDriverInit(void) { virLXCDriverPtr driver =3D g_new0(virLXCDriver, 1); =20 - if (virMutexInit(&driver->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", "cannot initialize mutex"); - g_free(driver); - return NULL; - } + g_mutex_init(&driver->lock); =20 driver->caps =3D testLXCCapsInit(); driver->xmlopt =3D lxcDomainXMLConfInit(driver); @@ -82,7 +77,7 @@ testLXCDriverFree(virLXCDriverPtr driver) { virObjectUnref(driver->xmlopt); virObjectUnref(driver->caps); - virMutexDestroy(&driver->lock); + g_mutex_clear(&driver->lock); g_free(driver); } =20 --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586526991; cv=none; d=zohomail.com; s=zohoarc; b=Sy2rUjaYC7SAPk95sFZV1FxtWw7xGNcySjPecq/VNs8b6T2VYMcap0lA+b9C9PTgSARR9HhlvtJXFFMZzNQRQGEBw77s8qJiFrHH5GmE80GwmXRZrdWvBXpRK6pDRr/mEhxsF3ZqFjh2rGBnZLPbWCxMLkM9Z4I0ZDZiCo6ts4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526991; 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=LX4b0RB+//cGPYnwa4nRz4HiWv+1yRpBTZZzIObjEP0=; b=ghoeqqBt/OMcMUmP73tVc0BdBtiVoQoKFNEcbWEwlA+fD4EhkyjUbv/cQKCaAuCNdHMoJyj58XNG6fr3RdCiulxS3SbKe/+9uIJQluLWaijEmjs6wWZAJqZPgYOkRsgqbM+9gVQRI7xAsqTdikVejMHcJhXguQdn8RjWNpLAy0M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 15865269919321011.5184481863482; Fri, 10 Apr 2020 06:56:31 -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-297-YuJc1ySdP7-8lIUGCiDkyg-1; Fri, 10 Apr 2020 09:56:27 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A3DD801E6D; Fri, 10 Apr 2020 13:56:21 +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 2C4CB272CB; Fri, 10 Apr 2020 13:56:21 +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 D7AD19308E; Fri, 10 Apr 2020 13:56:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADu0XB023114 for ; Fri, 10 Apr 2020 09:56:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id A75B1200AD4C; Fri, 10 Apr 2020 13:56:00 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2439202A940 for ; Fri, 10 Apr 2020 13:55:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 0C9398007AC for ; Fri, 10 Apr 2020 13:55:58 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-_C-EOZfgPdCYzz3HvHLR2w-1; Fri, 10 Apr 2020 09:55:55 -0400 Received: by mail-wm1-f67.google.com with SMTP id z6so2819875wml.2 for ; Fri, 10 Apr 2020 06:55:55 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526990; 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=LX4b0RB+//cGPYnwa4nRz4HiWv+1yRpBTZZzIObjEP0=; b=RnD9D+/1zezSFLfokOnxQj2Tsgi1ISdZdkQsoABzF0N7DvB65M+HSv1PPYZ2Y8o7qJaD04 40gWLptTUBwy8TxiKgob7JHCgHLxDxiM75LpRUUIY3KSCu086xz/jio1brEuZOLL2ZBwe6 U3b3mi36mbR73RmcDwI/Qn59ZkhSyo4= X-MC-Unique: YuJc1ySdP7-8lIUGCiDkyg-1 X-MC-Unique: _C-EOZfgPdCYzz3HvHLR2w-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=RaKua7JeJ+T6DzNyB+wSejyi8e7NvAOx/Z3z/pGVSeg=; b=hYxonXhHDJq8dZyU941rd0s65wwbi54qRipuGLdLrhIIM4Oo8KgZEFI20LRdMMD+Qv Xf09zC+7dln4oV+Pu0gX7ovqtBLL3erdW6mriIy5/8RD03BHqYIhRsm7OKWQwaaDdzhp MUfYOUfdBEAkOMAWw4cHCu0Ti9FvuUCKmhLE3vb38pvWo/fI9OTLR8IZQESmKJTKNJrT D76xXpVNy4mv+a6+1MCBb8Na8d8ucRdLu6cOyrXAfVPLKH1H2/Ai0VtQ5qh6iA+PX1u3 In4mAqSzPdHMo6hRXE6YAX+JUhSUxPyG4Ru+colNThPE0qqdzpY8ZAk+A4VxfmQdkVFm CK/g== X-Gm-Message-State: AGi0PubFzjcEwbYbATLxIVYhINGKdiSupc/kNsdy/w5Mn60e5DXqpAvR P0i/m5uCbh8Nlf6O5kpZUQfqnZwNn0A= X-Google-Smtp-Source: APiQypKFXvdkGKgyOUzWMTN7zJv0+y2fTKqTw9aJ+sNVKQZ42oBf0BLM8+zRk8JZ32W1YZLR+yakvg== X-Received: by 2002:a1c:5448:: with SMTP id p8mr5136227wmi.173.1586526953985; Fri, 10 Apr 2020 06:55:53 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 20/43] network: bridge_driver: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:47 +0200 Message-Id: <20200410135510.2148319-21-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.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADu0XB023114 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.84 on 10.5.11.23 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 Reviewed-by: Pavel Mores --- src/network/bridge_driver.c | 11 ++++------- src/network/bridge_driver_platform.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index f06099297a..2eaab9c667 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -101,14 +101,14 @@ networkGetDriver(void) static void networkDriverLock(virNetworkDriverStatePtr driver) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } =20 =20 static void networkDriverUnlock(virNetworkDriverStatePtr driver) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } =20 =20 @@ -726,10 +726,7 @@ networkStateInitialize(bool privileged, goto error; =20 network_driver->lockFD =3D -1; - if (virMutexInit(&network_driver->lock) < 0) { - VIR_FREE(network_driver); - goto error; - } + g_mutex_init(&network_driver->lock); =20 network_driver->privileged =3D privileged; =20 @@ -907,7 +904,7 @@ networkStateCleanup(void) =20 virObjectUnref(network_driver->dnsmasqCaps); =20 - virMutexDestroy(&network_driver->lock); + g_mutex_clear(&network_driver->lock); =20 VIR_FREE(network_driver); =20 diff --git a/src/network/bridge_driver_platform.h b/src/network/bridge_driv= er_platform.h index 169417a6c0..6528bf6647 100644 --- a/src/network/bridge_driver_platform.h +++ b/src/network/bridge_driver_platform.h @@ -29,7 +29,7 @@ =20 /* Main driver state */ struct _virNetworkDriverState { - virMutex lock; + GMutex lock; =20 /* Read-only */ bool privileged; --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586526997; cv=none; d=zohomail.com; s=zohoarc; b=OtxFt43MIaMVzFfKI408+P4wny4bEfrW2Icu28jYl+sz1D6HgmAeTJteXhBZc14pyLxx+l6Q7kX65dGP53SY1m3TB3zv1cpBYTC5ZsV34P2nFK/RMUInEz+CwxQtEe3FlOJ7VQFVPxSEW9f8pGTqJe8OrbsUXwMSC4M/k42iKEA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526997; 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=Ku6oT5e8UajixcANt4nJYSAxS2hCF5HAv4nSUloxL58=; b=Zb4eM96aqs/AMtjlmpcBLRXnDdBqns5/XOElO7ZQNyv8ZPdHG8moNma9zfcIMeP1MW3CY4iUtFQZhMKYgC6FRdohYoL4jvOh4FMs7sVrKxrL/egUJFXD3V6atcsbpSuEc4sDFj4EKlWEgAX6Jby4/mXLhlhKm1wMoOJLCO6yKf0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586526997170338.1540944420325; Fri, 10 Apr 2020 06:56:37 -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-165-RGtQYwFNMFKpWtgnmf3jew-1; Fri, 10 Apr 2020 09:56:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 159098018AF; Fri, 10 Apr 2020 13:56:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5EB95DA75; Fri, 10 Apr 2020 13:56:24 +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 8858818034F0; Fri, 10 Apr 2020 13:56:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADu0cR023115 for ; Fri, 10 Apr 2020 09:56:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id A75E92028CD6; Fri, 10 Apr 2020 13:56:00 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A310920230A6 for ; Fri, 10 Apr 2020 13:56:00 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 E1260101A55E for ; Fri, 10 Apr 2020 13:55:59 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-128-1UfjR3KfM_CpO-rDhkGmGw-1; Fri, 10 Apr 2020 09:55:56 -0400 Received: by mail-wr1-f66.google.com with SMTP id f13so2344935wrm.13 for ; Fri, 10 Apr 2020 06:55:56 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526996; 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=Ku6oT5e8UajixcANt4nJYSAxS2hCF5HAv4nSUloxL58=; b=HV4GpM9hA9exhnOvzm2VmBv/j/GrthxPkvaLhY9uziYeKtmLqkVhSDL2zEyIJUhrXkz383 U/EQUVmfyRwMHa1jOVLKN/yxaKIVlCXscbSRjEPExwQJdsgHzwfSiRBgX05xgv6y478lD6 04SBt1sZoOfJXO3jiLdcz8RMD9094us= X-MC-Unique: RGtQYwFNMFKpWtgnmf3jew-1 X-MC-Unique: 1UfjR3KfM_CpO-rDhkGmGw-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=ge0EKJiKJO3NQu39M1t4j2pgVbMRAEvVyWz7jl3grnI=; b=AOhTaFi721fwvz1F279ez0eGifStZj/nWJo+319tOHigv9IF1ppIwgm1HcYNVaMhRi ZYBWCIbx+trQmrvsnm4uU/6FB/l38/0uQyTHz+QBfPj7Lbzo52my7p6KwTToZI8ipvVw K06T+699Y/DheqG4m2H3uLsbdhLpvG892XNL7ut1Oae3GhTo82VvOGuV86kuCIB/AznX x0T3Nh5lrx0qng3KFvEANNMutFb+KMa4M3Amvhej7vCJLj5ZYj9DJuOuRWdLKKR6jtgV 4wkZX+SB6qV7nZeSSxr0Zb6nLbyU2yRBw4wf39ypo7NL14aUDU5fHpDvaLEdJCRfnX8w 136g== X-Gm-Message-State: AGi0Pub65b4ATRzKq4sqKRgysBHMtwAm7iSJBT8bCaUF6W/t1rSPbWs8 Jmdw3oy0P81vzvfJ2RWVVW5xI0ZnodU= X-Google-Smtp-Source: APiQypKXl7wLUdzO++dRiapWhnSY5UE3VuHqa5E9iTxGDXe8rKNu0QfsRVkqMW5X/RnrK0OyqxMjOA== X-Received: by 2002:adf:a350:: with SMTP id d16mr4949861wrb.277.1586526955209; Fri, 10 Apr 2020 06:55:55 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 21/43] node_device: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:48 +0200 Message-Id: <20200410135510.2148319-22-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.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADu0cR023115 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.14 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 --- src/conf/virnodedeviceobj.h | 4 ++-- src/node_device/node_device_driver.c | 11 +++-------- src/node_device/node_device_hal.c | 20 +++++--------------- src/node_device/node_device_udev.c | 21 +++++---------------- 4 files changed, 15 insertions(+), 41 deletions(-) diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h index c9df8dedab..2ffefddd20 100644 --- a/src/conf/virnodedeviceobj.h +++ b/src/conf/virnodedeviceobj.h @@ -35,8 +35,8 @@ typedef virNodeDeviceObjList *virNodeDeviceObjListPtr; typedef struct _virNodeDeviceDriverState virNodeDeviceDriverState; typedef virNodeDeviceDriverState *virNodeDeviceDriverStatePtr; struct _virNodeDeviceDriverState { - virMutex lock; - virCond initCond; + GMutex lock; + GCond initCond; bool initialized; =20 /* pid file FD, ensures two copies of the driver can't use the same ro= ot */ diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index ee175e1095..7d626948ec 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -145,14 +145,14 @@ nodeDeviceUpdateDriverName(virNodeDeviceDefPtr def G_= GNUC_UNUSED) void nodeDeviceLock(void) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } =20 =20 void nodeDeviceUnlock(void) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } =20 =20 @@ -161,12 +161,7 @@ nodeDeviceWaitInit(void) { nodeDeviceLock(); while (!driver->initialized) { - if (virCondWait(&driver->initCond, &driver->lock) < 0) { - virReportSystemError(errno, "%s", - _("failed to wait on condition")); - nodeDeviceUnlock(); - return -1; - } + g_cond_wait(&driver->initCond, &driver->lock); } nodeDeviceUnlock(); return 0; diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_devic= e_hal.c index 53a49ba2aa..fe78c3c4ae 100644 --- a/src/node_device/node_device_hal.c +++ b/src/node_device/node_device_hal.c @@ -607,18 +607,8 @@ nodeStateInitialize(bool privileged G_GNUC_UNUSED, return VIR_DRV_STATE_INIT_ERROR; =20 driver->lockFD =3D -1; - if (virMutexInit(&driver->lock) < 0) { - VIR_FREE(driver); - return VIR_DRV_STATE_INIT_ERROR; - } - - if (virCondInit(&driver->initCond) < 0) { - virReportSystemError(errno, "%s", - _("Unable to initialize condition variable")); - virMutexDestroy(&driver->lock); - VIR_FREE(driver); - return VIR_DRV_STATE_INIT_ERROR; - } + g_mutex_init(&driver->lock); + g_cond_init(&driver->initCond); =20 nodeDeviceLock(); =20 @@ -713,7 +703,7 @@ nodeStateInitialize(bool privileged G_GNUC_UNUSED, nodeDeviceLock(); driver->initialized =3D true; nodeDeviceUnlock(); - virCondBroadcast(&driver->initCond); + g_cond_broadcast(&driver->initCond); =20 return VIR_DRV_STATE_INIT_COMPLETE; =20 @@ -747,8 +737,8 @@ nodeStateCleanup(void) =20 VIR_FREE(driver->stateDir); nodeDeviceUnlock(); - virCondDestroy(&driver->initCond); - virMutexDestroy(&driver->lock); + g_cond_clear(&driver->initCond); + g_mutex_clear(&driver->lock); VIR_FREE(driver); return 0; } diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 8451903e8a..433de0aae0 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1477,8 +1477,8 @@ nodeStateCleanup(void) virPidFileRelease(driver->stateDir, "driver", driver->lockFD); =20 VIR_FREE(driver->stateDir); - virCondDestroy(&driver->initCond); - virMutexDestroy(&driver->lock); + g_cond_clear(&driver->initCond); + g_mutex_clear(&driver->lock); VIR_FREE(driver); =20 udevPCITranslateDeinit(); @@ -1748,7 +1748,7 @@ nodeStateInitializeEnumerate(void *opaque) nodeDeviceLock(); driver->initialized =3D true; nodeDeviceUnlock(); - virCondBroadcast(&driver->initCond); + g_cond_broadcast(&driver->initCond); =20 return; =20 @@ -1806,19 +1806,8 @@ nodeStateInitialize(bool privileged, return VIR_DRV_STATE_INIT_ERROR; =20 driver->lockFD =3D -1; - if (virMutexInit(&driver->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); - VIR_FREE(driver); - return VIR_DRV_STATE_INIT_ERROR; - } - if (virCondInit(&driver->initCond) < 0) { - virReportSystemError(errno, "%s", - _("Unable to initialize condition variable")); - virMutexDestroy(&driver->lock); - VIR_FREE(driver); - return VIR_DRV_STATE_INIT_ERROR; - } + g_mutex_init(&driver->lock); + g_cond_init(&driver->initCond); =20 driver->privileged =3D privileged; =20 --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586526999; cv=none; d=zohomail.com; s=zohoarc; b=NPpm7yzC3Dxieh+MKLOBvlByHSSBboVtQsa+sNiUWaVVMwa5Ol9igpPZtAP+e/qP9BFNOBERlOPVxEia4C5Gf++G1eOJQ5RTBoNJ1hyXNlhIAt9g9TpiNSFUEHE4rh0verDgPer9kcPwC8B4EVtvYDGBokbyr4PTqDB2Pk1QhF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526999; 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=I+JX0zsn0CPNSdCoNpqmwz/f3tzCC05OeS4ihHWZyhU=; b=npx9fG5lkXmm+ltyKLERX4a6YbJCe/plH+UocJxDPy3a1fX6rz9PFq1RHVMyycFdr50m/fKMfyLzR+pK0zkY2EdRlaU4ZQDjuZedeRjihNM+m8KiTX1Pyqe3eM/Ftbepit9qMmRPpP2OmnD5YUIAW9J5/wscoSM5VNHC9gvarTU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586526999533127.86654506211357; Fri, 10 Apr 2020 06:56:39 -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-488-Yis_RrqsNAG8EbLx4YzF7g-1; Fri, 10 Apr 2020 09:56:36 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 092241052BA2; Fri, 10 Apr 2020 13:56:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA4D39E0D7; Fri, 10 Apr 2020 13:56:28 +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 9692418034FF; Fri, 10 Apr 2020 13:56:28 +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 03ADu1XN023129 for ; Fri, 10 Apr 2020 09:56:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3EF1E127516; Fri, 10 Apr 2020 13:56:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B21E127512 for ; Fri, 10 Apr 2020 13:56:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 2281C185A78E for ; Fri, 10 Apr 2020 13:56:01 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-HVt_PgQMMdWmJ8XeEUbYJg-1; Fri, 10 Apr 2020 09:55:58 -0400 Received: by mail-wm1-f65.google.com with SMTP id r26so2832754wmh.0 for ; Fri, 10 Apr 2020 06:55:57 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526998; 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=I+JX0zsn0CPNSdCoNpqmwz/f3tzCC05OeS4ihHWZyhU=; b=XuSGVeaM2pNgyQAapawlRwQNJPtcBeNg3tIDRMhdpRIKTcrVUsmLR+i8qIDBd2NNKwsET8 g5czgGXyL252XqEoX6NjEkCz6R43DM2ADNUczeMkmInu+KDOR2QqAB3uY226oGhR2HSIjw 4bSnbMCKA53Z8FZRW4R5dyKUA3gZbxE= X-MC-Unique: Yis_RrqsNAG8EbLx4YzF7g-1 X-MC-Unique: HVt_PgQMMdWmJ8XeEUbYJg-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=PvzALv/riJXWJ/c6Og1qVXXjSk1UO1ILtaJrFt7tX4U=; b=RXuJWQtuvSaNDCn5OY0vwdKdpacVSIDl3efI0FlZRORMnhEMFrPI/CH5AkOq1HSuSp 2daKEZRiMq3rRbkmtNt1HM4pMTsw9MgEMvt2AElsZp4fl8NhdJibb55NJt2gPpUG8rOd STiCCcKI3nXlw1kj1KRxOF1CLqB34PurTbsFBJPB3SzQf1/gKyRxXuDYANHISEuosEts VyuEfjYzIOxbvwfbo6Chi+80cKggchOL9occZsWTWMYp5iXgNXYAHrVzloxGmXOnIEpD djfFA1zCmsdn6/nGyL3d1LUO7jSaYojelBHGhyI7SgzzVo1bPrKd3j5QvwF1Vvbr4apX t9nQ== X-Gm-Message-State: AGi0Pub3QYV6QVHA+kCjJlAisVsGwTNSMU9AHiWQp3Fj1MSeBtbgPO1L YWKnUvRg+ZNezc9qd02DftJubwbEe5c= X-Google-Smtp-Source: APiQypLXVcZf3Oulh06KOmfPTNv2H7MeqQEEGUSbqnVxQs5WXTYQpv+IJfmnSg6XAqJnqIzBbVGgfw== X-Received: by 2002:a1c:c90a:: with SMTP id f10mr5134457wmb.179.1586526956506; Fri, 10 Apr 2020 06:55:56 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 22/43] vmware: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:49 +0200 Message-Id: <20200410135510.2148319-23-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 03ADu1XN023129 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.13 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 --- src/vmware/vmware_conf.c | 2 +- src/vmware/vmware_conf.h | 2 +- src/vmware/vmware_driver.c | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index fd62bb96f7..dbe67fcd97 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -52,7 +52,7 @@ vmwareFreeDriver(struct vmware_driver *driver) if (!driver) return; =20 - virMutexDestroy(&driver->lock); + g_mutex_clear(&driver->lock); virObjectUnref(driver->domains); virObjectUnref(driver->caps); virObjectUnref(driver->xmlopt); diff --git a/src/vmware/vmware_conf.h b/src/vmware/vmware_conf.h index 5e0ef3744f..11610c1fcb 100644 --- a/src/vmware/vmware_conf.h +++ b/src/vmware/vmware_conf.h @@ -41,7 +41,7 @@ enum vmwareDriverType { VIR_ENUM_DECL(vmwareDriver); =20 struct vmware_driver { - virMutex lock; + GMutex lock; virCapsPtr caps; virDomainXMLOptionPtr xmlopt; =20 diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index d5dd6e4f5e..986615a515 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -50,13 +50,13 @@ static const char * const vmrun_candidates[] =3D { static void vmwareDriverLock(struct vmware_driver *driver) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } =20 static void vmwareDriverUnlock(struct vmware_driver *driver) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } =20 =20 @@ -211,8 +211,7 @@ vmwareConnectOpen(virConnectPtr conn, goto cleanup; } =20 - if (virMutexInit(&driver->lock) < 0) - goto cleanup; + g_mutex_init(&driver->lock); =20 if ((tmp =3D STRSKIP(conn->uri->scheme, "vmware")) =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unable to parse URI " --=20 2.25.2 From nobody Sun Feb 8 16:05:40 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 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586526998; cv=none; d=zohomail.com; s=zohoarc; b=TKjB39KAM5hsJcLnFYnT3w1rF6iyBEd/uybk1xfjIYdZjtCZtS9tY4amhr0Dhr/iHFMHBxVCz2WurLxXz/ppFwc0CJbO5A1mm2QIpOrXH9EKSQUXq8hEs4B5FAPlHjpNtiqzTzycnnkDr+ebtPWMI6qNYIdbdoTFIvpLbeo9S2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526998; 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=WF5OMQ9XyGWO3co8AGSnd9SOCoJ3xZ16uQsRjfuCX1E=; b=SmyOvwv4aCH9/7UxCWu8bWyxTwhc2+IapNDn9NztHJfdlCmBEkxLSOxIVgq8mtmiQFQP38rh07ovO6fvcKJD3VjPWXaGPInlgBB5XJrbLn9HKAF1GX6vq0AijTkx9OiOYdvsqLbJNUXYbMDPRu7Wv+uGqfDsN6f4++BW/oXNuVU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586526998375765.6014917866246; Fri, 10 Apr 2020 06:56:38 -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-211-waQIsdCkNKO1QvJ1vcsguQ-1; Fri, 10 Apr 2020 09:56:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4485010509C3; Fri, 10 Apr 2020 13:56:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C6295C557; Fri, 10 Apr 2020 13:56:28 +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 CFF3E18034FA; Fri, 10 Apr 2020 13:56:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADu3b1023164 for ; Fri, 10 Apr 2020 09:56:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C28B2166B35; Fri, 10 Apr 2020 13:56:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 381932166B34 for ; Fri, 10 Apr 2020 13:56:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 1EEAB185A78E for ; Fri, 10 Apr 2020 13:56:03 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-30-ZVZonxRvND-DquroU4QAJQ-1; Fri, 10 Apr 2020 09:56:00 -0400 Received: by mail-wm1-f65.google.com with SMTP id z6so2820126wml.2 for ; Fri, 10 Apr 2020 06:56:00 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526997; 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=WF5OMQ9XyGWO3co8AGSnd9SOCoJ3xZ16uQsRjfuCX1E=; b=gC+5ei/GUC1OVub/zOQEEn/2GNDAzz2AJ0BvvhEuUESXLjwOWwq1a8W7WVmfClT6PeFiyR MjC+PEo6sQu2UIclibc9nmmSxAHVvzb2mqxVpnjZ6AdkPnF9CvRrSPznIUndVP8FDsf6hD UnOK6RDwNwxNZ33Gz3Eftv3EgmtI6vI= X-MC-Unique: waQIsdCkNKO1QvJ1vcsguQ-1 X-MC-Unique: ZVZonxRvND-DquroU4QAJQ-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=2taPmXOIwF8fGqqXksvcm3KVXyIxxVYMOaemBVtDXgs=; b=VdJ3BQtrQduP/LmJEyJ139SB1plZL5VsV4bxPwpgshRE4Z0/bvMlOaxu3tfKmrdkQ4 ahptId/oSAAZXNwIPdYJWI9kGiQqsNEOzyabvQksNnhpjKT9YpqWvhmi4MtMNn26sQIm wHfvD9FoVo0CuU8FjPgEEfcy/RMjU6LLwldmW8imMG2yokExgqrTFtHROHB/FQPjqnSD QPpbCQHoHkv6m0hZEJFP1XWNPAdLOQL9BUiMHgw22lUjSccXJuAjNChQZGjm8opX1v5c yD6t0Nc/So3LgHp4/HhfALbGo9myc98sFQljVTI9ABh3Jmfgb2ToMj+XYjFc7SnzfPCY gNtQ== X-Gm-Message-State: AGi0Pua/hOuFvvpxtPB9699PrUfJuQnyxKyNNXwT0k52q2dnpMVUrCcU v5H21lIZWuMb1hsLkQ5RP64/j/G2pCM= X-Google-Smtp-Source: APiQypIbnH0uXSmfFoP3wZWzu1YqR6XC4eSxCIKFegCAba6WKyNLROgsbvalNBcXRoRpny5CHsLkcQ== X-Received: by 2002:a05:600c:20c:: with SMTP id 12mr5183729wmi.158.1586526958729; Fri, 10 Apr 2020 06:55:58 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 24/43] tests: qemumonitortestutils: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:51 +0200 Message-Id: <20200410135510.2148319-25-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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADu3b1023164 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.16 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/qemumonitortestutils.c | 37 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 992d2a4e71..78fc94e710 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -49,7 +49,7 @@ struct _qemuMonitorTestItem { }; =20 struct _qemuMonitorTest { - virMutex lock; + GMutex lock; virThread thread; =20 bool quit; @@ -233,10 +233,9 @@ qemuMonitorTestIO(virNetSocketPtr sock, { qemuMonitorTestPtr test =3D opaque; bool err =3D false; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&test->lock); =20 - virMutexLock(&test->lock); if (test->quit) { - virMutexUnlock(&test->lock); return; } if (events & VIR_EVENT_HANDLE_WRITABLE) { @@ -320,7 +319,6 @@ qemuMonitorTestIO(virNetSocketPtr sock, =20 virNetSocketUpdateIOCallback(sock, events); } - virMutexUnlock(&test->lock); } =20 =20 @@ -329,23 +327,23 @@ qemuMonitorTestWorker(void *opaque) { qemuMonitorTestPtr test =3D opaque; =20 - virMutexLock(&test->lock); + g_mutex_lock(&test->lock); =20 while (!test->quit) { - virMutexUnlock(&test->lock); + g_mutex_unlock(&test->lock); =20 if (virEventRunDefaultImpl() < 0) { - virMutexLock(&test->lock); + g_mutex_lock(&test->lock); test->quit =3D true; break; } =20 - virMutexLock(&test->lock); + g_mutex_lock(&test->lock); } =20 test->running =3D false; =20 - virMutexUnlock(&test->lock); + g_mutex_unlock(&test->lock); return; } =20 @@ -367,13 +365,13 @@ qemuMonitorTestFree(qemuMonitorTestPtr test) if (!test) return; =20 - virMutexLock(&test->lock); + g_mutex_lock(&test->lock); if (test->running) { test->quit =3D true; /* HACK: Add a dummy timeout to break event loop */ timer =3D virEventAddTimeout(0, qemuMonitorTestFreeTimer, NULL, NU= LL); } - virMutexUnlock(&test->lock); + g_mutex_unlock(&test->lock); =20 if (test->client) { virNetSocketRemoveIOCallback(test->client); @@ -414,7 +412,7 @@ qemuMonitorTestFree(qemuMonitorTestPtr test) =20 VIR_FREE(test->tmpdir); =20 - virMutexDestroy(&test->lock); + g_mutex_clear(&test->lock); VIR_FREE(test); } =20 @@ -426,6 +424,7 @@ qemuMonitorTestAddHandler(qemuMonitorTestPtr test, virFreeCallback freecb) { qemuMonitorTestItemPtr item; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&test->lock); =20 if (VIR_ALLOC(item) < 0) goto error; @@ -434,12 +433,9 @@ qemuMonitorTestAddHandler(qemuMonitorTestPtr test, item->freecb =3D freecb; item->opaque =3D opaque; =20 - virMutexLock(&test->lock); if (VIR_APPEND_ELEMENT(test->items, test->nitems, item) < 0) { - virMutexUnlock(&test->lock); goto error; } - virMutexUnlock(&test->lock); =20 return 0; =20 @@ -1046,12 +1042,7 @@ qemuMonitorCommonTestNew(virDomainXMLOptionPtr xmlop= t, if (VIR_ALLOC(test) < 0) goto error; =20 - if (virMutexInit(&test->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - "Cannot initialize mutex"); - VIR_FREE(test); - return NULL; - } + g_mutex_init(&test->lock); =20 tmpdir_template =3D g_strdup("/tmp/libvirt_XXXXXX"); =20 @@ -1103,6 +1094,7 @@ static int qemuMonitorCommonTestInit(qemuMonitorTestPtr test) { int events =3D VIR_EVENT_HANDLE_READABLE; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&test->lock); =20 if (!test) return -1; @@ -1123,16 +1115,13 @@ qemuMonitorCommonTestInit(qemuMonitorTestPtr test) NULL) < 0) return -1; =20 - virMutexLock(&test->lock); if (virThreadCreate(&test->thread, true, qemuMonitorTestWorker, test) < 0) { - virMutexUnlock(&test->lock); return -1; } test->started =3D test->running =3D true; - virMutexUnlock(&test->lock); =20 return 0; } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586526995; cv=none; d=zohomail.com; s=zohoarc; b=cTTYt2jDhnlhr2CGB3BbkfuA/j/oOnkV519LYshMFvCYH3sSLQdHe+axxUx0dzdSvCPnRTy2ElGP9AqNiyCMIRaYEzPtRJ1PXKWmbJwsWKj+S4sfGaLBOsRAHHsosB9YSgGH1pFWLLUcJ9mylMwaTv9LEhZLNkx8A7bkB3OCzNY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526995; 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=dA7fW2QBt4hMXqscHUVdWKhYYE6f74SYL65EDSeA/rQ=; b=YA0FKiZLsMffI/pzduziLOy/cjftyQBgGWKFY3S0OnTSRThH5VDq+nK3gqgYRk6jLgtS8G1Jz4KIxQoTsEtLjAKLihtmFdFYkPJFLyXnXjfwjs/OQnEmOZKrGy9rwA4eRf635n/CLJ4yfo1jpNFjO17/uvP718SpPogd4l4wEPk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 158652699530197.68001823723989; Fri, 10 Apr 2020 06:56:35 -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-366-R_NVJ_60PHmppYbaANiYTg-1; Fri, 10 Apr 2020 09:56:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B23A81137847; Fri, 10 Apr 2020 13:56:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8919F9DD96; Fri, 10 Apr 2020 13:56:24 +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 3ECA218034EF; Fri, 10 Apr 2020 13:56:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADu3kK023172 for ; Fri, 10 Apr 2020 09:56:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id CB8A52166AE1; Fri, 10 Apr 2020 13:56:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C77392166B34 for ; Fri, 10 Apr 2020 13:56:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 ACCE9185A793 for ; Fri, 10 Apr 2020 13:56:03 +0000 (UTC) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-HNoCXYdfOeesdwIPSesjrA-1; Fri, 10 Apr 2020 09:56:01 -0400 Received: by mail-wr1-f68.google.com with SMTP id k11so1758311wrp.5 for ; Fri, 10 Apr 2020 06:56:01 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526992; 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=dA7fW2QBt4hMXqscHUVdWKhYYE6f74SYL65EDSeA/rQ=; b=iqtkZKaHYWixw2P1bu1tkmcfDx901HP19yiW/NGsijJc01tHh4JU2pdKmf9MyJ6YzBBQ/D W8OtsY19owy7/5tz4Mtfe2adInYNotSy+7U5q0jXOCuKDrPycbZY5Cr6wnYzIhuW8pg3NC JXuWHMUj/A9FHmK/YNfYRFP1Ub/TVbw= X-MC-Unique: R_NVJ_60PHmppYbaANiYTg-1 X-MC-Unique: HNoCXYdfOeesdwIPSesjrA-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=xrMHex94udbNicEm2lO4Rhhhkgn20PBGjoOwna3lSh0=; b=o60cwxghSAnlFj5IzWmc5mucJ4nTY5xfQ70jcPP5UtnYUg/YLo75DF2foqF57NUTWP pqQNKJuL2vMxl6pNSpMUVW+HzglNtG/osnZKYfHkbZZz47wQjeSK9sb8YI3zO0CdBUZx EZVI6jKIho7NuKLnAJ7GtBcXXzc4ujaSOHJqTx1ra2/9KZrKNefhzoMprWhqleJlsQKb IGweijxR57TaOTpuSMWg9DIZMS2oJqH3o/leyA9gnmkDd0Zyl9plIdqZLR4YHUJNnK1X lSpq8VngW9DD4kKQvJO2+m9R0/M526NF5mLxUokUtvyI/WDtModrXrb9stQYTgWcHThT M7Ug== X-Gm-Message-State: AGi0PuaenVh9G7PD1eGAIN5F6BWwRw5vwCxehDAcyAedb836TM8TwmZo 5S/Zk0VBAL/6lckrfYyD95+1VZ7zvPA= X-Google-Smtp-Source: APiQypLqqp0TvsGuwS+Xp3l7aMYc2oOwcLT+hV1tt53z/wGVsJFsgRu4LUFWVBb0w3rlaF6gdvuRjQ== X-Received: by 2002:adf:ecc2:: with SMTP id s2mr5067398wro.73.1586526959882; Fri, 10 Apr 2020 06:55:59 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 25/43] qemu: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:52 +0200 Message-Id: <20200410135510.2148319-26-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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADu3kK023172 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.13 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 --- src/qemu/qemu_conf.c | 4 ++-- src/qemu/qemu_conf.h | 2 +- src/qemu/qemu_driver.c | 9 ++------- tests/testutilsqemu.c | 5 ++--- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index c59824006c..f4460e77ec 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -86,12 +86,12 @@ VIR_ONCE_GLOBAL_INIT(virQEMUConfig); static void qemuDriverLock(virQEMUDriverPtr driver) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } static void qemuDriverUnlock(virQEMUDriverPtr driver) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } =20 #ifndef DEFAULT_LOADER_NVRAM diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index b9ef4551a3..f28486d62b 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -225,7 +225,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDriverConfig, virO= bjectUnref); =20 /* Main driver state */ struct _virQEMUDriver { - virMutex lock; + GMutex lock; =20 /* Require lock to get reference on 'config', * then lockless thereafter */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d6ed6d3b3f..f6a9edf93c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -645,12 +645,7 @@ qemuStateInitialize(bool privileged, =20 qemu_driver->lockFD =3D -1; =20 - if (virMutexInit(&qemu_driver->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize mutex")); - VIR_FREE(qemu_driver); - return VIR_DRV_STATE_INIT_ERROR; - } + g_mutex_init(&qemu_driver->lock); =20 qemu_driver->inhibitCallback =3D callback; qemu_driver->inhibitOpaque =3D opaque; @@ -1134,7 +1129,7 @@ qemuStateCleanup(void) virPidFileRelease(qemu_driver->config->stateDir, "driver", qemu_dr= iver->lockFD); =20 virObjectUnref(qemu_driver->config); - virMutexDestroy(&qemu_driver->lock); + g_mutex_clear(&qemu_driver->lock); VIR_FREE(qemu_driver); =20 return 0; diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index cb68ac0488..27053603a0 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -307,7 +307,7 @@ qemuTestParseCapabilitiesArch(virArch arch, =20 void qemuTestDriverFree(virQEMUDriver *driver) { - virMutexDestroy(&driver->lock); + g_mutex_clear(&driver->lock); if (driver->config) { virFileDeleteTree(driver->config->stateDir); virFileDeleteTree(driver->config->configDir); @@ -386,8 +386,7 @@ int qemuTestDriverInit(virQEMUDriver *driver) !(cpuPower9 =3D virCPUDefCopy(&cpuPower9Data))) return -1; =20 - if (virMutexInit(&driver->lock) < 0) - return -1; + g_mutex_init(&driver->lock); =20 driver->hostarch =3D virArchFromHost(); driver->config =3D virQEMUDriverConfigNew(false, NULL); --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1586526998; cv=none; d=zohomail.com; s=zohoarc; b=R83mdywDqNZhrBCWUaayvO7Glfcr2H/+G2R3qRY60HDlDKMrX7gG9MREjE3brkX2jvyPwgG4R9PVjv1iIBqmtOzn/tU4K6MBbBxUN4KghEPl5sB8lKSRzorIMzzpjCs8ZkqfJn1Mzhl2vfoQ84qsni5sDQGGbEmzRS/yUnyXD5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586526998; 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=fKuFqPnJbqeobMqCCmL93H+0baJ4pB9Sbhn1xkEo8Z8=; b=MRlGY5MmIKB+IBShM5nmFfB97J48F5kvYC/ShiggFYNejWgu8o/O77pFzLVUUrxDMFyLWcpQQfiedNJ8v1GH0y3frDL+6GKGH0qN5dmflaOie3RVhiQVr6rh9DPgrXXn/MXGNfCifSZWeNNZTkUzybXjv3U4rgnVq2eBPoe/7uM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586526998132199.7354367089995; Fri, 10 Apr 2020 06:56:38 -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-8-VSaMQKL0Pamnk1JB1pf-Ng-1; Fri, 10 Apr 2020 09:56:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A629618B5F80; Fri, 10 Apr 2020 13:56:28 +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 80A2F5C557; Fri, 10 Apr 2020 13:56:28 +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 3B15093A97; Fri, 10 Apr 2020 13:56:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADu55x023192 for ; Fri, 10 Apr 2020 09:56:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 952E72166B35; Fri, 10 Apr 2020 13:56:05 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 90D522166B34 for ; Fri, 10 Apr 2020 13:56:05 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 77C5F8007C9 for ; Fri, 10 Apr 2020 13:56:05 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-Nl63su15O7yfrMG2WOWTBA-1; Fri, 10 Apr 2020 09:56:02 -0400 Received: by mail-wm1-f67.google.com with SMTP id r26so2832981wmh.0 for ; Fri, 10 Apr 2020 06:56:02 -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.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586526997; 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=fKuFqPnJbqeobMqCCmL93H+0baJ4pB9Sbhn1xkEo8Z8=; b=LJHt2zcbxmkc9s3U8nfSg2ptlmBI0amKTQYoF2IqD0rDsrrUoB0FTyVajdZNIV2WiulxT8 QGvhhglNxzrEFQcoRSrpwvrj/Pv6a85HlbgriTmMVQTe4vhSEY1oT3mCrcw7s7Ml2/Q1Vn uDh/Yp4bZOS/fzMVPmlvsXtwUDk4XR8= X-MC-Unique: VSaMQKL0Pamnk1JB1pf-Ng-1 X-MC-Unique: Nl63su15O7yfrMG2WOWTBA-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=Br2aNQxnHGrovlOyUUvcKTQggM+/4X53iPi2raUgVxM=; b=Xa4YRglo5f852UNWIWxtyi0eMY4a6oxj+XxCUGxZ32yeaVBdAEWP1c8+kDaS9MLMLw +GvEfn4xEwGNfexEFkmvibcSUKFyWApUcEQD8DDTHCV2TUfBU5EI8Dg6TCqxRQJC1q4I bfgvYhrfUWFa1zJjBW6g6uTVm+jAD1/LUUZlU1Ay03X8Jo5NbZMUBG6SDJUOthegaNOj M8vDnwnjJxmhJav2uoIJ7o1DZB7war2g4k3cZy+t3erosmaAtRD+cWHtfKD5LAveJ22d tFf1csHONbYD7METtb7H+pb07204ada4uSUt3/Dpxi7QNXH7xejIN0AjTlyGGTBbFCjZ K/sA== X-Gm-Message-State: AGi0Pua4+P96nYFIg/EVgNN2CJREyJFoX+xsNGUyQ/KIxvacxXeowGUi 0ULEN7RKza6vBOw0Iu3oFdgPNMui24k= X-Google-Smtp-Source: APiQypIpfnfLEl7wP+Ee3KcF+H1G6n0paxQJcb2pnZC4bLT4WF+5UzmnfxEwaWmFDSgsaxvmg7YSkg== X-Received: by 2002:a1c:a443:: with SMTP id n64mr5473060wme.144.1586526960980; Fri, 10 Apr 2020 06:56:00 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 26/43] remote: remote_driver: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:53 +0200 Message-Id: <20200410135510.2148319-27-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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADu55x023192 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.16 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 --- src/remote/remote_driver.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 7bae0c2514..6cd38e86ef 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -116,7 +116,7 @@ VIR_ENUM_IMPL(remoteDriverMode, static bool inside_daemon; =20 struct private_data { - virMutex lock; + GMutex lock; =20 virNetClientPtr client; virNetClientProgramPtr remoteProgram; @@ -147,12 +147,12 @@ enum { =20 static void remoteDriverLock(struct private_data *driver) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } =20 static void remoteDriverUnlock(struct private_data *driver) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } =20 static int call(virConnectPtr conn, struct private_data *priv, @@ -1393,12 +1393,7 @@ remoteAllocPrivateData(void) if (VIR_ALLOC(priv) < 0) return NULL; =20 - if (virMutexInit(&priv->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize mutex")); - VIR_FREE(priv); - return NULL; - } + g_mutex_init(&priv->lock); remoteDriverLock(priv); priv->localUses =3D 1; =20 @@ -1561,7 +1556,7 @@ remoteConnectClose(virConnectPtr conn) ret =3D doRemoteClose(conn, priv); conn->privateData =3D NULL; remoteDriverUnlock(priv); - virMutexDestroy(&priv->lock); + g_mutex_clear(&priv->lock); VIR_FREE(priv); } if (priv) --=20 2.25.2 From nobody Sun Feb 8 16:05:40 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=O8FIerMEUmfVf9mwFI3Slp7OzVQCm7HL2IcBxr1B3ASSbvNZt9AbICvvheRHf6xQakWiwUCOj8jGRbW5fAdctYbNtksdlr/bN5VO9GbKT0hEez4SzTDglN8AQvod8+Oc/alkXM9GxiRqMlrzTqKuCjW3mpINYJ04whlyc14uTx0= 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=JE9qay9CiyDZ8xybVE5/07gTnw2hpNZYUhaN9Xlyw/g=; b=J3ptQgq7XHDQD2gR39ibTyeacBECPz7/LujsTaT+wIjxzIVdgluUQT4+ExLky0c4EcEPQFSrOwifJJne15SA/TnpCZOlD5ZwyG/z7LScky9X3LOYUt4eilEIj/05B7/FJ82ESaq6L24wDtqCWZQeJ84ua+mZsDOWSHdr+32TwWY= 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 158652700343598.54459408066816; 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-321-xQd79u3rMZ6uQQPXEahSeA-1; Fri, 10 Apr 2020 09:56:39 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7CAC4801E67; 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 5022EC0DBC; 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 F3D3138A1; Fri, 10 Apr 2020 13:56:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADu6PK023208 for ; Fri, 10 Apr 2020 09:56:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7A7AD10E60DD; Fri, 10 Apr 2020 13:56:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 767D710E60DC for ; Fri, 10 Apr 2020 13:56:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 5DDDE8007A4 for ; Fri, 10 Apr 2020 13:56:06 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-103-aFAxUYRFPI2R7iFCc-353A-1; Fri, 10 Apr 2020 09:56:03 -0400 Received: by mail-wm1-f65.google.com with SMTP id r26so2833053wmh.0 for ; Fri, 10 Apr 2020 06:56:03 -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.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:01 -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=JE9qay9CiyDZ8xybVE5/07gTnw2hpNZYUhaN9Xlyw/g=; b=GWx6olIfaEcLyMcX/dDtwKn4nys9Y5H3qOPnSidlgB+hxzAWuq5wMbMG5XBv7THcEBtlvd 6WmL3UxWjOzBk6q0+NeeVZTNWn9Xd6du0dSuuN81k3nPNJsQrLOJ/LaI5FSn1mc6ueMmnd mRvBs8Y+9vdevvyY2F0riO2OrKCF+LY= X-MC-Unique: xQd79u3rMZ6uQQPXEahSeA-1 X-MC-Unique: aFAxUYRFPI2R7iFCc-353A-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=80ze4kGDBQ0doji6xXhTP31WFquPUTCGw2ZGM4YzPMk=; b=ZujqXN8TVwmYDrdPqL3p8vjvSBFdL5w1hlHGHX/w2bd8xyoApYuL0Jy1P79yNHD7D5 ExooCcpuh9xeaahws0fnkhnq9K2v82tYo4DQU58viVKM3NIICge1gN/Cm4x+XbeDSVSR 0GKfc5Ag/+E3Ma1RzSsMALABYSQSLZgFR03EeRIJ6zSPkpunubOJMgVYXvcHz7dp6sDF vgc5piWNphEjAumqzmKc+udPdJIgMhocJ5U3QwJs1xpRMpaldb9xF+U6TI63TNjOBBWB TYF3MCER4udZlIYGqi2ttauzpsRYNgSxXl9Kq92usTljg9xM6pvhUyN0dBzFYB6g+ysO s11w== X-Gm-Message-State: AGi0PuY+sf04fhYAF4wyLqQrdO1ESpPAzilXYG1V2hamaF2M6ayyRXC/ AOJRg8Db14Ekb66BUKcDHtwdNXBc9aQ= X-Google-Smtp-Source: APiQypIQE3dcWE/DdqvVbNoqyS0Y2Zg2H26uB6+eXPbpCndOKcxlnrzkusIna8gbBRTws7b4oVrBxg== X-Received: by 2002:a7b:c3c5:: with SMTP id t5mr4998078wmj.80.1586526962134; Fri, 10 Apr 2020 06:56:02 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 27/43] nwfilter: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:54 +0200 Message-Id: <20200410135510.2148319-28-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADu6PK023208 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.15 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 --- 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; =20 /* pid file FD, ensures two copies of the driver can't use the same ro= ot */ 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); =20 static void nwfilterDriverLock(void) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } static void nwfilterDriverUnlock(void) { - virMutexUnlock(&driver->lock); + g_mutex_lock(&driver->lock); } =20 #ifdef WITH_FIREWALLD @@ -197,8 +197,7 @@ nwfilterStateInitialize(bool privileged, return VIR_DRV_STATE_INIT_ERROR; =20 driver->lockFD =3D -1; - if (virMutexInit(&driver->lock) < 0) - goto err_free_driverstate; + g_mutex_init(&driver->lock); =20 driver->privileged =3D privileged; if (!(driver->nwfilters =3D virNWFilterObjListNew())) @@ -379,7 +378,7 @@ nwfilterStateCleanup(void) /* free inactive nwfilters */ virNWFilterObjListFree(driver->nwfilters); =20 - virMutexDestroy(&driver->lock); + g_mutex_clear(&driver->lock); VIR_FREE(driver); =20 return 0; --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1586527002; cv=none; d=zohomail.com; s=zohoarc; b=lxMNAH3qzCn/ioNnUu5Umjsju5hF3Qv2+LQV/OuFEmDRGYNxiSMb52W8faIR8qCKNErYy2Br/S+F2OiQ0oh5nnYxPbHbo+CyY7DCIuK2SHlgcA7USWOD5xmRvtdrEZh5rB4Zha/0tjJDLTRASZhXTqFa0CgNTLiQM3UYH6uw2iI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527002; 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=5PtK77CJmpH3s5S9V85o1MHt2rFx0QxbLcWm3ykpsqY=; b=hMcVY/Jf6HS8yTeoowBnejY515uuEDD81ERumxfz6m92Z89c7/BuyuQK6yjSSkYC5k5PxBH9SKpi1q+GTNoEF9diUhhCXwmtDIhgnwaF8w7VZsCor+T8JMGPAe4WTCqJa1nbZStlZwnXBw/Ad8dkdf++3cOUYkZ3IPO35sTMUVw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586527002350358.9523513570723; Fri, 10 Apr 2020 06:56:42 -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-206-EAk6dY5lO_udyzNGP50cvQ-1; Fri, 10 Apr 2020 09:56:38 -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 8DBD018B5F81; Fri, 10 Apr 2020 13:56:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5CE2760C87; 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 1628E180350B; Fri, 10 Apr 2020 13:56:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADu7PU023222 for ; Fri, 10 Apr 2020 09:56:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7798D2166B35; Fri, 10 Apr 2020 13:56:07 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73DEC2166B34 for ; Fri, 10 Apr 2020 13:56:07 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 5A369185A78E for ; Fri, 10 Apr 2020 13:56:07 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-42L3gJQ4M0WA604P2VrnEA-1; Fri, 10 Apr 2020 09:56:05 -0400 Received: by mail-wr1-f65.google.com with SMTP id 65so2414959wrl.1 for ; Fri, 10 Apr 2020 06:56:04 -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.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527001; 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=5PtK77CJmpH3s5S9V85o1MHt2rFx0QxbLcWm3ykpsqY=; b=PQ3srCjVwV7IXJ8lepb0APofbba4JIWhRAKCHvbprrYgB4PrzFQ2aM5GIhnQcaIxBNtiul uXYkpKRDVdofK9fsS52DXf+QR8Pko2sD8PuLULs6KWcVU9aepPip9MK8bDA5B+xg3OCUhN QT/jXnGzv6BfmWzIXenmR5nQwCohrLE= X-MC-Unique: EAk6dY5lO_udyzNGP50cvQ-1 X-MC-Unique: 42L3gJQ4M0WA604P2VrnEA-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=CYEGLIkw0JxXZpHBOkqIuLweXMVrzLkzU6fM/xpb//4=; b=QdvZghdhSGAZBZFGTSsuNCqeC6XdPK4BeNQi4u1w5Xzc1uLZ0Wl6bRaY/YuwNGquEL it19PUfwKkCmHbPhH4HDW6le4ca0Q0q+/DPrmFAHyLhQM85haXnX05+TuGB1Brcut/y6 Vv0IsoNah+f9/YV/m0kEIpJ1NKiXSaPXL9+2zPDcC/vEzt2Il8FHOo3pQmuPYr7a7Qqf UDRActuIbKkvd04mkPwcw9Cw5L3kw3CY2EJ6TvKPI+a3orwvtKFzKyxI63cmfuwCXG6v vADZFjdTKqzRpYFFaP81DFPgKCt8bx6oD7UyMmKcpZtyY0t8g/Cyh3RNRlZ0t3R75o+N 9VRg== X-Gm-Message-State: AGi0PuYFE6RlTgnVv3GEFyyQJM+TexMTo8W4KHZk5irV3f2qD9Czqofv RjerwcmYWRnRyBqWAgd/H1WEYO458Fs= X-Google-Smtp-Source: APiQypLxkD62buKLOdwxlKIrcSQrKkaqEktJecdECddPfFePENb+tAUERKYTR5pxy+3dDGAoXYBunQ== X-Received: by 2002:adf:e282:: with SMTP id v2mr4690887wri.329.1586526963628; Fri, 10 Apr 2020 06:56:03 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 28/43] openvz: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:55 +0200 Message-Id: <20200410135510.2148319-29-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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADu7PU023222 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 --- src/openvz/openvz_conf.h | 2 +- src/openvz/openvz_driver.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openvz/openvz_conf.h b/src/openvz/openvz_conf.h index 9892f39481..1680227e95 100644 --- a/src/openvz/openvz_conf.h +++ b/src/openvz/openvz_conf.h @@ -37,7 +37,7 @@ #define VZCTL_BRIDGE_MIN_VERSION ((3 * 1000 * 1000) + (0 * 1000) + 22 + 1) =20 struct openvz_driver { - virMutex lock; + GMutex lock; =20 virCapsPtr caps; virDomainXMLOptionPtr xmlopt; diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 1a189dbbe7..36a22a4e88 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -67,12 +67,12 @@ static int openvzGetVEStatus(virDomainObjPtr vm, int *s= tatus, int *reason); =20 static void openvzDriverLock(struct openvz_driver *driver) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } =20 static void openvzDriverUnlock(struct openvz_driver *driver) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } =20 struct openvz_driver ovz_driver; --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586527007; cv=none; d=zohomail.com; s=zohoarc; b=IF0Bq2e/omSKAKujRpprVUxUQ6UNcnhBLKn/Q7OK+bpCoLJAXuVhvaNgoYA201NsBMhOCVZgPSXxGHa91qqjHij1+FQVnJ3/JWxEp1fz//1Jo3TNYWH24griHbwNhF6Lpi3eK4JT0iAaFw4RA5cOZ8w7ThqV8F0B46prq3PmoCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527007; 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=HdjlDS0sk1StUzVU+rMw04ewSDZiW+vdZJjoRJzP0xg=; b=FPuTAba9OopfaRZs06P5h7GMphnAoz3ROq97cRPtg5g83aZTAaKTPBiXmOrDUo+eYYtJagQfYdKc8kWWYAOWARa4a1MSOY1mgFufXIndT7/a+5OPjN+s01YVE4+P6l4LfKE46dLKruzKUSdGfIg3SSyB7F9PUDSmMYeWscndwGo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586527007151391.781162241119; Fri, 10 Apr 2020 06:56:47 -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-113-vz-2yrGgPyanAVczMp_B1Q-1; Fri, 10 Apr 2020 09:56:41 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0CB9F8018AB; Fri, 10 Apr 2020 13:56:36 +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 D588511A25E; Fri, 10 Apr 2020 13:56:35 +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 8884393093; Fri, 10 Apr 2020 13:56:35 +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 03ADuBji023252 for ; Fri, 10 Apr 2020 09:56:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id A90A7127515; Fri, 10 Apr 2020 13:56:11 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A510E127512 for ; Fri, 10 Apr 2020 13:56:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 8C323802D05 for ; Fri, 10 Apr 2020 13:56:11 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-2NGiijFCOY6pk3bS_hcBPw-1; Fri, 10 Apr 2020 09:56:06 -0400 Received: by mail-wm1-f67.google.com with SMTP id x25so2592636wmc.0 for ; Fri, 10 Apr 2020 06:56:06 -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.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527006; 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=HdjlDS0sk1StUzVU+rMw04ewSDZiW+vdZJjoRJzP0xg=; b=a40re/Iu9043sOm+pOilN0Bj+ckF3KL8mhFrKbwaXiW7w+eC2GPc+0KUmHL4uQH0LbgYTE QIbuCxNFvcBmJcygV/I+PWwLRaLUIcTimEWxjpmwikhIyNXD5nHkV1oOxcxedGzciCScbg d5MSlOHuF5CeUA1SB6QNzCB5dVMbnVg= X-MC-Unique: vz-2yrGgPyanAVczMp_B1Q-1 X-MC-Unique: 2NGiijFCOY6pk3bS_hcBPw-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=5zekBdq0KeSU9G3eIo0ArmubAAgkiqD9a3kYRxCWqo8=; b=gsADYzIEPH7LF38n9K7xq6hvT3lEbgAcajEpV8VSVOsrP4jmEm9Ki3YFsZarvj1XcN jZwD1+0M52pGwF/szvOmt6eBhrvFLMAhFE9S5Z1RNekm6kyYuf4/oEqSgmb420ZZQTXo 1rnHtnDJ1Me7IF7Y6SGA08qcQHLMaHKbHdF+nMIU4qpXd6k0OVIbcsR6lG2umbGUyYEQ +dY3P0eQPhWdhJ6XD1WPx9HRkfn6M+H4QTiNwK2kaXBF8BTKn/cvqZRVSeWIRGmdAgwx ZjB3oRVvVEs57y0y4i4T0wdA0FJvfwbP2SmdVuH/jSPZN6by9/Jw5QcUKxfc2ZvFC8Cn ZGmg== X-Gm-Message-State: AGi0PuawYARJm0dIz3rfGz9xopbFFRkbJuBrsvu4dzCDpl1EveWv86Yr HiyE+HF+luq/dHP2pl2otmu8PXgbsCk= X-Google-Smtp-Source: APiQypKUU3HY3AWvXXqPXUwERFFxGYeu98oTAXk/1JKxXLiIk9mhLsQuWtN71JjHm0iIztiBirRutw== X-Received: by 2002:a7b:c417:: with SMTP id k23mr5399136wmi.147.1586526965002; Fri, 10 Apr 2020 06:56:05 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 29/43] storage: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:56 +0200 Message-Id: <20200410135510.2148319-30-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 03ADuBji023252 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.11 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 --- src/conf/virstorageobj.h | 2 +- src/storage/storage_driver.c | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/conf/virstorageobj.h b/src/conf/virstorageobj.h index 54100ac22a..0f1f7c3d8d 100644 --- a/src/conf/virstorageobj.h +++ b/src/conf/virstorageobj.h @@ -35,7 +35,7 @@ typedef struct _virStorageDriverState virStorageDriverSta= te; typedef virStorageDriverState *virStorageDriverStatePtr; =20 struct _virStorageDriverState { - virMutex lock; + GMutex lock; =20 /* pid file FD, ensures two copies of the driver can't use the same ro= ot */ int lockFD; diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 2db763caa5..3a2816dede 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -68,11 +68,11 @@ struct _virStorageVolStreamInfo { =20 static void storageDriverLock(void) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } static void storageDriverUnlock(void) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } =20 =20 @@ -269,10 +269,7 @@ storageStateInitialize(bool privileged, return VIR_DRV_STATE_INIT_ERROR; =20 driver->lockFD =3D -1; - if (virMutexInit(&driver->lock) < 0) { - VIR_FREE(driver); - return VIR_DRV_STATE_INIT_ERROR; - } + g_mutex_init(&driver->lock); storageDriverLock(); =20 if (!(driver->pools =3D virStoragePoolObjListNew())) @@ -391,7 +388,7 @@ storageStateCleanup(void) VIR_FREE(driver->autostartDir); VIR_FREE(driver->stateDir); storageDriverUnlock(); - virMutexDestroy(&driver->lock); + g_mutex_clear(&driver->lock); VIR_FREE(driver); =20 return 0; --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586527005; cv=none; d=zohomail.com; s=zohoarc; b=jFP1jeBjqXfyPX32oMyV8YOq8gzh/gVVVDOvwzOGTkswVmLr7XXF7bhg9njewJyToY8TWYEQB2dXZutjQGSLnEBABu3xw4Lj6PYjTCjqSjhW1sA6ZyR3lqY7qkl7Wo/lXFXpUB6pVCLJrNEQZixPLBUlqEepxbN9gLNWroWv61A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527005; 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=aeYFPi6L78F81jwRKxc2BmQL7jpx5ljwsJNTRvlG6Sk=; b=JUCj506/VmOzbQfR4jZ/zoQY70iev29X4kfvX/lktuT0mukkR7bqKPa6hWheqAiaCnsuEfFUkueDPBsHQ25ZH55jhFLNk4Gpz8fB/X3JhygFkynaFNJs641Vpn+iJLE3thxCoIJEciAyYd/4QmQcPEZXAvQuNg91y6iSJr9Z63A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586527005623236.40601674323807; Fri, 10 Apr 2020 06:56:45 -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-163-WLU_fO4LMEGHHO9JuBWVtw-1; Fri, 10 Apr 2020 09:56:42 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 32A95107ACCA; Fri, 10 Apr 2020 13:56:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 039295DA75; Fri, 10 Apr 2020 13:56:36 +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 AD34118033C2; Fri, 10 Apr 2020 13:56:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuBFT023246 for ; Fri, 10 Apr 2020 09:56:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0A49210E60DD; Fri, 10 Apr 2020 13:56:11 +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 05DB510E60DC for ; Fri, 10 Apr 2020 13:56:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 DF9A48FF663 for ; Fri, 10 Apr 2020 13:56:10 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-387-r3_JkNb8OPam0q7FjCbUjA-1; Fri, 10 Apr 2020 09:56:08 -0400 Received: by mail-wr1-f66.google.com with SMTP id p10so2382888wrt.6 for ; Fri, 10 Apr 2020 06:56:08 -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.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527004; 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=aeYFPi6L78F81jwRKxc2BmQL7jpx5ljwsJNTRvlG6Sk=; b=Eb9rSU9jiWBsOEMrdlw9apFLLOpOPNtEz1vfCj9/M9Zir+lxlYcSNqZb7e5w4pAhcQJZHA 1GWqLH+sCchhOK95TDwBbbjwB25POyfcc274VY5cORNAdMmVIP1WTUz3Sn/2TRJMCqEUjy Qssuhpiv9vbOXjh+aYxx/YHYbl9iYYY= X-MC-Unique: WLU_fO4LMEGHHO9JuBWVtw-1 X-MC-Unique: r3_JkNb8OPam0q7FjCbUjA-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=bMMOkSZtrDy7mEvjJcZQ8K+tsBG+4VY9c9gbofVWqDo=; b=j/UpTnrB2Bq38dFI0lpXzkhRpkYbrMLHgZu0RnjQhnuO3+SgypMmKZ9WHSF6dn6KUr pFQHPTpeLTZhTFIlmHUjesheJvrSfqJddl0jGr2Qj9oFQSx+h670ABzEkpv8ugvMqB1w Tf2HMVHeok11Qbw0pyXUcGwrCce5z9bSQ+aGIg1vlZjB7WYtF96jAP+VPXnzYattn7NP kje7GXG33wKNu8BQD37f4vpxRkY3PVWy0Um8+gTT5VQw8FRfnA+HWFN2a6OUplzhVCvK RPrEO0jrH116sIV2tbcNtP7D3eL2ggTsqARABSSoLKNZrbHoB3/zKZczBCNV8z3UQSM+ shYg== X-Gm-Message-State: AGi0Pub08bM0MY6SL6yie7m3BOJAhr1pTcp0HHzGA9ub1TwYmMZJO5E/ JMcJ1ZVaLWEwyHXoR7FFQ+E4ow6e34Y= X-Google-Smtp-Source: APiQypJe1mAltSGxkEkAQrq6wtMWjHzf4p5IwQYy+qRFVmL0J6WwlMASTWScDvBGc8Rciwq9OflUuQ== X-Received: by 2002:a5d:4d51:: with SMTP id a17mr4810448wru.317.1586526966165; Fri, 10 Apr 2020 06:56:06 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 30/43] secret: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:57 +0200 Message-Id: <20200410135510.2148319-31-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuBFT023246 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.14 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 --- src/secret/secret_driver.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c index 1cb342878f..51a8a6e53e 100644 --- a/src/secret/secret_driver.c +++ b/src/secret/secret_driver.c @@ -54,7 +54,7 @@ enum { SECRET_MAX_XML_FILE =3D 10*1024*1024 }; typedef struct _virSecretDriverState virSecretDriverState; typedef virSecretDriverState *virSecretDriverStatePtr; struct _virSecretDriverState { - virMutex lock; + GMutex lock; bool privileged; /* readonly */ char *embeddedRoot; /* readonly */ int embeddedRefs; @@ -74,14 +74,14 @@ static virSecretDriverStatePtr driver; static void secretDriverLock(void) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } =20 =20 static void secretDriverUnlock(void) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } =20 =20 @@ -446,7 +446,7 @@ secretStateCleanup(void) =20 VIR_FREE(driver->stateDir); secretDriverUnlock(); - virMutexDestroy(&driver->lock); + g_mutex_clear(&driver->lock); VIR_FREE(driver); =20 return 0; @@ -463,10 +463,7 @@ secretStateInitialize(bool privileged, return VIR_DRV_STATE_INIT_ERROR; =20 driver->lockFD =3D -1; - if (virMutexInit(&driver->lock) < 0) { - VIR_FREE(driver); - return VIR_DRV_STATE_INIT_ERROR; - } + g_mutex_init(&driver->lock); secretDriverLock(); =20 driver->secretEventState =3D virObjectEventStateNew(); --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1586527011; cv=none; d=zohomail.com; s=zohoarc; b=GZedfQCJs8/BgbNs8ooFbox8VoiTtIaxrG2iNK5ubh9nEZNB1+LSCDLlxkOiFKcmOUZ0DQ81U6xO8qC+yJUZta3afQyTDx54hwdSk+j8mpbdS4dmSc+Bbq/ij/l0V9NnJh1A3Rgv3I1qHSlv4jMgCv8Ppw2Lxq4UQmyz+sPWMn4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527011; 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=VH7BnpD/y6Aqk2I5DPE3neKk2E1Yb3FJNiI8Le18b9I=; b=dqrfWh7omAF4Ng6OuvXRCv/s+ZKGwuL4S7dnHwlLu528EgQCpBOM8EpLB/eC6+S4yrNFh670ufa0ZxUNxMcszQ9FzvLjCfNy8RC+XExuL6qs5fXbIoleAgJoMgA4jv/ySyEgCACwK+WpJ115SM0lVQSakYwOvqgQs9kKldkO5R4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586527011714265.75132305015757; Fri, 10 Apr 2020 06:56:51 -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-230-xH9JjAQfPWm-1cXIFE-n6Q-1; Fri, 10 Apr 2020 09:56:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1266D106BBEA; Fri, 10 Apr 2020 13:56:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D6BFD5C557; Fri, 10 Apr 2020 13:56:39 +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 8312D18033AD; Fri, 10 Apr 2020 13:56:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuCj6023257 for ; Fri, 10 Apr 2020 09:56:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3918D10E60DD; Fri, 10 Apr 2020 13:56:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3440E10E60DC for ; Fri, 10 Apr 2020 13:56:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 16245185A78E for ; Fri, 10 Apr 2020 13:56:12 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-24-TdT8Gys4PhqtzjWNlPlrfw-1; Fri, 10 Apr 2020 09:56:09 -0400 Received: by mail-wm1-f65.google.com with SMTP id a201so2442756wme.1 for ; Fri, 10 Apr 2020 06:56:09 -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.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527010; 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=VH7BnpD/y6Aqk2I5DPE3neKk2E1Yb3FJNiI8Le18b9I=; b=hDoAVwVvwCLC1xbHwxlN+W/lYZKmiXWhi5E3RJO/1KySJZkWbWYV8wRXOByXDcN3Ckh96p 19DujWf65esHdXTXA1wx9VQiBepFuysJxAKy7DQUCC3FqOMcGqABHNNmJhc3VAfoIFJ8mJ F+nKh3JceLYZ76yjkvR3kYaWRdTVsVc= X-MC-Unique: xH9JjAQfPWm-1cXIFE-n6Q-1 X-MC-Unique: TdT8Gys4PhqtzjWNlPlrfw-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=sDxlu6aCGAlxmOK/71y3nQveS1a4pFYV8NoA6DXbOic=; b=uc3jYDChxCtST8g1dPRfagU9FietZc3Ac9GiEC8eszwYT14Vlnd+yCGbuVqBlDZfDJ re6IX4t4W+v0WJHryBOktCnMK3lj1/IiUjsaA53diJsj+iWaG9+t812wAGTIdTEPLIHx o3l7VOid6AQm/jNfkwbCGHYTzU59kVpC8vw7gWL6LCkw+Yb6OY8vXG2zhTiaLGZ3aufQ XyBeKr7kLfwHD3DxQU1ZYD3opeq9at2dmUSqhAdYERzrPBO7rjwf9h7AasEsmKxHqDVz eVRpTKwblQeNTb9FSEtCrE1CFF8/nl4JSwggadbExiLn42WKJyeRU+iljokNigh+0axn YUzA== X-Gm-Message-State: AGi0PuYzmVbHqCgLUK9W4gmXQWbY9YC1oVoH9YkxSDUm4hMwaT8PyKei O2hvBACspYDPNFSm+34rcHrZfp/0h7E= X-Google-Smtp-Source: APiQypJBHAPiCVh/YWZZybhHXGJuBCq4kc7SlH6clKX+JVLIfFM5q2z8O2YNjy0JeQaKCIXEzsKXsQ== X-Received: by 2002:a7b:ce0b:: with SMTP id m11mr5382017wmc.67.1586526967485; Fri, 10 Apr 2020 06:56:07 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 31/43] remote: convert virMutex to GMutex in daemonClientPrivate Date: Fri, 10 Apr 2020 15:54:58 +0200 Message-Id: <20200410135510.2148319-32-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuCj6023257 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.16 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 --- src/remote/remote_daemon.h | 2 +- src/remote/remote_daemon_dispatch.c | 100 +++++++--------------------- src/remote/remote_daemon_stream.c | 29 ++++---- 3 files changed, 37 insertions(+), 94 deletions(-) diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h index a2d9af4036..5535ce72dd 100644 --- a/src/remote/remote_daemon.h +++ b/src/remote/remote_daemon.h @@ -45,7 +45,7 @@ typedef daemonClientEventCallback *daemonClientEventCallb= ackPtr; /* Stores the per-client connection state */ struct daemonClientPrivate { /* Hold while accessing any data except conn */ - virMutex lock; + GMutex lock; =20 daemonClientEventCallbackPtr *domainEventCallbacks; size_t ndomainEventCallbacks; diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index c5506c2e11..72d30df0c1 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1912,11 +1912,7 @@ void *remoteClientNew(virNetServerClientPtr client, if (VIR_ALLOC(priv) < 0) return NULL; =20 - if (virMutexInit(&priv->lock) < 0) { - VIR_FREE(priv); - virReportSystemError(errno, "%s", _("unable to init mutex")); - return NULL; - } + g_mutex_init(&priv->lock); =20 virNetServerClientSetCloseHook(client, remoteClientCloseFunc); return priv; @@ -2062,9 +2058,9 @@ remoteDispatchConnectOpen(virNetServerPtr server G_GN= UC_UNUSED, const char *type =3D NULL; #endif /* !MODULE_NAME */ bool preserveIdentity =3D false; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 VIR_DEBUG("priv=3D%p conn=3D%p", priv, priv->conn); - virMutexLock(&priv->lock); /* Already opened? */ if (priv->conn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection already= open")); @@ -2193,7 +2189,6 @@ remoteDispatchConnectOpen(virNetServerPtr server G_GN= UC_UNUSED, priv->conn =3D NULL; } } - virMutexUnlock(&priv->lock); return rv; } =20 @@ -3690,8 +3685,7 @@ remoteDispatchAuthSaslInit(virNetServerPtr server G_G= NUC_UNUSED, virNetSASLSessionPtr sasl =3D NULL; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 VIR_DEBUG("Initialize SASL auth %d", virNetServerClientGetFD(client)); if (virNetServerClientGetAuth(client) !=3D VIR_NET_SERVER_SERVICE_AUTH= _SASL || @@ -3736,7 +3730,6 @@ remoteDispatchAuthSaslInit(virNetServerPtr server G_G= NUC_UNUSED, VIR_DEBUG("Available mechanisms for client: '%s'", ret->mechlist); =20 priv->sasl =3D sasl; - virMutexUnlock(&priv->lock); return 0; =20 authfail: @@ -3748,7 +3741,6 @@ remoteDispatchAuthSaslInit(virNetServerPtr server G_G= NUC_UNUSED, "client=3D%p auth=3D%d", client, REMOTE_AUTH_SASL); virObjectUnref(sasl); - virMutexUnlock(&priv->lock); return -1; } =20 @@ -3818,8 +3810,7 @@ remoteDispatchAuthSaslStart(virNetServerPtr server, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); const char *identity; - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 VIR_DEBUG("Start SASL auth %d", virNetServerClientGetFD(client)); if (virNetServerClientGetAuth(client) !=3D VIR_NET_SERVER_SERVICE_AUTH= _SASL || @@ -3872,7 +3863,6 @@ remoteDispatchAuthSaslStart(virNetServerPtr server, ret->complete =3D 1; } =20 - virMutexUnlock(&priv->lock); return 0; =20 authfail: @@ -3895,7 +3885,6 @@ remoteDispatchAuthSaslStart(virNetServerPtr server, virReportError(VIR_ERR_AUTH_FAILED, "%s", _("authentication failed")); virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return -1; } =20 @@ -3914,8 +3903,7 @@ remoteDispatchAuthSaslStep(virNetServerPtr server, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); const char *identity; - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 VIR_DEBUG("Step SASL auth %d", virNetServerClientGetFD(client)); if (virNetServerClientGetAuth(client) !=3D VIR_NET_SERVER_SERVICE_AUTH= _SASL || @@ -3968,7 +3956,6 @@ remoteDispatchAuthSaslStep(virNetServerPtr server, ret->complete =3D 1; } =20 - virMutexUnlock(&priv->lock); return 0; =20 authfail: @@ -3991,7 +3978,6 @@ remoteDispatchAuthSaslStep(virNetServerPtr server, virReportError(VIR_ERR_AUTH_FAILED, "%s", _("authentication failed")); virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return -1; } #else @@ -4056,8 +4042,8 @@ remoteDispatchAuthPolkit(virNetServerPtr server, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); int rv; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 - virMutexLock(&priv->lock); action =3D virNetServerClientGetReadonly(client) ? "org.libvirt.unix.monitor" : "org.libvirt.unix.manage"; @@ -4101,13 +4087,11 @@ remoteDispatchAuthPolkit(virNetServerPtr server, ret->complete =3D 1; =20 virNetServerSetClientAuthenticated(server, client); - virMutexUnlock(&priv->lock); =20 return 0; =20 error: virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return -1; =20 authfail: @@ -4173,8 +4157,7 @@ remoteDispatchConnectRegisterCloseCallback(virNetServ= erPtr server G_GNUC_UNUSED, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -4188,7 +4171,6 @@ remoteDispatchConnectRegisterCloseCallback(virNetServ= erPtr server G_GNUC_UNUSED, rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); return rv; @@ -4204,8 +4186,7 @@ remoteDispatchConnectUnregisterCloseCallback(virNetSe= rverPtr server G_GNUC_UNUSE struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -4218,7 +4199,6 @@ remoteDispatchConnectUnregisterCloseCallback(virNetSe= rverPtr server G_GNUC_UNUSE rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); return rv; @@ -4238,8 +4218,7 @@ remoteDispatchConnectDomainEventRegister(virNetServer= Ptr server G_GNUC_UNUSED, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -4282,7 +4261,6 @@ remoteDispatchConnectDomainEventRegister(virNetServer= Ptr server G_GNUC_UNUSED, rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -4302,8 +4280,7 @@ remoteDispatchConnectDomainEventDeregister(virNetServ= erPtr server G_GNUC_UNUSED, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -4331,7 +4308,6 @@ remoteDispatchConnectDomainEventDeregister(virNetServ= erPtr server G_GNUC_UNUSED, rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); return rv; @@ -4459,8 +4435,7 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -4511,7 +4486,6 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -4535,8 +4509,7 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(v= irNetServerPtr server G_GNU virNetServerClientGetPrivateData(client); virDomainPtr dom =3D NULL; virConnectPtr conn =3D remoteGetHypervisorConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -4587,7 +4560,6 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(v= irNetServerPtr server G_GNU rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -4609,8 +4581,7 @@ remoteDispatchConnectDomainEventDeregisterAny(virNetS= erverPtr server G_GNUC_UNUS struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -4646,7 +4617,6 @@ remoteDispatchConnectDomainEventDeregisterAny(virNetS= erverPtr server G_GNUC_UNUS rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); return rv; @@ -4665,8 +4635,7 @@ remoteDispatchConnectDomainEventCallbackDeregisterAny= (virNetServerPtr server G_G struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -4691,7 +4660,6 @@ remoteDispatchConnectDomainEventCallbackDeregisterAny= (virNetServerPtr server G_G rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); return rv; @@ -6018,8 +5986,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server G_GNUC_UNUSE struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetNetworkConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -6070,7 +6037,6 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server G_GNUC_UNUSE rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -6091,8 +6057,7 @@ remoteDispatchConnectNetworkEventDeregisterAny(virNet= ServerPtr server G_GNUC_UNU struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetNetworkConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -6117,7 +6082,6 @@ remoteDispatchConnectNetworkEventDeregisterAny(virNet= ServerPtr server G_GNUC_UNU rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); return rv; @@ -6139,8 +6103,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server G_GNUC_U virNetServerClientGetPrivateData(client); virStoragePoolPtr pool =3D NULL; virConnectPtr conn =3D remoteGetStorageConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -6191,7 +6154,6 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server G_GNUC_U rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -6211,8 +6173,7 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(vi= rNetServerPtr server G_GNUC struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetStorageConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -6237,7 +6198,6 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(vi= rNetServerPtr server G_GNUC rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); return rv; @@ -6259,8 +6219,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server G_GNUC_UN virNetServerClientGetPrivateData(client); virNodeDevicePtr dev =3D NULL; virConnectPtr conn =3D remoteGetNodeDevConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -6311,7 +6270,6 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server G_GNUC_UN rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -6331,8 +6289,7 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(vir= NetServerPtr server G_GNUC_ struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetNodeDevConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -6357,7 +6314,6 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(vir= NetServerPtr server G_GNUC_ rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); return rv; @@ -6379,8 +6335,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED virNetServerClientGetPrivateData(client); virSecretPtr secret =3D NULL; virConnectPtr conn =3D remoteGetSecretConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -6431,7 +6386,6 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -6451,8 +6405,7 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetS= erverPtr server G_GNUC_UNUS struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetSecretConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -6477,7 +6430,6 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetS= erverPtr server G_GNUC_UNUS rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); return rv; @@ -6500,8 +6452,7 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server G_GNUC_UNUS virDomainPtr dom =3D NULL; const char *event =3D args->event ? *args->event : NULL; virConnectPtr conn =3D remoteGetHypervisorConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -6547,7 +6498,6 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server G_GNUC_UNUS rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -6568,8 +6518,7 @@ qemuDispatchConnectDomainMonitorEventDeregister(virNe= tServerPtr server G_GNUC_UN struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 if (!conn) goto cleanup; @@ -6595,7 +6544,6 @@ qemuDispatchConnectDomainMonitorEventDeregister(virNe= tServerPtr server G_GNUC_UN rv =3D 0; =20 cleanup: - virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); return rv; diff --git a/src/remote/remote_daemon_stream.c b/src/remote/remote_daemon_s= tream.c index 73e4d7befb..11f6d3c14e 100644 --- a/src/remote/remote_daemon_stream.c +++ b/src/remote/remote_daemon_stream.c @@ -119,8 +119,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) virNetServerClientPtr client =3D opaque; daemonClientStream *stream; daemonClientPrivatePtr priv =3D virNetServerClientGetPrivateData(clien= t); - - virMutexLock(&priv->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&priv->lock); =20 stream =3D priv->streams; while (stream) { @@ -132,7 +131,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) if (!stream) { VIR_WARN("event for client=3D%p stream st=3D%p, but missing stream= state", client, st); virStreamEventRemoveCallback(st); - goto cleanup; + return; } =20 VIR_DEBUG("st=3D%p events=3D%d EOF=3D%d closed=3D%d", st, events, stre= am->recvEOF, stream->closed); @@ -142,7 +141,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) if (daemonStreamHandleWrite(client, stream) < 0) { daemonRemoveClientStream(client, stream); virNetServerClientClose(client); - goto cleanup; + return; } } =20 @@ -152,7 +151,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) if (daemonStreamHandleRead(client, stream) < 0) { daemonRemoveClientStream(client, stream); virNetServerClientClose(client); - goto cleanup; + return; } /* If we detected EOF during read processing, * then clear hangup/error conditions, since @@ -177,7 +176,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) virNetMessageFree(msg); daemonRemoveClientStream(client, stream); virNetServerClientClose(client); - goto cleanup; + return; } break; case VIR_NET_ERROR: @@ -187,7 +186,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) virNetMessageFree(msg); daemonRemoveClientStream(client, stream); virNetServerClientClose(client); - goto cleanup; + return; } break; } @@ -206,7 +205,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) if (!(msg =3D virNetMessageNew(false))) { daemonRemoveClientStream(client, stream); virNetServerClientClose(client); - goto cleanup; + return; } msg->cb =3D daemonStreamMessageFinished; msg->opaque =3D stream; @@ -220,7 +219,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) virNetMessageFree(msg); daemonRemoveClientStream(client, stream); virNetServerClientClose(client); - goto cleanup; + return; } } =20 @@ -263,7 +262,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) daemonRemoveClientStream(client, stream); if (ret < 0) virNetServerClientClose(client); - goto cleanup; + return; } =20 if (stream->closed) { @@ -271,9 +270,6 @@ daemonStreamEvent(virStreamPtr st, int events, void *op= aque) } else { daemonStreamUpdateEvents(stream); } - - cleanup: - virMutexUnlock(&priv->lock); } =20 =20 @@ -292,6 +288,7 @@ daemonStreamFilter(virNetServerClientPtr client, { daemonClientStream *stream =3D opaque; int ret =3D 0; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&stream->priv->l= ock); =20 /* We must honour lock ordering here. Client private data lock must * be acquired before client lock. Bu we are already called with @@ -300,7 +297,6 @@ daemonStreamFilter(virNetServerClientPtr client, * implications though. */ stream->refs++; virObjectUnlock(client); - virMutexLock(&stream->priv->lock); virObjectLock(client); =20 if (stream->refs =3D=3D 1) { @@ -332,7 +328,6 @@ daemonStreamFilter(virNetServerClientPtr client, ret =3D 1; =20 cleanup: - virMutexUnlock(&stream->priv->lock); /* Don't pass client here, because client is locked here and this * function might try to lock it again which would result in a * deadlock. */ @@ -460,13 +455,13 @@ int daemonAddClientStream(virNetServerClientPtr clien= t, if (transmit) stream->tx =3D true; =20 - virMutexLock(&priv->lock); + g_mutex_lock(&priv->lock); stream->next =3D priv->streams; priv->streams =3D stream; =20 daemonStreamUpdateEvents(stream); =20 - virMutexUnlock(&priv->lock); + g_mutex_unlock(&priv->lock); =20 return 0; } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586527005; cv=none; d=zohomail.com; s=zohoarc; b=lzKSfLGQShfn7HwKoK4NYgH9sra6PNtvJAf4Fl3uluYGCVuXQRefuBQhQhyvxS601Cq1ugj8l8zKoSEduSSqkswDyLx+uRckAHgr9Bdzds0BMQFK9epSfHdqezGyqoLi72sjplgW/lWmYVEMJnSa0WLudoug6M3wQ4YEqywouXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527005; 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=az+vtSXsYahQCkGVI3ASZobz1imiBJqtb+IYjQiVF+I=; b=eM1WeQjWANEt3wN1MGYxxsn7Ry5ilF7qFjt4uhX6W5PF39WZOl6FQCtf4aITPZV2y35tXMm7o2sPgBFVRyu9AiVCVJnbWSXXS590Dqb3kveU8Q7KBVe+CWNXdTAezvGadTcr1bOC5Ws+oV72fvwDLlQBTb8opy0neBsTP3IC0vw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586527005715915.4098043459146; Fri, 10 Apr 2020 06:56:45 -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-34-Xd2c-RDKNJCmmE8Qf4Y0Og-1; Fri, 10 Apr 2020 09:56:42 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9318BDB31; Fri, 10 Apr 2020 13:56:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67455101E81C; Fri, 10 Apr 2020 13:56:36 +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 2481218033C7; Fri, 10 Apr 2020 13:56:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuCqu023267 for ; Fri, 10 Apr 2020 09:56:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id D7A6E10E60DD; Fri, 10 Apr 2020 13:56:12 +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 D3DEC10E60DC for ; Fri, 10 Apr 2020 13:56:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 BA1388FF663 for ; Fri, 10 Apr 2020 13:56:12 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-89-ltqhVDBoOAW66jvAtf-pvw-1; Fri, 10 Apr 2020 09:56:10 -0400 Received: by mail-wr1-f66.google.com with SMTP id k11so1758725wrp.5 for ; Fri, 10 Apr 2020 06:56:10 -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.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527004; 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=az+vtSXsYahQCkGVI3ASZobz1imiBJqtb+IYjQiVF+I=; b=Ve+NC76C6Cs6oIsi4tItO1g8bq0lbPkQKqcpijq1nqC3nydolFcwLiH9i/Fu+KmpgiEfCm Hiu88x4Dsx2RQMsknoWyYa9yMnS1JyAzyuJC98s7SO1o87iYOiR69F2svny92hfawdSn1H LVNTTqD5bmFqloBzMOJ2iHgo5/nepLI= X-MC-Unique: Xd2c-RDKNJCmmE8Qf4Y0Og-1 X-MC-Unique: ltqhVDBoOAW66jvAtf-pvw-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=21skij/k2nJtHe9W0TkXq9F0xYG5wklTWMiQf86219Q=; b=T1h1tTVOG5R/1TuIkp7IpEDTzIO9TkvcBVJxqG0KOSRz474K91BZDMgcRXN69GAgFB qiOmtioV+ngKpaxu5mW1l2qy/j1H6B3hUZc4sEN+aUdJK5E0eoI7dhVuiKk3VcQj7VFV TzQ3Fmb1jv1BmyhIbxBwh00TVi9zWlfTsscsN/6pBEIaezNi9XI7p92FM+X43yQ1rVgw bOLuDX78yBVuVwxkDYyQcPZiRHGEw0Chll8f83LB/k5Eln2a3FqeyRRvEvyGXyhePV0Y iy6atKADFruygxcHI0eGxwNM1MJbO2xQVVGcGIDznTCAfaWq3gTiE4uQ7RcQnc7JYxDr of+A== X-Gm-Message-State: AGi0PuZRfu30n788U0zx27F6olpHqWs0KSpD9kdKybEyuwqIqhqA/JNv p1dDG4nQH23NWkFNF4tNnuT59f0W4Os= X-Google-Smtp-Source: APiQypIFRTFeJYvLeBJEUYvwJld768g5bcCTCmqUyNX5TVWIb8BqDHuFvKLfvkXG/ByiY2mDcFZjug== X-Received: by 2002:a5d:6850:: with SMTP id o16mr4575883wrw.309.1586526968889; Fri, 10 Apr 2020 06:56:08 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 32/43] util: virfirewall: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:54:59 +0200 Message-Id: <20200410135510.2148319-33-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuCqu023267 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.84 on 10.5.11.22 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 --- src/util/virfirewall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 22760e6389..3bf85020af 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -83,7 +83,7 @@ struct _virFirewall { }; =20 static virFirewallBackend currentBackend =3D VIR_FIREWALL_BACKEND_AUTOMATI= C; -static virMutex ruleLock =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE_STATIC(ruleLock); =20 static int virFirewallValidateBackend(virFirewallBackend backend); @@ -807,7 +807,7 @@ virFirewallApply(virFirewallPtr firewall) size_t i, j; int ret =3D -1; =20 - virMutexLock(&ruleLock); + G_LOCK(ruleLock); =20 if (currentBackend =3D=3D VIR_FIREWALL_BACKEND_AUTOMATIC) { /* a specific backend should have been set when the firewall @@ -863,6 +863,6 @@ virFirewallApply(virFirewallPtr firewall) =20 ret =3D 0; cleanup: - virMutexUnlock(&ruleLock); + G_UNLOCK(ruleLock); return ret; } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586527014; cv=none; d=zohomail.com; s=zohoarc; b=BLPHk2vkwxC3y7Y2iwMW89g1lmfLS3SYCTPORkrnn4jkGSmU+kfcJLW9lrnzTa3Nyy9tFAXkUAUEtu9w2y0AeoWSOZlsK6hCrY5knzKVSVWgi6Vumc+TAJYBmZTaIxX9SnY5WSW29O0hJaf8iKg7+lOfL4qesPUv4Srd84NSBW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527014; 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=nQ3HaFjpZrD3vJHU7NP2aAZGDBsAou54rOQfkfWY1Jc=; b=SIm1jszra7BvSSh4+B7DtVV/fBA8ZdP2L83KGgi89IXK1g+9Ut8MZdIBIGfikwu1p2RN0W3MavFNPftXyWIQT4H5WVXOdg3HJZqsbo1pg4SgxgoZ4EJIp1tDHizAkLuYrKxLnN36RBtT9de3KqJGspwHoGPtsZUXzq/SSrHqC7g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586527014816400.84538384121527; Fri, 10 Apr 2020 06:56:54 -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-210-tlTEUvukO1mwfVx_gbjKPw-1; Fri, 10 Apr 2020 09:56:51 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 93E55113784B; Fri, 10 Apr 2020 13:56:44 +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 374171036B5C; Fri, 10 Apr 2020 13:56:44 +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 DAE4093096; Fri, 10 Apr 2020 13:56:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuEQD023283 for ; Fri, 10 Apr 2020 09:56:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5B08F200AFD4; Fri, 10 Apr 2020 13:56:14 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 568902014DFA for ; Fri, 10 Apr 2020 13:56:14 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 37B18101A55D for ; Fri, 10 Apr 2020 13:56:14 +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-205-d4e8GR1_MtCygMalZ9oNrQ-1; Fri, 10 Apr 2020 09:56:11 -0400 Received: by mail-wr1-f67.google.com with SMTP id f13so2345666wrm.13 for ; Fri, 10 Apr 2020 06:56:11 -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.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527013; 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=nQ3HaFjpZrD3vJHU7NP2aAZGDBsAou54rOQfkfWY1Jc=; b=cO+CWgVoD1nmHTnGvtz8K1z9HBm/HvKmBx8RPYZ/Ucq81JXjVgSx8vi3v+3BiiuaURDhZw xhytHCi9SqF7EUh20fv0CXee2aycIgNui4izDUwiYIJkFWcrBOWMwNTrFzcJrSpMNApn6p z8DFM+Kx1o5jryrB2ZCNBr/t4GOH640= X-MC-Unique: tlTEUvukO1mwfVx_gbjKPw-1 X-MC-Unique: d4e8GR1_MtCygMalZ9oNrQ-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=gLX6nTUlGEWxtnYM/gTg5AXYkwgyO1sbx33xVydi5fE=; b=F2iP6zH3Mtjlhxqzg2tWzeNnzxo/N8yuJdd7B6ZITiI+TUnpUfQsT1WH4ae5Wk23RS roEAYU8rZ+S1Jb60CzS0C5y5yFn0OfYuKJ8NCle4xqPAUvGze3gAC+D+LxG51dCv338n k13FD2fBQTDMzVkrf92IrZqC+6AlHP/D54vlWY21SMcqGOX26V7h1SnVD6HXoRQkhvsp qdHlVTVVXOnyqxly8d9XcxlhW888DXblxEAY+tYUctXnWVakViEH6KVr0RZ+s8LwsCDt PlNrncRRN2ycmFmcNU2SozErUJ5p0SFhUTljk0MKZIadzXx9MJ6+jQlAo4NF+KlC7LTj iIMw== X-Gm-Message-State: AGi0PuaAU7eQW1UwXzes+b1OWF2VL6IGL8qSdxKgkUvONHTzlEf4xrMp MEoIqCuLmy+m2XiHHoBL6YDNxaXQTZY= X-Google-Smtp-Source: APiQypK//C0VR5HxN+9jP3QkxlUsm+KXwIOHuASjXCQr6pVXFMmT5GmMYHzz3bJMOw4dXSd+2pD1rw== X-Received: by 2002:a5d:4c87:: with SMTP id z7mr5097264wrs.39.1586526970359; Fri, 10 Apr 2020 06:56:10 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 33/43] util: virlockspace: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:55:00 +0200 Message-Id: <20200410135510.2148319-34-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.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuEQD023283 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.84 on 10.5.11.22 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 --- src/util/virlockspace.c | 83 +++++++++++------------------------------ 1 file changed, 22 insertions(+), 61 deletions(-) diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index 9a54192cd1..c29d6f37fe 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -56,7 +56,7 @@ struct _virLockSpaceResource { =20 struct _virLockSpace { char *dir; - virMutex lock; + GMutex lock; =20 virHashTablePtr resources; }; @@ -244,12 +244,7 @@ virLockSpacePtr virLockSpaceNew(const char *directory) if (VIR_ALLOC(lockspace) < 0) return NULL; =20 - if (virMutexInit(&lockspace->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize lockspace mutex")); - VIR_FREE(lockspace); - return NULL; - } + g_mutex_init(&lockspace->lock); =20 lockspace->dir =3D g_strdup(directory); =20 @@ -295,12 +290,7 @@ virLockSpacePtr virLockSpaceNewPostExecRestart(virJSON= ValuePtr object) if (VIR_ALLOC(lockspace) < 0) return NULL; =20 - if (virMutexInit(&lockspace->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize lockspace mutex")); - VIR_FREE(lockspace); - return NULL; - } + g_mutex_init(&lockspace->lock); =20 if (!(lockspace->resources =3D virHashCreate(VIR_LOCKSPACE_TABLE_SIZE, virLockSpaceResourceDataFre= e))) @@ -430,8 +420,7 @@ virJSONValuePtr virLockSpacePreExecRestart(virLockSpace= Ptr lockspace) virJSONValuePtr object =3D virJSONValueNewObject(); virJSONValuePtr resources; virHashKeyValuePairPtr pairs =3D NULL, tmp; - - virMutexLock(&lockspace->lock); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&lockspace->lock= ); =20 if (lockspace->dir && virJSONValueObjectAppendString(object, "directory", lockspace->dir= ) < 0) @@ -491,13 +480,11 @@ virJSONValuePtr virLockSpacePreExecRestart(virLockSpa= cePtr lockspace) } VIR_FREE(pairs); =20 - virMutexUnlock(&lockspace->lock); return object; =20 error: VIR_FREE(pairs); virJSONValueFree(object); - virMutexUnlock(&lockspace->lock); return NULL; } =20 @@ -509,7 +496,7 @@ void virLockSpaceFree(virLockSpacePtr lockspace) =20 virHashFree(lockspace->resources); VIR_FREE(lockspace->dir); - virMutexDestroy(&lockspace->lock); + g_mutex_clear(&lockspace->lock); VIR_FREE(lockspace); } =20 @@ -525,11 +512,10 @@ int virLockSpaceCreateResource(virLockSpacePtr locksp= ace, { int ret =3D -1; char *respath =3D NULL; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&lockspace->lock= ); =20 VIR_DEBUG("lockspace=3D%p resname=3D%s", lockspace, resname); =20 - virMutexLock(&lockspace->lock); - if (virHashLookup(lockspace->resources, resname) !=3D NULL) { virReportError(VIR_ERR_RESOURCE_BUSY, _("Lockspace resource '%s' is locked"), @@ -546,7 +532,6 @@ int virLockSpaceCreateResource(virLockSpacePtr lockspac= e, ret =3D 0; =20 cleanup: - virMutexUnlock(&lockspace->lock); VIR_FREE(respath); return ret; } @@ -557,11 +542,10 @@ int virLockSpaceDeleteResource(virLockSpacePtr locksp= ace, { int ret =3D -1; char *respath =3D NULL; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&lockspace->lock= ); =20 VIR_DEBUG("lockspace=3D%p resname=3D%s", lockspace, resname); =20 - virMutexLock(&lockspace->lock); - if (virHashLookup(lockspace->resources, resname) !=3D NULL) { virReportError(VIR_ERR_RESOURCE_BUSY, _("Lockspace resource '%s' is locked"), @@ -583,7 +567,6 @@ int virLockSpaceDeleteResource(virLockSpacePtr lockspac= e, ret =3D 0; =20 cleanup: - virMutexUnlock(&lockspace->lock); VIR_FREE(respath); return ret; } @@ -594,8 +577,8 @@ int virLockSpaceAcquireResource(virLockSpacePtr lockspa= ce, pid_t owner, unsigned int flags) { - int ret =3D -1; virLockSpaceResourcePtr res; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&lockspace->lock= ); =20 VIR_DEBUG("lockspace=3D%p resname=3D%s flags=3D0x%x owner=3D%lld", lockspace, resname, flags, (unsigned long long)owner); @@ -603,38 +586,31 @@ int virLockSpaceAcquireResource(virLockSpacePtr locks= pace, virCheckFlags(VIR_LOCK_SPACE_ACQUIRE_SHARED | VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE, -1); =20 - virMutexLock(&lockspace->lock); - if ((res =3D virHashLookup(lockspace->resources, resname))) { if ((res->flags & VIR_LOCK_SPACE_ACQUIRE_SHARED) && (flags & VIR_LOCK_SPACE_ACQUIRE_SHARED)) { =20 if (VIR_EXPAND_N(res->owners, res->nOwners, 1) < 0) - goto cleanup; + return -1; res->owners[res->nOwners-1] =3D owner; =20 - goto done; + return 0; } virReportError(VIR_ERR_RESOURCE_BUSY, _("Lockspace resource '%s' is locked"), resname); - goto cleanup; + return -1; } =20 if (!(res =3D virLockSpaceResourceNew(lockspace, resname, flags, owner= ))) - goto cleanup; + return -1; =20 if (virHashAddEntry(lockspace->resources, resname, res) < 0) { virLockSpaceResourceFree(res); - goto cleanup; + return -1; } =20 - done: - ret =3D 0; - - cleanup: - virMutexUnlock(&lockspace->lock); - return ret; + return 0; } =20 =20 @@ -642,20 +618,18 @@ int virLockSpaceReleaseResource(virLockSpacePtr locks= pace, const char *resname, pid_t owner) { - int ret =3D -1; virLockSpaceResourcePtr res; size_t i; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&lockspace->lock= ); =20 VIR_DEBUG("lockspace=3D%p resname=3D%s owner=3D%lld", lockspace, resname, (unsigned long long)owner); =20 - virMutexLock(&lockspace->lock); - if (!(res =3D virHashLookup(lockspace->resources, resname))) { virReportError(VIR_ERR_RESOURCE_BUSY, _("Lockspace resource '%s' is not locked"), resname); - goto cleanup; + return -1; } =20 for (i =3D 0; i < res->nOwners; i++) { @@ -667,20 +641,16 @@ int virLockSpaceReleaseResource(virLockSpacePtr locks= pace, virReportError(VIR_ERR_INTERNAL_ERROR, _("owner %lld does not hold the resource lock"), (unsigned long long)owner); - goto cleanup; + return -1; } =20 VIR_DELETE_ELEMENT(res->owners, i, res->nOwners); =20 if ((res->nOwners =3D=3D 0) && virHashRemoveEntry(lockspace->resources, resname) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - virMutexUnlock(&lockspace->lock); - return ret; + return 0; } =20 =20 @@ -726,26 +696,17 @@ virLockSpaceRemoveResourcesForOwner(const void *paylo= ad, int virLockSpaceReleaseResourcesForOwner(virLockSpacePtr lockspace, pid_t owner) { - int ret =3D 0; struct virLockSpaceRemoveData data =3D { owner, 0 }; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&lockspace->lock= ); =20 VIR_DEBUG("lockspace=3D%p owner=3D%lld", lockspace, (unsigned long lon= g)owner); =20 - virMutexLock(&lockspace->lock); - if (virHashRemoveSet(lockspace->resources, virLockSpaceRemoveResourcesForOwner, &data) < 0) - goto error; + return -1; =20 - ret =3D data.count; - - virMutexUnlock(&lockspace->lock); - return ret; - - error: - virMutexUnlock(&lockspace->lock); - return -1; + return data.count; } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1586527008; cv=none; d=zohomail.com; s=zohoarc; b=bCc+GgbglMJvY4fn41PzGd7890P0jCPuP4fWbmOHrSVQA8aY35B1mCynzjfZwacr4N+EdrS8LKGHqZKUpez/gBb2acx0+357lwlE6Mwr6A4exe8ofT133mYIifakwUfFLa9qQSlho4Lp9x9x+FJFC/btyO90owH3KDcVmNf4euI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527008; 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=abE93r+qBScpcV44zy6IaSLW2wC0MVgqEwC3mTcxkuw=; b=b/ZOE/kaw2MZC+JsvvyCzkdOvwfZgh4SzGGkmSmQzgNScNCZia/bNlP9pQpVmrZ654+LdIQjBdT5FFheQFCzE9ggkDL1HpSNipiwxno1sCc8GxfKDP6LgiyOwckcFGhX3nqUoFulX7hA/G3dzPEP0lhd+gXjKvUL/L9yETrttCo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586527008337457.0575698808042; Fri, 10 Apr 2020 06:56:48 -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-284-FE3tpWvHME6zRwKk32JiFg-1; Fri, 10 Apr 2020 09:56:45 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 86452106BBDD; Fri, 10 Apr 2020 13:56:39 +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 59C859E0D9; Fri, 10 Apr 2020 13:56:39 +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 0DF4793098; Fri, 10 Apr 2020 13:56:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuJ0b023326 for ; Fri, 10 Apr 2020 09:56:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 76E232166B38; Fri, 10 Apr 2020 13:56:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72D5A2166B35 for ; Fri, 10 Apr 2020 13:56:15 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 BD600185A78E for ; Fri, 10 Apr 2020 13:56:15 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-60-BEGEKBwWOjWXHRAPGG6QEQ-1; Fri, 10 Apr 2020 09:56:13 -0400 Received: by mail-wm1-f67.google.com with SMTP id y24so2805777wma.4 for ; Fri, 10 Apr 2020 06:56:12 -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.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527007; 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=abE93r+qBScpcV44zy6IaSLW2wC0MVgqEwC3mTcxkuw=; b=SAXx/MVKMloNY3Dq9kRN/lnPTdDPreN43onKbvgM5kP0jnEZn7ppHVcuWkuUccWEvKolA4 j+WzWWkEwl7L/2uAHXA1Rik+aB0710b4K5b7acV6vygNWeJ8i2BmyiMT8zJy79cHOAws1p FA7TSwiJvt6TxI1K8aRYCV0JhxyRsZk= X-MC-Unique: FE3tpWvHME6zRwKk32JiFg-1 X-MC-Unique: BEGEKBwWOjWXHRAPGG6QEQ-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=wYXOZ/A2AA7I1wKx8DjFaxxQaKEO8Df5KN8VZOrjs4M=; b=gguOzeM8SrIh0227fZpsljzkfZNvsBJ4SKSrI+qkArziT0+xc/zsAUEkJnFLGsRqyL CPy4+q6+2P3y9RYEXEYYYbu6X3FjhmEhf4iF4Jo+JQjli2bWrEHnxRfEaCSGmtjpWL9S Ly2OVeFoPx8PuP+erEnNAPhPQn+BEh0CJ4AUX2W6oYvkoiIQrxba8ORNV+LykuVVKkG2 bS235I8Cby7hAa586ZAdM12Waj5PtP4sKtkVkbmXIhQCwSawXZOvXMknlOPjps6aB1Z1 eMe+JdggKY7/8lyP9syjHSD1asKtuEsTtmQrjP0onTjHMkkDNqaNHYEUbEFNK4bek9Oy GrPg== X-Gm-Message-State: AGi0PuYC+7vGd6KJgtqI8UAawqJIYgXaVCvxjK+wyjwd+b/NkPBcjAX7 7vl+oxBgP0Kc8NEHjn6LvQK356knU3E= X-Google-Smtp-Source: APiQypLCMLAOUW+hsnSByZULHQkOEGMImnaiCGHcVeiBnglMLEZG2jWLnd6RFlZ7qzLWqcGVlJDMwA== X-Received: by 2002:a1c:5448:: with SMTP id p8mr5137223wmi.173.1586526971743; Fri, 10 Apr 2020 06:56:11 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 34/43] util: virnetdevmacvlan: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:55:01 +0200 Message-Id: <20200410135510.2148319-35-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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuJ0b023326 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.13 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 --- src/util/virnetdevmacvlan.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index dcea93a5fe..bcdb2322b5 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -71,7 +71,7 @@ VIR_LOG_INIT("util.netdevmacvlan"); =20 # define MACVLAN_MAX_ID 8191 =20 -virMutex virNetDevMacVLanCreateMutex =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE(virNetDevMacVLanCreateMutex); virBitmapPtr macvtapIDs =3D NULL; virBitmapPtr macvlanIDs =3D NULL; =20 @@ -951,10 +951,10 @@ virNetDevMacVLanCreateWithVPortProfile(const char *if= nameRequested, STRPREFIX(ifnameRequested, VIR_NET_GENERATED_MACVLAN_PREFIX= )); =20 VIR_INFO("Requested macvtap device name: %s", ifnameRequested); - virMutexLock(&virNetDevMacVLanCreateMutex); + G_LOCK(virNetDevMacVLanCreateMutex); =20 if ((rc =3D virNetDevExists(ifnameRequested)) < 0) { - virMutexUnlock(&virNetDevMacVLanCreateMutex); + G_UNLOCK(virNetDevMacVLanCreateMutex); return -1; } if (rc) { @@ -963,7 +963,7 @@ virNetDevMacVLanCreateWithVPortProfile(const char *ifna= meRequested, virReportSystemError(EEXIST, _("Unable to create %s device %s"), type, ifnameRequested); - virMutexUnlock(&virNetDevMacVLanCreateMutex); + G_UNLOCK(virNetDevMacVLanCreateMutex); return -1; } if (isAutoName && @@ -979,28 +979,28 @@ virNetDevMacVLanCreateWithVPortProfile(const char *if= nameRequested, reservedID =3D -1; goto create_name; } - virMutexUnlock(&virNetDevMacVLanCreateMutex); + G_UNLOCK(virNetDevMacVLanCreateMutex); return -1; } /* virNetDevMacVLanCreate() was successful - use this name */ ifnameCreated =3D ifnameRequested; create_name: - virMutexUnlock(&virNetDevMacVLanCreateMutex); + G_UNLOCK(virNetDevMacVLanCreateMutex); } =20 retries =3D MACVLAN_MAX_ID; while (!ifnameCreated && retries) { - virMutexLock(&virNetDevMacVLanCreateMutex); + G_LOCK(virNetDevMacVLanCreateMutex); reservedID =3D virNetDevMacVLanReserveID(reservedID, flags, false,= true); if (reservedID < 0) { - virMutexUnlock(&virNetDevMacVLanCreateMutex); + G_UNLOCK(virNetDevMacVLanCreateMutex); return -1; } g_snprintf(ifname, sizeof(ifname), pattern, reservedID); if (virNetDevMacVLanCreate(ifname, type, macaddress, linkdev, macvtapMode, &do_retry) < 0) { virNetDevMacVLanReleaseID(reservedID, flags); - virMutexUnlock(&virNetDevMacVLanCreateMutex); + G_UNLOCK(virNetDevMacVLanCreateMutex); if (!do_retry) return -1; VIR_INFO("Device %s wasn't reserved but already existed, skipp= ing", @@ -1009,7 +1009,7 @@ virNetDevMacVLanCreateWithVPortProfile(const char *if= nameRequested, continue; } ifnameCreated =3D ifname; - virMutexUnlock(&virNetDevMacVLanCreateMutex); + G_UNLOCK(virNetDevMacVLanCreateMutex); } =20 if (!ifnameCreated) { --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586527013; cv=none; d=zohomail.com; s=zohoarc; b=GaFGU0vcJNDkTJZRN3gOhq6NNJ2UcqWJVobHXP3ae0zY8qM3FVrCiYpNH2/WRwXhF0f1lajDG1QYgwEbC0yYQconsmAm47TasqLN3KJ94q8ABPUHJH9Dn1iitpZm68kq0HPnJVpy9/IGD2/HlBxO0/1LJQmv5n4ylO6nHVMKPsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527013; 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=Z0c1Z0KH8NiELQ70JpIZKYg5CmDVSL1oqGc0BB/1fS8=; b=LCWwaSVPjPmvcK1z4WkuePCGDW1lZkgV82hFcFzMuccvZiK3m3DG/gqoQ+5G8ddmi909Jq/CjVB33bjcWMUP11RqklD+n7VGHe+htq8Ql85N2F89KnpMxzu8+9RPF8cf7mzrija6pOcaZYmCua1qcL2PPn2UVvA1YKS/EAkhjsI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586527013804488.4599184041441; Fri, 10 Apr 2020 06:56:53 -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-436-WNATsS3gPjyfm0JecyWNnQ-1; Fri, 10 Apr 2020 09:56:49 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F8A6DB3D; Fri, 10 Apr 2020 13:56:40 +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 EA92A953D6; Fri, 10 Apr 2020 13:56:39 +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 8F8F393F42; Fri, 10 Apr 2020 13:56:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuJ6R023318 for ; Fri, 10 Apr 2020 09:56:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 08EFF10E60DD; Fri, 10 Apr 2020 13:56:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04FC410E60DC for ; Fri, 10 Apr 2020 13:56:17 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 1B02B802D2C for ; Fri, 10 Apr 2020 13:56:17 +0000 (UTC) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-208-XEh1aTtwN3647FeFYixNug-1; Fri, 10 Apr 2020 09:56:14 -0400 Received: by mail-wr1-f68.google.com with SMTP id c15so2354031wro.11 for ; Fri, 10 Apr 2020 06:56:14 -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.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527012; 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=Z0c1Z0KH8NiELQ70JpIZKYg5CmDVSL1oqGc0BB/1fS8=; b=Mrpm8J+yBfrIGZkolrwM+DNuMcR8rgGnyV9hMa2gjuUY5anXCDdu13YO4hwP3IuaKbkpr+ //9cNmbYKjGTOtHz/Bjg91h6xsYH1Mfnbnibue99x8AnFENO8f0E53vb7tzQ1KzTuBe8a9 GcNasx06uV20PfAShWt90SifSw/1OqU= X-MC-Unique: WNATsS3gPjyfm0JecyWNnQ-1 X-MC-Unique: XEh1aTtwN3647FeFYixNug-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=BhwKP2rQTgW+dd+86cgPKwX6cL/d7RboEIOEgawuURg=; b=Z6zqtkpRuCf82gN8JrhB+hwboUaeWO71y42qkUBLulNBhND4jQfMQM/vosMHdraZs2 ksKLYCT84cXm6aoxjNUVEuwtX78OTLMx0lK6gVW4o2jiYWi6K2esMLhKe7+VrwbIXwL4 2GkMB4HXnMep7abASy1EsGmMDsd8BugjIHWvsPfnGrLTTGUeQnvYSR31hgMB+DEG1z8f sGyRMmZoqlCEufQWqmf/nQxf0bki1vPoQuGrljSqjML+Id9prhbeY7C4BvfrL/eponK2 P1bTRKI+xNBOeKUCkRYzfztu0ns1HApurFEm+WhlvlQMO1MsU5woF4eTU7eqRKFebIUw EOTA== X-Gm-Message-State: AGi0PuZD1TjhhJenu+omzB3uG14O6Uf3CPrbXSrpMdrFQtRPHBqLxIAi Be53VFhsCLv/g0F/DhzWy/iBjkb2H6Q= X-Google-Smtp-Source: APiQypK8mzESEe4hEUgPiv6N9oP71M1oWDsx43hnrpPjKYJtdCo8YIq2mpg9GPBvMUqMgk30RauGaQ== X-Received: by 2002:a5d:6204:: with SMTP id y4mr5036861wru.410.1586526972966; Fri, 10 Apr 2020 06:56:12 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 35/43] util: virnetdevveth: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:55:02 +0200 Message-Id: <20200410135510.2148319-36-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuJ6R023318 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.15 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 --- src/util/virnetdevveth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c index b3eee1afce..d1fc4c372d 100644 --- a/src/util/virnetdevveth.c +++ b/src/util/virnetdevveth.c @@ -34,7 +34,7 @@ VIR_LOG_INIT("util.netdevveth"); =20 /* Functions */ =20 -virMutex virNetDevVethCreateMutex =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE(virNetDevVethCreateMutex); =20 static int virNetDevVethExists(int devNum) { @@ -110,7 +110,7 @@ int virNetDevVethCreate(char** veth1, char** veth2) * We might race with other containers, but this is reasonably * unlikely, so don't do too many retries for device creation */ - virMutexLock(&virNetDevVethCreateMutex); + G_LOCK(virNetDevVethCreateMutex); #define MAX_VETH_RETRIES 10 =20 for (i =3D 0; i < MAX_VETH_RETRIES; i++) { @@ -171,7 +171,7 @@ int virNetDevVethCreate(char** veth1, char** veth2) MAX_VETH_RETRIES); =20 cleanup: - virMutexUnlock(&virNetDevVethCreateMutex); + G_UNLOCK(virNetDevVethCreateMutex); return ret; } =20 --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1586527014; cv=none; d=zohomail.com; s=zohoarc; b=Vn3MTTvc7OfXWWWOTR3vwQz01FWUUgV9N/PvV7IBlpZUbq/HXozkXMV0JG0IkLyOjR06aKo8LPvs7ve2UJBhQ5rAWXiM/OWU36NVZtQ9A1xXsXR+tsqcBtDIjSVy0Ym7yZJGxTKaVG+DIj5M9dtWx1ARp+eVfwteIK5KCE8tEbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527014; 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=qFOQAhndEMiklY+mCz3RsP+bmr2uTDG7ntZiu7EhMXY=; b=OVt0ZXFTQljcIPWiKu8qMs06ceGis/PVkuJLwSgmAGJNmBioJWCJAQOVipa9q01JFG3TY7yfpHRIVbnz9I1jH3WkIs7vIcddHtAo6ycQ8wYn9dtJqGgPqNMyM5PRxLtA0uX3XLmCvzP01kC+SU3RHZys+h2WmrbjczZWsskioaM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586527014305788.1777372992249; Fri, 10 Apr 2020 06:56:54 -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-18-7JjVo_JuPUKGsSMzObb-bg-1; Fri, 10 Apr 2020 09:56:50 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B98ED1137855; Fri, 10 Apr 2020 13:56:44 +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 DF7251036D3F; Fri, 10 Apr 2020 13:56:43 +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 84F5593F44; Fri, 10 Apr 2020 13:56:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuM3Q023352 for ; Fri, 10 Apr 2020 09:56:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 804E2200AFD4; Fri, 10 Apr 2020 13:56:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C09C202A940 for ; Fri, 10 Apr 2020 13:56:17 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 C9646101A55A for ; Fri, 10 Apr 2020 13:56:17 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-511-n8SUlfxYMOGlsoM7Yk46og-1; Fri, 10 Apr 2020 09:56:15 -0400 Received: by mail-wm1-f67.google.com with SMTP id v8so4844537wma.0 for ; Fri, 10 Apr 2020 06:56:15 -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.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527013; 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=qFOQAhndEMiklY+mCz3RsP+bmr2uTDG7ntZiu7EhMXY=; b=AS/lqVK/DWP+EnFWgAYqHilTZ9Wi9gTrvD2P16izrfhEaBl1ab1RSDZxjBzp79hyOrtJc1 XwtV2jgWcg5PgAj+NAyi35ABSmxa0T6QJyY3U8cq/JgAUAvcEkbJw0PEia4MRhFQ6VrFMz +k/iokNPeGRkTV6fIvpOEDTP5ccq6/U= X-MC-Unique: 7JjVo_JuPUKGsSMzObb-bg-1 X-MC-Unique: n8SUlfxYMOGlsoM7Yk46og-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=f0wist+St9EOrdH3OnXqXRC+KtlR+/f2X8CLjB/Fots=; b=A6atyN5nFZRA9jlQfsORPTryvEGKOMnQFGG+TISq05bAelYWpwzTGHkzUZp+c0dz8t KrxEW0rqo/SXnFGdpjU4NOSxAvnaebiTXwnblWm8gjLbwu1fqf773GfJxcM+PfrbyRmm RaOHCvPjnAnpQriaZxTIOzg8mj4qGE1kC80xBLARY6TdtisW5AfAQokMrN4brWTZ9MVR Y3Egb8TSQ+QYAIKnVZmWOXHcKoTsqtmoK8VdSKICr6Vnjx34bqBL8ZW2u51rVomZ1SpW xzgZXweVTqxKPlsI+KrAqfHQZ8EBCDh3juuwQljnvOnefuL/ARvbGJDnibuxkmO7P7Y5 06Hw== X-Gm-Message-State: AGi0PuYjp54jUslNfhzywsOvuuG0OfQXconCPsTYT09/DqygpoiVrPFP UW9zxPvOEyXGuuYCW6r5GcFrIBYgoNk= X-Google-Smtp-Source: APiQypLR+bJ/9PAjd8MphvMnvGxnbtsLN5arwKoMH2A9Xn2uUAMdHNF/HJ29SzM4e+jB5hNCKEj6mg== X-Received: by 2002:a05:600c:210c:: with SMTP id u12mr5472604wml.135.1586526974221; Fri, 10 Apr 2020 06:56:14 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 36/43] util: virnetlink: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:55:03 +0200 Message-Id: <20200410135510.2148319-37-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.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuM3Q023352 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.84 on 10.5.11.22 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 --- src/util/virnetlink.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c index 3117dcbe65..e9f2c273d9 100644 --- a/src/util/virnetlink.c +++ b/src/util/virnetlink.c @@ -62,7 +62,7 @@ typedef struct _virNetlinkEventSrvPrivate virNetlinkEvent= SrvPrivate; typedef virNetlinkEventSrvPrivate *virNetlinkEventSrvPrivatePtr; struct _virNetlinkEventSrvPrivate { /* Server */ - virMutex lock; + GMutex lock; int eventwatch; int netlinkfd; virNetlinkHandle *netlinknh; @@ -791,13 +791,13 @@ virNetlinkGetErrorCode(struct nlmsghdr *resp, unsigne= d int recvbuflen) static void virNetlinkEventServerLock(virNetlinkEventSrvPrivatePtr driver) { - virMutexLock(&driver->lock); + g_mutex_lock(&driver->lock); } =20 static void virNetlinkEventServerUnlock(virNetlinkEventSrvPrivatePtr driver) { - virMutexUnlock(&driver->lock); + g_mutex_unlock(&driver->lock); } =20 /** @@ -916,7 +916,7 @@ virNetlinkEventServiceStop(unsigned int protocol) VIR_FREE(srv->handles); virNetlinkEventServerUnlock(srv); =20 - virMutexDestroy(&srv->lock); + g_mutex_clear(&srv->lock); VIR_FREE(srv); return 0; } @@ -1017,10 +1017,7 @@ virNetlinkEventServiceStart(unsigned int protocol, u= nsigned int groups) if (VIR_ALLOC(srv) < 0) return -1; =20 - if (virMutexInit(&srv->lock) < 0) { - VIR_FREE(srv); - return -1; - } + g_mutex_init(&srv->lock); =20 virNetlinkEventServerLock(srv); =20 @@ -1070,7 +1067,7 @@ virNetlinkEventServiceStart(unsigned int protocol, un= signed int groups) error_locked: virNetlinkEventServerUnlock(srv); if (ret < 0) { - virMutexDestroy(&srv->lock); + g_mutex_clear(&srv->lock); VIR_FREE(srv); } return ret; --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586527017; cv=none; d=zohomail.com; s=zohoarc; b=NrvYajaWWn0Z9+KZsQt0p8CVYOV7jv4yNla49VhxOVdBoh8yEYOVobnxbGtj2tLA+47hC4szY5zFfxg3rTTkM6oSPxOzka+2GfvFOO7ae9fAFR+s0el4tEdKxbzDlwEBOYTBrdGZDZW8MqytU+uwRmsaLaGrFepr1WhVjNNcoxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527017; 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=qwrb93QA0vZdtIEclm0+u2y1xQDi9xDN/l0mH3dcKko=; b=bmOyW5EOoJeRc+nbyBdCiQq4ObdhYN+OVExvEWoLpT1Uq2MeGDLgnTWbqu8XWti91pFURD7Zo1fme1QAZRpMYtgEbSnv1SjIZ+htTCyOVk/3M8ID4r65EmpmBVG6K4TvVk4pfbMEvpiWJBXDhModyXgDCEV2n5Olgxmv9isft5E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586527017313608.0128757330341; Fri, 10 Apr 2020 06:56:57 -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-153-hAK8TRQpMEa6r6tl2lyNNA-1; Fri, 10 Apr 2020 09:56:53 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D126BDB35; Fri, 10 Apr 2020 13:56:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A53AA94B40; Fri, 10 Apr 2020 13:56:47 +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 656451819AD0; Fri, 10 Apr 2020 13:56:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuKqc023337 for ; Fri, 10 Apr 2020 09:56:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 584D110E60DD; Fri, 10 Apr 2020 13:56:20 +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 5453D10E60DC for ; Fri, 10 Apr 2020 13:56:20 +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 3C3CD8FF663 for ; Fri, 10 Apr 2020 13:56:20 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-6-_JNcClDzPLKplatLXI6Veg-1; Fri, 10 Apr 2020 09:56:17 -0400 Received: by mail-wr1-f65.google.com with SMTP id h9so2371974wrc.8 for ; Fri, 10 Apr 2020 06:56:17 -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.56.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527016; 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=qwrb93QA0vZdtIEclm0+u2y1xQDi9xDN/l0mH3dcKko=; b=FDup1BNDTcXL1MElTGhi+18QP6GdLUPc2Gg6ti6G3OWni3hoQZ9JQEV2LC3ridLzAUusDG B24Rl4m2U9UYZAnFdu1rwaJAhovmvzcu5yuv9NOBewt5z0Fh7qiFSzaJjVB7bFfStUWev2 p8VvktiCZ8CsQSPostsJHss8Bljh0xc= X-MC-Unique: hAK8TRQpMEa6r6tl2lyNNA-1 X-MC-Unique: _JNcClDzPLKplatLXI6Veg-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=BlrV71V/38ATn7BBQ6/jcDyi4pIw+XfqPF+AFMoL2sY=; b=dJ9DXS8ROK3mQrsEOvPos7bKe2iOAiDKfrFG6gDmIcV3JMpb5e2SuxQRnh4ItdihhB intF45q8VYw+LakQvDqsbqOkhEWhiJm81jgDW7cUnfW2TFFYjGIGlprE/iXo4I+wESAm 1Rd7z2guevsXJP8r6V88uTgJjWWbllFaA0X0f2+/SdDW5WWzZgWC1plLUIqrcibzFoAN o1SqGwh6xQmrBQwOqFka0c6SEUO1tH+6C3CbPXjOZhrGihYZYB9Dnm+KPsnOY46eqliH HXV8VC4sjcrT7OYk3IKI86g83TmanNGtAnifI8Ki0mm/Wol7piSGurskqvILL8ACeT8v 5zWg== X-Gm-Message-State: AGi0PuYS/Qv75UGNZd4xWHOU3+GHbXlYffpqYzDyLIVZ6VeP53BuCjXY /Rnzo38JfjxUU1Jliq6dHziuQ9Bpbf8= X-Google-Smtp-Source: APiQypJiv5o98N5fQYdc8CNplyU58BtUGbNqTa1OCOziu6QWNAp7mhRvav4Yfu+9i2HpkOnawF2rbg== X-Received: by 2002:a5d:4746:: with SMTP id o6mr4741324wrs.304.1586526975447; Fri, 10 Apr 2020 06:56:15 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 37/43] tools: virsh: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:55:04 +0200 Message-Id: <20200410135510.2148319-38-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.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuKqc023337 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.15 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 --- tools/virsh.c | 11 ++++------- tools/virt-admin.c | 11 ++++------- tools/vsh.c | 4 ++-- tools/vsh.h | 2 +- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 197a90636d..f2da8ad340 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -414,11 +414,11 @@ virshDeinit(vshControl *ctl) if (ctl->eventLoopStarted) { int timer; =20 - virMutexLock(&ctl->lock); + g_mutex_lock(&ctl->lock); ctl->quit =3D true; /* HACK: Add a dummy timeout to break event loop */ timer =3D virEventAddTimeout(0, virshDeinitTimer, NULL, NULL); - virMutexUnlock(&ctl->lock); + g_mutex_unlock(&ctl->lock); =20 virThreadJoin(&ctl->eventLoop); =20 @@ -431,7 +431,7 @@ virshDeinit(vshControl *ctl) ctl->eventLoopStarted =3D false; } =20 - virMutexDestroy(&ctl->lock); + g_mutex_clear(&ctl->lock); =20 return true; } @@ -877,10 +877,7 @@ main(int argc, char **argv) #endif } =20 - if (virMutexInit(&ctl->lock) < 0) { - vshError(ctl, "%s", _("Failed to initialize mutex")); - return EXIT_FAILURE; - } + g_mutex_init(&ctl->lock); =20 if (virInitialize() < 0) { vshError(ctl, "%s", _("Failed to initialize libvirt")); diff --git a/tools/virt-admin.c b/tools/virt-admin.c index a8e5e0a5af..712bac07df 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1203,11 +1203,11 @@ vshAdmDeinit(vshControl *ctl) if (ctl->eventLoopStarted) { int timer; =20 - virMutexLock(&ctl->lock); + g_mutex_lock(&ctl->lock); ctl->quit =3D true; /* HACK: Add a dummy timeout to break event loop */ timer =3D virEventAddTimeout(0, vshAdmDeinitTimer, NULL, NULL); - virMutexUnlock(&ctl->lock); + g_mutex_unlock(&ctl->lock); =20 virThreadJoin(&ctl->eventLoop); =20 @@ -1217,7 +1217,7 @@ vshAdmDeinit(vshControl *ctl) ctl->eventLoopStarted =3D false; } =20 - virMutexDestroy(&ctl->lock); + g_mutex_clear(&ctl->lock); } =20 /* @@ -1563,10 +1563,7 @@ main(int argc, char **argv) #endif } =20 - if (virMutexInit(&ctl->lock) < 0) { - vshError(ctl, "%s", _("Failed to initialize mutex")); - return EXIT_FAILURE; - } + g_mutex_init(&ctl->lock); =20 if (virAdmInitialize() < 0) { vshError(ctl, "%s", _("Failed to initialize libvirt")); diff --git a/tools/vsh.c b/tools/vsh.c index 58bb1e6a3c..b803dd6aa5 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1989,9 +1989,9 @@ vshEventLoop(void *opaque) =20 while (1) { bool quit; - virMutexLock(&ctl->lock); + g_mutex_lock(&ctl->lock); quit =3D ctl->quit; - virMutexUnlock(&ctl->lock); + g_mutex_unlock(&ctl->lock); =20 if (quit) break; diff --git a/tools/vsh.h b/tools/vsh.h index 174116b369..49e1fef06e 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -208,7 +208,7 @@ struct _vshControl { char *historydir; /* readline history directory name */ char *historyfile; /* readline history file name */ virThread eventLoop; - virMutex lock; + GMutex lock; bool eventLoopStarted; bool quit; int eventPipe[2]; /* Write-to-self pipe to end waiting for an --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586527014; cv=none; d=zohomail.com; s=zohoarc; b=PPu17ODqjQIJ/FUNdAD5kZ/v01uc21f6NY2LmD5mdv7xBy4NOpr0wnl/lTFT9/GJzi8HqQugx4eqRspCm0MT0bGFVShjzct+bM4lvJMo6d710RVHCnJIXGwYpyqkr810A5gRKz+f0EWKvSt3q2SFIG11mU9eNakiZsUNyo8KbDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527014; 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=hbESINIZ7qWJ583eMCgQEwxqf2ZZnorU6hScM/s3ghw=; b=oDnKJvF0a2txdu77bIROTl/41CBgtb/aAi5cKixk8HEzSe/XN7Vsi9cNe0dcMoCT48JZYogdikvLChjIS1yMjw0WNyiE7uqq837ngBja/tau+4d7t5/s5Cxw+2DiQhLwJRMjz7UdiSryU5fRy0idUBCalmAJRaqxhZ9SBOWNxew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586527014473273.7863747759591; Fri, 10 Apr 2020 06:56:54 -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-463-v_R7On4uNwWDmCuwBEYHwg-1; Fri, 10 Apr 2020 09:56:50 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09D8718B5F82; Fri, 10 Apr 2020 13:56:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1128272C4; Fri, 10 Apr 2020 13:56:43 +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 81CED180203B; Fri, 10 Apr 2020 13:56:43 +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 03ADuNd6023371 for ; Fri, 10 Apr 2020 09:56:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F873127513; Fri, 10 Apr 2020 13:56:23 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B288127518 for ; Fri, 10 Apr 2020 13:56:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 343A21019E0D for ; Fri, 10 Apr 2020 13:56:21 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-400-y3V1NmtmNaWDdMVXuLB5NA-1; Fri, 10 Apr 2020 09:56:19 -0400 Received: by mail-wm1-f67.google.com with SMTP id y24so2806037wma.4 for ; Fri, 10 Apr 2020 06:56:18 -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.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527013; 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=hbESINIZ7qWJ583eMCgQEwxqf2ZZnorU6hScM/s3ghw=; b=ECI6l7tP4uyv/BuulrSuecIq1jNA3uxZTVjROpvcMAbZr7X8wvWrfocvWbVNR7hWzg8YvT vEQuRHta1L+QxttarYbO25pAwmo0Gp9knF7XXsv1coapdWmfwiX9onupQhWQMenJlE5yKv 47bQiH5/SDkKIE7rqVQQqhRQYc6uGlE= X-MC-Unique: v_R7On4uNwWDmCuwBEYHwg-1 X-MC-Unique: y3V1NmtmNaWDdMVXuLB5NA-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=xCDj5XZUnFpSQhUS+Y6ctpJwMJXCS0X4LE+i9i6IocA=; b=lYJG64Ommr2YSO+/Cv+TCLSo4KXK2JnE9vw7yjtrMum+L8W7v126jkGofugNjLJDJv s02J/Tt03uZdeAx3Of4gdFHGILHDfaxLQpib7dTeraDuGhX7uKufgUZNqiI2Vg8fUKug YFJWo7kZTzpFx5lA1ISEhhuhdJd05lVcqKmX7Nk8Kd2toIF3Z+ubXpzUV0z9aaQewGVl y8VpV7wl+5SWJpL9hpDbfl7YjB3s0fB9tejNzU+QlieISI8G87S0KKAuIAqlYGDIOEvU fADAThAEpqwNfztIUZ68pLia4MwNXsFx8Tdf1IZY6OnV7A7uWYPfLiNsYT0h6IpjTNo7 xrdA== X-Gm-Message-State: AGi0Pua8LI4Z95Rc0A2eW8CsPng1+e+mItnMz/TrPfBQmzmw/yOGrd3/ kCurnpEyBwiiNVLoflv40QznjaFjA/0= X-Google-Smtp-Source: APiQypKb/X5nzhiNtecMe6IAPN1MXZkCofBoz3SGrAkmDT0PnkyQ8HHyxyx70kz4Qgr3uR35Ri0gYw== X-Received: by 2002:a1c:7d4b:: with SMTP id y72mr5398292wmc.11.1586526977047; Fri, 10 Apr 2020 06:56:17 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 38/43] nwfilter: nwfilter_learnipaddr: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:55:05 +0200 Message-Id: <20200410135510.2148319-39-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 03ADuNd6023371 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.84 on 10.5.11.23 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 --- src/nwfilter/nwfilter_learnipaddr.c | 43 +++++++++++++---------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_le= arnipaddr.c index 4ce8d5ba03..c46fbca40d 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -111,17 +111,17 @@ struct ether_vlan_header } ATTRIBUTE_PACKED; =20 =20 -static virMutex pendingLearnReqLock =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE_STATIC(pendingLearnReqLock); static virHashTablePtr pendingLearnReq; =20 -static virMutex ifaceMapLock =3D VIR_MUTEX_INITIALIZER; +G_LOCK_DEFINE_STATIC(ifaceMapLock); static virHashTablePtr ifaceLockMap; =20 typedef struct _virNWFilterIfaceLock virNWFilterIfaceLock; typedef virNWFilterIfaceLock *virNWFilterIfaceLockPtr; struct _virNWFilterIfaceLock { char ifname[IF_NAMESIZE]; - virMutex lock; + GRecMutex lock; int refctr; }; =20 @@ -147,19 +147,14 @@ virNWFilterLockIface(const char *ifname) { virNWFilterIfaceLockPtr ifaceLock; =20 - virMutexLock(&ifaceMapLock); + G_LOCK(ifaceMapLock); =20 ifaceLock =3D virHashLookup(ifaceLockMap, ifname); if (!ifaceLock) { if (VIR_ALLOC(ifaceLock) < 0) goto err_exit; =20 - if (virMutexInitRecursive(&ifaceLock->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("mutex initialization failed")); - VIR_FREE(ifaceLock); - goto err_exit; - } + g_rec_mutex_init(&ifaceLock->lock); =20 if (virStrcpyStatic(ifaceLock->ifname, ifname) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -180,14 +175,14 @@ virNWFilterLockIface(const char *ifname) =20 ifaceLock->refctr++; =20 - virMutexUnlock(&ifaceMapLock); + G_UNLOCK(ifaceMapLock); =20 - virMutexLock(&ifaceLock->lock); + g_rec_mutex_lock(&ifaceLock->lock); =20 return 0; =20 err_exit: - virMutexUnlock(&ifaceMapLock); + G_UNLOCK(ifaceMapLock); =20 return -1; } @@ -198,19 +193,19 @@ virNWFilterUnlockIface(const char *ifname) { virNWFilterIfaceLockPtr ifaceLock; =20 - virMutexLock(&ifaceMapLock); + G_LOCK(ifaceMapLock); =20 ifaceLock =3D virHashLookup(ifaceLockMap, ifname); =20 if (ifaceLock) { - virMutexUnlock(&ifaceLock->lock); + g_rec_mutex_unlock(&ifaceLock->lock); =20 ifaceLock->refctr--; if (ifaceLock->refctr =3D=3D 0) virHashRemoveEntry(ifaceLockMap, ifname); } =20 - virMutexUnlock(&ifaceMapLock); + G_UNLOCK(ifaceMapLock); } =20 =20 @@ -234,12 +229,12 @@ virNWFilterRegisterLearnReq(virNWFilterIPAddrLearnReq= Ptr req) int res =3D -1; g_autofree char *ifindex_str =3D g_strdup_printf("%d", req->ifindex); =20 - virMutexLock(&pendingLearnReqLock); + G_LOCK(pendingLearnReqLock); =20 if (!virHashLookup(pendingLearnReq, ifindex_str)) res =3D virHashAddEntry(pendingLearnReq, ifindex_str, req); =20 - virMutexUnlock(&pendingLearnReqLock); + G_UNLOCK(pendingLearnReqLock); =20 return res; } @@ -270,7 +265,7 @@ virNWFilterTerminateLearnReq(const char *ifname) =20 ifindex_str =3D g_strdup_printf("%d", ifindex); =20 - virMutexLock(&pendingLearnReqLock); + G_LOCK(pendingLearnReqLock); =20 req =3D virHashLookup(pendingLearnReq, ifindex_str); if (req) { @@ -278,7 +273,7 @@ virNWFilterTerminateLearnReq(const char *ifname) req->terminate =3D true; } =20 - virMutexUnlock(&pendingLearnReqLock); + G_UNLOCK(pendingLearnReqLock); =20 return rc; } @@ -290,11 +285,11 @@ virNWFilterHasLearnReq(int ifindex) void *res; g_autofree char *ifindex_str =3D g_strdup_printf("%d", ifindex); =20 - virMutexLock(&pendingLearnReqLock); + G_LOCK(pendingLearnReqLock); =20 res =3D virHashLookup(pendingLearnReq, ifindex_str); =20 - virMutexUnlock(&pendingLearnReqLock); + G_UNLOCK(pendingLearnReqLock); =20 return res !=3D NULL; } @@ -315,11 +310,11 @@ virNWFilterDeregisterLearnReq(int ifindex) virNWFilterIPAddrLearnReqPtr res; g_autofree char *ifindex_str =3D g_strdup_printf("%d", ifindex); =20 - virMutexLock(&pendingLearnReqLock); + G_LOCK(pendingLearnReqLock); =20 res =3D virHashSteal(pendingLearnReq, ifindex_str); =20 - virMutexUnlock(&pendingLearnReqLock); + G_UNLOCK(pendingLearnReqLock); =20 return res; } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1586527026; cv=none; d=zohomail.com; s=zohoarc; b=Y6nwnvUhIVELxy4I5mVuVCh5MMotW6ll5iLSJKRdH+90yxOnQx+a8UaSnc3oqPRyrVpjUy/1yMvvbkMe+/Jx3UihpEjgYKlobDnikWyf+qb5Fki7db/wdkQec3zVbzrGD9g924n6KNjmuQPpo6pZ7r1G97ZztVo/GhMzh1elf3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527026; 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=vAISBmWJtziKuLLfJQBrq8Q4y4KB17atG6Jo5lAWdVg=; b=SK8dKMrvmYRrFaAIalbBJuHusFb1BJFz17HJmsXFn+o7jJvlEdbmeAXfoHqqQ5bNoSUuQuLkINmcd4mJXkQkrJ/hZDYk332sYNQNBJd/sR5jbvkgXMHmogxNYUHJ3i4taUFEQwSRSVriPm0eayx3/NwahsyrpwIa5lRgaCIhBr8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586527026872630.8659620116708; Fri, 10 Apr 2020 06:57:06 -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-172-stz_krfOMhiopT1DvCX0SQ-1; Fri, 10 Apr 2020 09:56:54 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F9E018B5F7E; Fri, 10 Apr 2020 13:56:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6462CBEA67; Fri, 10 Apr 2020 13:56:47 +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 23FD91819ACF; Fri, 10 Apr 2020 13:56:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuMxx023358 for ; Fri, 10 Apr 2020 09:56:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id D2E78200AD4C; Fri, 10 Apr 2020 13:56:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE67F2028CD6 for ; Fri, 10 Apr 2020 13:56:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 B0569185A78E for ; Fri, 10 Apr 2020 13:56:22 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-191-M9a5oDVsNVuHsqtR888xPw-1; Fri, 10 Apr 2020 09:56:20 -0400 Received: by mail-wr1-f66.google.com with SMTP id f13so2346023wrm.13 for ; Fri, 10 Apr 2020 06:56:19 -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.56.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527025; 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=vAISBmWJtziKuLLfJQBrq8Q4y4KB17atG6Jo5lAWdVg=; b=jKiM5oo1nvpb/7mLxyMpEFe9gJuICl+UPGQzIH+KxUnJ2s2cEUqmFiayviy3XVDqRuIQIQ LtUpi+G/aVYORysXRSvrOFg5zx9injQoR7gRL3/2hl8Wdn/lyGgiFNVEab3vweqKNG9fj7 8rhUEsq7E/bteZ95G1NoAntbtm/isfg= X-MC-Unique: stz_krfOMhiopT1DvCX0SQ-1 X-MC-Unique: M9a5oDVsNVuHsqtR888xPw-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=3BED4PvbeUR1/49I1ZFvOIwc5mkFrf4xPz93ip4P3RI=; b=iAl4nJSk2ljxZcL6rfGx/aFPYUn6Zsxuw4l4V/R37VsMIh7mHHvVH+WxqwD/XA0NTE mNhZWAwUAzH/QvRMp3yR4o5oT/Xuds+uIUqwhcYv+/w0OOOuOaUKgkA6Hg0HXUV1R2AQ w6cs9ItR2Kimqfenv0n+OtwXBJRqjXUE7w1FkbrDjsgmZU6wxxa/HbHK6TvH0Ml7oj1K jd6QmCQg1HcsCvBliTOTfowF+c4ig7IlzFKt4oeIJ5C+Xw2h22XbbxkgZTCdY3iODIGP ijHDtrc9jn0DC8gdTMxoDPJibvEh+Bm+gi1jvYMNY/241RxJOcyXGEQaX+phhmvYQgWI LuYw== X-Gm-Message-State: AGi0PubscBqNksYTsWOlSNN96QtYg9SGlOWwllg4JHSiIsFY7KlX1iGv yV8RewoCsKXv+Xmy9GbfeCGvFUVrwDo= X-Google-Smtp-Source: APiQypK/Mp2ckbr5mN2vO8rtwdWczh+kmyiH2qzqPWN+3Mz2uF+LC1irWd5DXIGYJiojkQQhl76AOw== X-Received: by 2002:adf:e742:: with SMTP id c2mr4673405wrn.293.1586526978525; Fri, 10 Apr 2020 06:56:18 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 39/43] util: virthreadpool: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:55:06 +0200 Message-Id: <20200410135510.2148319-40-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.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuMxx023358 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.15 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 --- src/util/virthreadpool.c | 149 +++++++++++++-------------------------- 1 file changed, 50 insertions(+), 99 deletions(-) diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c index 379d2369ad..147943f395 100644 --- a/src/util/virthreadpool.c +++ b/src/util/virthreadpool.c @@ -59,9 +59,9 @@ struct _virThreadPool { virThreadPoolJobList jobList; size_t jobQueueDepth; =20 - virMutex mutex; - virCond cond; - virCond quit_cond; + GMutex mutex; + GCond cond; + GCond quit_cond; =20 size_t maxWorkers; size_t minWorkers; @@ -72,12 +72,12 @@ struct _virThreadPool { size_t maxPrioWorkers; size_t nPrioWorkers; virThreadPtr prioWorkers; - virCond prioCond; + GCond prioCond; }; =20 struct virThreadPoolWorkerData { virThreadPoolPtr pool; - virCondPtr cond; + GCond *cond; bool priority; }; =20 @@ -93,7 +93,7 @@ static void virThreadPoolWorker(void *opaque) { struct virThreadPoolWorkerData *data =3D opaque; virThreadPoolPtr pool =3D data->pool; - virCondPtr cond =3D data->cond; + GCond *cond =3D data->cond; bool priority =3D data->priority; size_t *curWorkers =3D priority ? &pool->nPrioWorkers : &pool->nWorker= s; size_t *maxLimit =3D priority ? &pool->maxPrioWorkers : &pool->maxWork= ers; @@ -101,7 +101,7 @@ static void virThreadPoolWorker(void *opaque) =20 VIR_FREE(data); =20 - virMutexLock(&pool->mutex); + g_mutex_lock(&pool->mutex); =20 while (1) { /* In order to support async worker termination, we need ensure th= at @@ -117,11 +117,7 @@ static void virThreadPoolWorker(void *opaque) (priority && !pool->jobList.firstPrio))) { if (!priority) pool->freeWorkers++; - if (virCondWait(cond, &pool->mutex) < 0) { - if (!priority) - pool->freeWorkers--; - goto out; - } + g_cond_wait(cond, &pool->mutex); if (!priority) pool->freeWorkers--; =20 @@ -159,10 +155,10 @@ static void virThreadPoolWorker(void *opaque) =20 pool->jobQueueDepth--; =20 - virMutexUnlock(&pool->mutex); + g_mutex_unlock(&pool->mutex); (pool->jobFunc)(job->data, pool->jobOpaque); VIR_FREE(job); - virMutexLock(&pool->mutex); + g_mutex_lock(&pool->mutex); } =20 out: @@ -171,8 +167,8 @@ static void virThreadPoolWorker(void *opaque) else pool->nWorkers--; if (pool->nWorkers =3D=3D 0 && pool->nPrioWorkers =3D=3D 0) - virCondSignal(&pool->quit_cond); - virMutexUnlock(&pool->mutex); + g_cond_signal(&pool->quit_cond); + g_mutex_unlock(&pool->mutex); } =20 static int @@ -241,12 +237,9 @@ virThreadPoolNewFull(size_t minWorkers, pool->jobName =3D name; pool->jobOpaque =3D opaque; =20 - if (virMutexInit(&pool->mutex) < 0) - goto error; - if (virCondInit(&pool->cond) < 0) - goto error; - if (virCondInit(&pool->quit_cond) < 0) - goto error; + g_mutex_init(&pool->mutex); + g_cond_init(&pool->cond); + g_cond_init(&pool->quit_cond); =20 pool->minWorkers =3D minWorkers; pool->maxWorkers =3D maxWorkers; @@ -256,8 +249,7 @@ virThreadPoolNewFull(size_t minWorkers, goto error; =20 if (prioWorkers) { - if (virCondInit(&pool->prioCond) < 0) - goto error; + g_cond_init(&pool->prioCond); =20 if (virThreadPoolExpand(pool, prioWorkers, true) < 0) goto error; @@ -279,17 +271,17 @@ void virThreadPoolFree(virThreadPoolPtr pool) if (!pool) return; =20 - virMutexLock(&pool->mutex); + g_mutex_lock(&pool->mutex); pool->quit =3D true; if (pool->nWorkers > 0) - virCondBroadcast(&pool->cond); + g_cond_broadcast(&pool->cond); if (pool->nPrioWorkers > 0) { priority =3D true; - virCondBroadcast(&pool->prioCond); + g_cond_broadcast(&pool->prioCond); } =20 while (pool->nWorkers > 0 || pool->nPrioWorkers > 0) - ignore_value(virCondWait(&pool->quit_cond, &pool->mutex)); + g_cond_wait(&pool->quit_cond, &pool->mutex); =20 while ((job =3D pool->jobList.head)) { pool->jobList.head =3D pool->jobList.head->next; @@ -297,13 +289,13 @@ void virThreadPoolFree(virThreadPoolPtr pool) } =20 VIR_FREE(pool->workers); - virMutexUnlock(&pool->mutex); - virMutexDestroy(&pool->mutex); - virCondDestroy(&pool->quit_cond); - virCondDestroy(&pool->cond); + g_mutex_unlock(&pool->mutex); + g_mutex_clear(&pool->mutex); + g_cond_clear(&pool->quit_cond); + g_cond_clear(&pool->cond); if (priority) { VIR_FREE(pool->prioWorkers); - virCondDestroy(&pool->prioCond); + g_cond_clear(&pool->prioCond); } VIR_FREE(pool); } @@ -311,68 +303,38 @@ void virThreadPoolFree(virThreadPoolPtr pool) =20 size_t virThreadPoolGetMinWorkers(virThreadPoolPtr pool) { - size_t ret; - - virMutexLock(&pool->mutex); - ret =3D pool->minWorkers; - virMutexUnlock(&pool->mutex); - - return ret; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&pool->mutex); + return pool->minWorkers; } =20 size_t virThreadPoolGetMaxWorkers(virThreadPoolPtr pool) { - size_t ret; - - virMutexLock(&pool->mutex); - ret =3D pool->maxWorkers; - virMutexUnlock(&pool->mutex); - - return ret; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&pool->mutex); + return pool->maxWorkers; } =20 size_t virThreadPoolGetPriorityWorkers(virThreadPoolPtr pool) { - size_t ret; - - virMutexLock(&pool->mutex); - ret =3D pool->nPrioWorkers; - virMutexUnlock(&pool->mutex); - - return ret; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&pool->mutex); + return pool->nPrioWorkers; } =20 size_t virThreadPoolGetCurrentWorkers(virThreadPoolPtr pool) { - size_t ret; - - virMutexLock(&pool->mutex); - ret =3D pool->nWorkers; - virMutexUnlock(&pool->mutex); - - return ret; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&pool->mutex); + return pool->nWorkers; } =20 size_t virThreadPoolGetFreeWorkers(virThreadPoolPtr pool) { - size_t ret; - - virMutexLock(&pool->mutex); - ret =3D pool->freeWorkers; - virMutexUnlock(&pool->mutex); - - return ret; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&pool->mutex); + return pool->freeWorkers; } =20 size_t virThreadPoolGetJobQueueDepth(virThreadPoolPtr pool) { - size_t ret; - - virMutexLock(&pool->mutex); - ret =3D pool->jobQueueDepth; - virMutexUnlock(&pool->mutex); - - return ret; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&pool->mutex); + return pool->jobQueueDepth; } =20 /* @@ -384,18 +346,18 @@ int virThreadPoolSendJob(virThreadPoolPtr pool, void *jobData) { virThreadPoolJobPtr job; + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&pool->mutex); =20 - virMutexLock(&pool->mutex); if (pool->quit) - goto error; + return -1; =20 if (pool->freeWorkers - pool->jobQueueDepth <=3D 0 && pool->nWorkers < pool->maxWorkers && virThreadPoolExpand(pool, 1, false) < 0) - goto error; + return -1; =20 if (VIR_ALLOC(job) < 0) - goto error; + return -1; =20 job->data =3D jobData; job->priority =3D priority; @@ -413,16 +375,11 @@ int virThreadPoolSendJob(virThreadPoolPtr pool, =20 pool->jobQueueDepth++; =20 - virCondSignal(&pool->cond); + g_cond_signal(&pool->cond); if (priority) - virCondSignal(&pool->prioCond); + g_cond_signal(&pool->prioCond); =20 - virMutexUnlock(&pool->mutex); return 0; - - error: - virMutexUnlock(&pool->mutex); - return -1; } =20 int @@ -433,15 +390,14 @@ virThreadPoolSetParameters(virThreadPoolPtr pool, { size_t max; size_t min; - - virMutexLock(&pool->mutex); + g_autoptr(GMutexLocker) locker =3D g_mutex_locker_new(&pool->mutex); =20 max =3D maxWorkers >=3D 0 ? maxWorkers : pool->maxWorkers; min =3D minWorkers >=3D 0 ? minWorkers : pool->minWorkers; if (min > max) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("minWorkers cannot be larger than maxWorkers")); - goto error; + return -1; } =20 if ((maxWorkers =3D=3D 0 && pool->maxWorkers > 0) || @@ -449,37 +405,32 @@ virThreadPoolSetParameters(virThreadPoolPtr pool, virReportError(VIR_ERR_INVALID_ARG, "%s", _("maxWorkers must not be switched from zero to non= -zero" " and vice versa")); - goto error; + return -1; } =20 if (minWorkers >=3D 0) { if ((size_t) minWorkers > pool->nWorkers && virThreadPoolExpand(pool, minWorkers - pool->nWorkers, false) < 0) - goto error; + return -1; pool->minWorkers =3D minWorkers; } =20 if (maxWorkers >=3D 0) { pool->maxWorkers =3D maxWorkers; - virCondBroadcast(&pool->cond); + g_cond_broadcast(&pool->cond); } =20 if (prioWorkers >=3D 0) { if (prioWorkers < pool->nPrioWorkers) { - virCondBroadcast(&pool->prioCond); + g_cond_broadcast(&pool->prioCond); } else if ((size_t) prioWorkers > pool->nPrioWorkers && virThreadPoolExpand(pool, prioWorkers - pool->nPrioWork= ers, true) < 0) { - goto error; + return -1; } pool->maxPrioWorkers =3D prioWorkers; } =20 - virMutexUnlock(&pool->mutex); return 0; - - error: - virMutexUnlock(&pool->mutex); - return -1; } --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586527019; cv=none; d=zohomail.com; s=zohoarc; b=YMZLMjyq8/O22LUREU4RWszVno77NXuGPv0c13g8t/XFF3VZ3TrtIXj6Rew4XR9Q7J8y43wNoo+GMEufKtr3nfDgNZGRPQUYv5XFBe1QowDlxbrlvaurY3UV4SUeNzNfpiQWBUu5LMbHh5mCjbjFQrFRYfd/Cf65dhCpv+bDvpQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527019; 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=+ff9YCe0m9osDGFh+ZiB4dbysCJPXqI6blkjwXuOFuA=; b=YDBPQL6xnHr3gAlFdaXTkJup1IfHCbaQXrUmjEcCSDP5X80ZwIHWsr+XquwUSLaCA9y5IJ7DU7BjkMcsdw87CZHjNEbuXXYcT3yRBXbrFl0rqcFe31P+6+t7fRvxhx9JrZlhzUtUC/mTMIStqQxN8AjrUUEn+AlPh/Ox1tY8pxM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586527019824149.91572806608713; Fri, 10 Apr 2020 06:56:59 -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-308-Q-Ea5x68NPGa0ybVMPTDLg-1; Fri, 10 Apr 2020 09:56:56 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8DE7718B5F7D; Fri, 10 Apr 2020 13:56:47 +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 5E1651036B54; Fri, 10 Apr 2020 13:56:47 +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 19C2793F49; Fri, 10 Apr 2020 13:56:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuOOq023387 for ; Fri, 10 Apr 2020 09:56:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 81011215AB35; Fri, 10 Apr 2020 13:56:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B808215AB39 for ; Fri, 10 Apr 2020 13:56:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 57847800294 for ; Fri, 10 Apr 2020 13:56:24 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-1-VPeJYAPUODmwi2QBud7fMg-1; Fri, 10 Apr 2020 09:56:22 -0400 Received: by mail-wr1-f66.google.com with SMTP id c15so2354421wro.11 for ; Fri, 10 Apr 2020 06:56:21 -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.56.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527018; 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=+ff9YCe0m9osDGFh+ZiB4dbysCJPXqI6blkjwXuOFuA=; b=ONXOjYU83sygFGWH2vjoElwReqAVG38LYPfc2ub1+yFOsMscLaIztCVMzhTchWi6h2JH0T ceF7BdptGjJksWcOD3pNz1LT6SsK3fBhVCz/V4RYkkad0P09InEo6oezwCVN6zWWfnczeA pm2PCIJ4SxU3aj0IvnAVZpxIHqrxtZ4= X-MC-Unique: Q-Ea5x68NPGa0ybVMPTDLg-1 X-MC-Unique: VPeJYAPUODmwi2QBud7fMg-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=26xhBC1biK6TDTtmHfwjh/Jvzolv4/dYSqFAm4WI0xY=; b=dNfBio+0EHG/O0F4tUn5eew4b4gAVUrf5XkkfhWgW6tGx+u94P/XhDxpypw0aYY2n/ eZS9WcNDnwTuNHo6KUtE1V+ksFvAQ7dhfxjvBRChVfRyUsHgTaFnQB6LbH/s1C0Kt1lU RSvgv7FTqD0zUvj3QZG22wsL+AT82CEVtG8AxC31d6Keqda04DpJh9xVSCZBqQXRfFf2 aOV/h+vkwj42YvYSriqirmeqGQ0KnJKT1Wfwwga+/As+13p219JSsgqkAAwPWpoiN8QH 4iIoqvkLbMzVs64Jpl6a9xdYL2aFN7AxTlfAN5a0CIq6BtbjmWB+29o5KC6sykvKT1Mv 0Kkg== X-Gm-Message-State: AGi0PuaM2a4DIrGf4uG5xcq01ypUWNVvkJRWTEg/9g0mpUKeT5y3yKCz mJxOrmxzcMIPw15444jjSJGOt0lbUCo= X-Google-Smtp-Source: APiQypI1NDY+JNn8FeHkPizgOZ7gaBbwAIkLyi+XX/XMLf7zdYpb2dag3HIY6aEU2RpFiDsqBFebQg== X-Received: by 2002:a05:6000:12c5:: with SMTP id l5mr4886155wrx.185.1586526980146; Fri, 10 Apr 2020 06:56:20 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 40/43] util: virObjectRWLockable: convert virRWLock to GRWLock Date: Fri, 10 Apr 2020 15:55:07 +0200 Message-Id: <20200410135510.2148319-41-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.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuOOq023387 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.84 on 10.5.11.22 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 --- src/conf/virdomainobjlist.c | 35 ++++++++++--------- src/conf/virinterfaceobj.c | 18 +++++----- src/conf/virnetworkobj.c | 20 +++++------ src/conf/virnodedeviceobj.c | 16 ++++----- src/conf/virnwfilterbindingobjlist.c | 14 ++++---- src/conf/virsecretobj.c | 16 ++++----- src/conf/virstorageobj.c | 50 ++++++++++++++-------------- src/libvirt_private.syms | 3 +- src/util/virobject.c | 27 +++++++++------ src/util/virobject.h | 8 +++-- 10 files changed, 110 insertions(+), 97 deletions(-) diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c index 417025ae9f..f3d4d81bb1 100644 --- a/src/conf/virdomainobjlist.c +++ b/src/conf/virdomainobjlist.c @@ -120,7 +120,7 @@ virDomainObjListFindByID(virDomainObjListPtr doms, virObjectRWLockRead(doms); obj =3D virHashSearch(doms->objs, virDomainObjListSearchID, &id, NULL); virObjectRef(obj); - virObjectRWUnlock(doms); + virObjectRWUnlockRead(doms); if (obj) { virObjectLock(obj); if (obj->removing) { @@ -167,7 +167,7 @@ virDomainObjListFindByUUID(virDomainObjListPtr doms, =20 virObjectRWLockRead(doms); obj =3D virDomainObjListFindByUUIDLocked(doms, uuid); - virObjectRWUnlock(doms); + virObjectRWUnlockRead(doms); =20 if (obj && obj->removing) { virObjectUnlock(obj); @@ -210,7 +210,7 @@ virDomainObjListFindByName(virDomainObjListPtr doms, =20 virObjectRWLockRead(doms); obj =3D virDomainObjListFindByNameLocked(doms, name); - virObjectRWUnlock(doms); + virObjectRWUnlockRead(doms); =20 if (obj && obj->removing) { virObjectUnlock(obj); @@ -361,7 +361,7 @@ virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr= doms, =20 virObjectRWLockWrite(doms); ret =3D virDomainObjListAddLocked(doms, def, xmlopt, flags, oldDef); - virObjectRWUnlock(doms); + virObjectRWUnlockWrite(doms); return ret; } =20 @@ -409,7 +409,7 @@ virDomainObjListRemove(virDomainObjListPtr doms, virObjectLock(dom); virDomainObjListRemoveLocked(doms, dom); virObjectUnref(dom); - virObjectRWUnlock(doms); + virObjectRWUnlockWrite(doms); } =20 =20 @@ -475,7 +475,7 @@ virDomainObjListRename(virDomainObjListPtr doms, =20 ret =3D 0; cleanup: - virObjectRWUnlock(doms); + virObjectRWUnlockWrite(doms); VIR_FREE(old_name); return ret; } @@ -634,7 +634,7 @@ virDomainObjListLoadAllConfigs(virDomainObjListPtr doms, } =20 VIR_DIR_CLOSE(dir); - virObjectRWUnlock(doms); + virObjectRWUnlockWrite(doms); return ret; } =20 @@ -680,7 +680,7 @@ virDomainObjListNumOfDomains(virDomainObjListPtr doms, struct virDomainObjListData data =3D { filter, conn, active, 0 }; virObjectRWLockRead(doms); virHashForEach(doms->objs, virDomainObjListCount, &data); - virObjectRWUnlock(doms); + virObjectRWUnlockRead(doms); return data.count; } =20 @@ -724,7 +724,7 @@ virDomainObjListGetActiveIDs(virDomainObjListPtr doms, 0, maxids, ids }; virObjectRWLockRead(doms); virHashForEach(doms->objs, virDomainObjListCopyActiveIDs, &data); - virObjectRWUnlock(doms); + virObjectRWUnlockRead(doms); return data.numids; } =20 @@ -777,7 +777,7 @@ virDomainObjListGetInactiveNames(virDomainObjListPtr do= ms, size_t i; virObjectRWLockRead(doms); virHashForEach(doms->objs, virDomainObjListCopyInactiveNames, &data); - virObjectRWUnlock(doms); + virObjectRWUnlockRead(doms); if (data.oom) { for (i =3D 0; i < data.numnames; i++) VIR_FREE(data.names[i]); @@ -839,7 +839,10 @@ virDomainObjListForEach(virDomainObjListPtr doms, else virObjectRWLockRead(doms); virHashForEach(doms->objs, virDomainObjListHelper, &data); - virObjectRWUnlock(doms); + if (modify) + virObjectRWUnlockWrite(doms); + else + virObjectRWUnlockRead(doms); return data.ret; } =20 @@ -982,12 +985,12 @@ virDomainObjListCollect(virDomainObjListPtr domlist, virObjectRWLockRead(domlist); sa_assert(domlist->objs); if (VIR_ALLOC_N(data.vms, virHashSize(domlist->objs)) < 0) { - virObjectRWUnlock(domlist); + virObjectRWUnlockRead(domlist); return -1; } =20 virHashForEach(domlist->objs, virDomainObjListCollectIterator, &data); - virObjectRWUnlock(domlist); + virObjectRWUnlockRead(domlist); =20 virDomainObjListFilter(&data.vms, &data.nvms, conn, filter, flags); =20 @@ -1026,7 +1029,7 @@ virDomainObjListConvert(virDomainObjListPtr domlist, if (skip_missing) continue; =20 - virObjectRWUnlock(domlist); + virObjectRWUnlockRead(domlist); virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching uuid '%s' (%s)"), uuidstr, dom->name); @@ -1036,12 +1039,12 @@ virDomainObjListConvert(virDomainObjListPtr domlist, virObjectRef(vm); =20 if (VIR_APPEND_ELEMENT(*vms, *nvms, vm) < 0) { - virObjectRWUnlock(domlist); + virObjectRWUnlockRead(domlist); virObjectUnref(vm); goto error; } } - virObjectRWUnlock(domlist); + virObjectRWUnlockRead(domlist); =20 sa_assert(*vms); virDomainObjListFilter(vms, nvms, conn, filter, flags); diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c index 43ba395d2b..f52ff88c2a 100644 --- a/src/conf/virinterfaceobj.c +++ b/src/conf/virinterfaceobj.c @@ -200,7 +200,7 @@ virInterfaceObjListFindByMACString(virInterfaceObjListP= tr interfaces, virObjectRWLockRead(interfaces); virHashForEach(interfaces->objsName, virInterfaceObjListFindByMACStrin= gCb, &data); - virObjectRWUnlock(interfaces); + virObjectRWUnlockRead(interfaces); =20 if (data.error) goto error; @@ -230,7 +230,7 @@ virInterfaceObjListFindByName(virInterfaceObjListPtr in= terfaces, virInterfaceObjPtr obj; virObjectRWLockRead(interfaces); obj =3D virInterfaceObjListFindByNameLocked(interfaces, name); - virObjectRWUnlock(interfaces); + virObjectRWUnlockRead(interfaces); if (obj) virObjectLock(obj); =20 @@ -337,7 +337,7 @@ virInterfaceObjListExport(virConnectPtr conn, =20 ret =3D data.nifaces; cleanup: - virObjectRWUnlock(ifaceobjs); + virObjectRWUnlockRead(ifaceobjs); while (data.ifaces && data.nifaces) virObjectUnref(data.ifaces[--data.nifaces]); =20 @@ -413,7 +413,7 @@ virInterfaceObjListClone(virInterfaceObjListPtr interfa= ces) =20 virObjectRWLockRead(interfaces); virHashForEach(interfaces->objsName, virInterfaceObjListCloneCb, &data= ); - virObjectRWUnlock(interfaces); + virObjectRWUnlockRead(interfaces); =20 if (data.error) goto error; @@ -445,13 +445,13 @@ virInterfaceObjListAssignDef(virInterfaceObjListPtr i= nterfaces, } =20 obj->def =3D def; - virObjectRWUnlock(interfaces); + virObjectRWUnlockWrite(interfaces); =20 return obj; =20 error: virInterfaceObjEndAPI(&obj); - virObjectRWUnlock(interfaces); + virObjectRWUnlockWrite(interfaces); return NULL; } =20 @@ -470,7 +470,7 @@ virInterfaceObjListRemove(virInterfaceObjListPtr interf= aces, virHashRemoveEntry(interfaces->objsName, obj->def->name); virObjectUnlock(obj); virObjectUnref(obj); - virObjectRWUnlock(interfaces); + virObjectRWUnlockWrite(interfaces); } =20 =20 @@ -507,7 +507,7 @@ virInterfaceObjListNumOfInterfaces(virInterfaceObjListP= tr interfaces, virObjectRWLockRead(interfaces); virHashForEach(interfaces->objsName, virInterfaceObjListNumOfInterface= sCb, &data); - virObjectRWUnlock(interfaces); + virObjectRWUnlockRead(interfaces); =20 return data.count; } @@ -562,7 +562,7 @@ virInterfaceObjListGetNames(virInterfaceObjListPtr inte= rfaces, =20 virObjectRWLockRead(interfaces); virHashForEach(interfaces->objsName, virInterfaceObjListGetNamesCb, &d= ata); - virObjectRWUnlock(interfaces); + virObjectRWUnlockRead(interfaces); =20 if (data.error) goto error; diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index b2affaacd3..d47e2ab793 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -395,7 +395,7 @@ virNetworkObjFindByUUID(virNetworkObjListPtr nets, =20 virObjectRWLockRead(nets); obj =3D virNetworkObjFindByUUIDLocked(nets, uuid); - virObjectRWUnlock(nets); + virObjectRWUnlockRead(nets); if (obj) virObjectLock(obj); return obj; @@ -449,7 +449,7 @@ virNetworkObjFindByName(virNetworkObjListPtr nets, =20 virObjectRWLockRead(nets); obj =3D virNetworkObjFindByNameLocked(nets, name); - virObjectRWUnlock(nets); + virObjectRWUnlockRead(nets); if (obj) virObjectLock(obj); return obj; @@ -652,7 +652,7 @@ virNetworkObjAssignDef(virNetworkObjListPtr nets, =20 virObjectRWLockWrite(nets); obj =3D virNetworkObjAssignDefLocked(nets, def, flags); - virObjectRWUnlock(nets); + virObjectRWUnlockWrite(nets); return obj; } =20 @@ -805,7 +805,7 @@ virNetworkObjRemoveInactive(virNetworkObjListPtr nets, virObjectRWLockWrite(nets); virObjectLock(obj); virHashRemoveEntry(nets->objs, uuidstr); - virObjectRWUnlock(nets); + virObjectRWUnlockWrite(nets); virObjectUnref(obj); } =20 @@ -1218,7 +1218,7 @@ virNetworkObjBridgeInUse(virNetworkObjListPtr nets, =20 virObjectRWLockRead(nets); obj =3D virHashSearch(nets->objs, virNetworkObjBridgeInUseHelper, &dat= a, NULL); - virObjectRWUnlock(nets); + virObjectRWUnlockRead(nets); =20 return obj !=3D NULL; } @@ -1428,7 +1428,7 @@ virNetworkObjListExport(virConnectPtr conn, =20 ret =3D data.nnets; cleanup: - virObjectRWUnlock(netobjs); + virObjectRWUnlockWrite(netobjs); while (data.nets && data.nnets) virObjectUnref(data.nets[--data.nnets]); =20 @@ -1478,7 +1478,7 @@ virNetworkObjListForEach(virNetworkObjListPtr nets, .callback =3D callback, .opaque =3D opaque, .ret =3D 0}; virObjectRWLockRead(nets); virHashForEach(nets->objs, virNetworkObjListForEachHelper, &data); - virObjectRWUnlock(nets); + virObjectRWUnlockRead(nets); return data.ret; } =20 @@ -1543,7 +1543,7 @@ virNetworkObjListGetNames(virNetworkObjListPtr nets, =20 virObjectRWLockRead(nets); virHashForEach(nets->objs, virNetworkObjListGetHelper, &data); - virObjectRWUnlock(nets); + virObjectRWUnlockRead(nets); =20 if (data.error) goto cleanup; @@ -1570,7 +1570,7 @@ virNetworkObjListNumOfNetworks(virNetworkObjListPtr n= ets, =20 virObjectRWLockRead(nets); virHashForEach(nets->objs, virNetworkObjListGetHelper, &data); - virObjectRWUnlock(nets); + virObjectRWUnlockRead(nets); =20 return data.nnames; } @@ -1612,7 +1612,7 @@ virNetworkObjListPrune(virNetworkObjListPtr nets, =20 virObjectRWLockWrite(nets); virHashRemoveSet(nets->objs, virNetworkObjListPruneHelper, &data); - virObjectRWUnlock(nets); + virObjectRWUnlockWrite(nets); } =20 =20 diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 3a34a324ca..14abf77cbf 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -188,7 +188,7 @@ virNodeDeviceObjListSearch(virNodeDeviceObjListPtr devs, virObjectRWLockRead(devs); obj =3D virHashSearch(devs->objs, callback, data, NULL); virObjectRef(obj); - virObjectRWUnlock(devs); + virObjectRWUnlockRead(devs); =20 if (obj) virObjectLock(obj); @@ -241,7 +241,7 @@ virNodeDeviceObjListFindByName(virNodeDeviceObjListPtr = devs, =20 virObjectRWLockRead(devs); obj =3D virNodeDeviceObjListFindByNameLocked(devs, name); - virObjectRWUnlock(devs); + virObjectRWUnlockRead(devs); if (obj) virObjectLock(obj); =20 @@ -462,7 +462,7 @@ virNodeDeviceObjListAssignDef(virNodeDeviceObjListPtr d= evs, } =20 cleanup: - virObjectRWUnlock(devs); + virObjectRWUnlockWrite(devs); return obj; } =20 @@ -484,7 +484,7 @@ virNodeDeviceObjListRemove(virNodeDeviceObjListPtr devs, virHashRemoveEntry(devs->objs, def->name); virObjectUnlock(obj); virObjectUnref(obj); - virObjectRWUnlock(devs); + virObjectRWUnlockWrite(devs); } =20 =20 @@ -724,7 +724,7 @@ virNodeDeviceObjListNumOfDevices(virNodeDeviceObjListPt= r devs, =20 virObjectRWLockRead(devs); virHashForEach(devs->objs, virNodeDeviceObjListNumOfDevicesCallback, &= data); - virObjectRWUnlock(devs); + virObjectRWUnlockRead(devs); =20 return data.count; } @@ -784,7 +784,7 @@ virNodeDeviceObjListGetNames(virNodeDeviceObjListPtr de= vs, =20 virObjectRWLockRead(devs); virHashForEach(devs->objs, virNodeDeviceObjListGetNamesCallback, &data= ); - virObjectRWUnlock(devs); + virObjectRWUnlockRead(devs); =20 if (data.error) goto error; @@ -896,12 +896,12 @@ virNodeDeviceObjListExport(virConnectPtr conn, virObjectRWLockRead(devs); if (devices && VIR_ALLOC_N(data.devices, virHashSize(devs->objs) + 1) < 0) { - virObjectRWUnlock(devs); + virObjectRWUnlockRead(devs); return -1; } =20 virHashForEach(devs->objs, virNodeDeviceObjListExportCallback, &data); - virObjectRWUnlock(devs); + virObjectRWUnlockRead(devs); =20 if (data.error) goto cleanup; diff --git a/src/conf/virnwfilterbindingobjlist.c b/src/conf/virnwfilterbin= dingobjlist.c index 97e4d3c49b..64b75a0cc3 100644 --- a/src/conf/virnwfilterbindingobjlist.c +++ b/src/conf/virnwfilterbindingobjlist.c @@ -115,7 +115,7 @@ virNWFilterBindingObjListFindByPortDev(virNWFilterBindi= ngObjListPtr bindings, =20 virObjectRWLockRead(bindings); obj =3D virNWFilterBindingObjListFindByPortDevLocked(bindings, name); - virObjectRWUnlock(bindings); + virObjectRWUnlockRead(bindings); =20 if (obj && virNWFilterBindingObjGetRemoving(obj)) { virObjectUnlock(obj); @@ -212,7 +212,7 @@ virNWFilterBindingObjListAdd(virNWFilterBindingObjListP= tr bindings, =20 virObjectRWLockWrite(bindings); ret =3D virNWFilterBindingObjListAddLocked(bindings, def); - virObjectRWUnlock(bindings); + virObjectRWUnlockWrite(bindings); return ret; } =20 @@ -256,7 +256,7 @@ virNWFilterBindingObjListRemove(virNWFilterBindingObjLi= stPtr bindings, virObjectLock(binding); virNWFilterBindingObjListRemoveLocked(bindings, binding); virObjectUnref(binding); - virObjectRWUnlock(bindings); + virObjectRWUnlockWrite(bindings); } =20 =20 @@ -331,7 +331,7 @@ virNWFilterBindingObjListLoadAllConfigs(virNWFilterBind= ingObjListPtr bindings, } =20 VIR_DIR_CLOSE(dir); - virObjectRWUnlock(bindings); + virObjectRWUnlockWrite(bindings); return ret; } =20 @@ -366,7 +366,7 @@ virNWFilterBindingObjListForEach(virNWFilterBindingObjL= istPtr bindings, }; virObjectRWLockRead(bindings); virHashForEach(bindings->objs, virNWFilterBindingObjListHelper, &data); - virObjectRWUnlock(bindings); + virObjectRWUnlockRead(bindings); return data.ret; } =20 @@ -435,12 +435,12 @@ virNWFilterBindingObjListCollect(virNWFilterBindingOb= jListPtr domlist, virObjectRWLockRead(domlist); sa_assert(domlist->objs); if (VIR_ALLOC_N(data.bindings, virHashSize(domlist->objs)) < 0) { - virObjectRWUnlock(domlist); + virObjectRWUnlockRead(domlist); return -1; } =20 virHashForEach(domlist->objs, virNWFilterBindingObjListCollectIterator= , &data); - virObjectRWUnlock(domlist); + virObjectRWUnlockRead(domlist); =20 virNWFilterBindingObjListFilter(&data.bindings, &data.nbindings, conn,= filter); =20 diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c index 81c9f2c346..77cf03ad74 100644 --- a/src/conf/virsecretobj.c +++ b/src/conf/virsecretobj.c @@ -188,7 +188,7 @@ virSecretObjListFindByUUID(virSecretObjListPtr secrets, =20 virObjectRWLockRead(secrets); obj =3D virSecretObjListFindByUUIDLocked(secrets, uuidstr); - virObjectRWUnlock(secrets); + virObjectRWUnlockRead(secrets); if (obj) virObjectLock(obj); return obj; @@ -267,7 +267,7 @@ virSecretObjListFindByUsage(virSecretObjListPtr secrets, =20 virObjectRWLockRead(secrets); obj =3D virSecretObjListFindByUsageLocked(secrets, usageType, usageID); - virObjectRWUnlock(secrets); + virObjectRWUnlockRead(secrets); if (obj) virObjectLock(obj); return obj; @@ -303,7 +303,7 @@ virSecretObjListRemove(virSecretObjListPtr secrets, virHashRemoveEntry(secrets->objs, uuidstr); virObjectUnlock(obj); virObjectUnref(obj); - virObjectRWUnlock(secrets); + virObjectRWUnlockWrite(secrets); } =20 =20 @@ -397,7 +397,7 @@ virSecretObjListAdd(virSecretObjListPtr secrets, =20 cleanup: virSecretObjEndAPI(&obj); - virObjectRWUnlock(secrets); + virObjectRWUnlockWrite(secrets); return ret; } =20 @@ -490,7 +490,7 @@ virSecretObjListNumOfSecrets(virSecretObjListPtr secret= s, =20 virObjectRWLockRead(secrets); virHashForEach(secrets->objs, virSecretObjListNumOfSecretsCallback, &d= ata); - virObjectRWUnlock(secrets); + virObjectRWUnlockRead(secrets); =20 return data.count; } @@ -592,12 +592,12 @@ virSecretObjListExport(virConnectPtr conn, virObjectRWLockRead(secretobjs); if (secrets && VIR_ALLOC_N(data.secrets, virHashSize(secretobjs->objs) + 1) < 0) { - virObjectRWUnlock(secretobjs); + virObjectRWUnlockRead(secretobjs); return -1; } =20 virHashForEach(secretobjs->objs, virSecretObjListExportCallback, &data= ); - virObjectRWUnlock(secretobjs); + virObjectRWUnlockRead(secretobjs); =20 if (data.error) goto error; @@ -629,7 +629,7 @@ virSecretObjListGetUUIDs(virSecretObjListPtr secrets, =20 virObjectRWLockRead(secrets); virHashForEach(secrets->objs, virSecretObjListGetUUIDsCallback, &data); - virObjectRWUnlock(secrets); + virObjectRWUnlockRead(secrets); =20 if (data.error) goto error; diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 5cbd30f93c..2f1e9e72aa 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -515,7 +515,7 @@ virStoragePoolObjListSearch(virStoragePoolObjListPtr po= ols, =20 virObjectRWLockRead(pools); obj =3D virHashSearch(pools->objs, virStoragePoolObjListSearchCb, &dat= a, NULL); - virObjectRWUnlock(pools); + virObjectRWUnlockRead(pools); =20 return virObjectRef(obj); } @@ -535,7 +535,7 @@ virStoragePoolObjRemove(virStoragePoolObjListPtr pools, virHashRemoveEntry(pools->objs, uuidstr); virHashRemoveEntry(pools->objsName, obj->def->name); virObjectUnref(obj); - virObjectRWUnlock(pools); + virObjectRWUnlockWrite(pools); } =20 =20 @@ -568,7 +568,7 @@ virStoragePoolObjFindByUUID(virStoragePoolObjListPtr po= ols, =20 virObjectRWLockRead(pools); obj =3D virStoragePoolObjFindByUUIDLocked(pools, uuid); - virObjectRWUnlock(pools); + virObjectRWUnlockRead(pools); if (obj) virObjectLock(obj); =20 @@ -601,7 +601,7 @@ virStoragePoolObjFindByName(virStoragePoolObjListPtr po= ols, =20 virObjectRWLockRead(pools); obj =3D virStoragePoolObjFindByNameLocked(pools, name); - virObjectRWUnlock(pools); + virObjectRWUnlockRead(pools); if (obj) virObjectLock(obj); =20 @@ -668,13 +668,13 @@ virStoragePoolObjAddVol(virStoragePoolObjPtr obj, virObjectRef(volobj); =20 volobj->voldef =3D voldef; - virObjectRWUnlock(volumes); + virObjectRWUnlockWrite(volumes); virStorageVolObjEndAPI(&volobj); return 0; =20 error: virStorageVolObjEndAPI(&volobj); - virObjectRWUnlock(volumes); + virObjectRWUnlockWrite(volumes); return -1; } =20 @@ -691,7 +691,7 @@ virStoragePoolObjRemoveVol(virStoragePoolObjPtr obj, if (!volobj) { VIR_INFO("Cannot find volume '%s' from storage pool '%s'", voldef->name, obj->def->name); - virObjectRWUnlock(volumes); + virObjectRWUnlockWrite(volumes); return; } VIR_INFO("Deleting volume '%s' from storage pool '%s'", @@ -704,7 +704,7 @@ virStoragePoolObjRemoveVol(virStoragePoolObjPtr obj, virHashRemoveEntry(volumes->objsPath, voldef->target.path); virStorageVolObjEndAPI(&volobj); =20 - virObjectRWUnlock(volumes); + virObjectRWUnlockWrite(volumes); } =20 =20 @@ -715,7 +715,7 @@ virStoragePoolObjGetVolumesCount(virStoragePoolObjPtr o= bj) =20 virObjectRWLockRead(obj->volumes); nbElems =3D virHashSize(obj->volumes->objsKey); - virObjectRWUnlock(obj->volumes); + virObjectRWUnlockRead(obj->volumes); =20 return nbElems; } @@ -755,7 +755,7 @@ virStoragePoolObjForEachVolume(virStoragePoolObjPtr obj, virObjectRWLockRead(obj->volumes); virHashForEach(obj->volumes->objsKey, virStoragePoolObjForEachVolumeCb, &data); - virObjectRWUnlock(obj->volumes); + virObjectRWUnlockRead(obj->volumes); return 0; } =20 @@ -797,7 +797,7 @@ virStoragePoolObjSearchVolume(virStoragePoolObjPtr obj, volobj =3D virHashSearch(obj->volumes->objsKey, virStoragePoolObjSearchVolumeCb, &data, NULL); - virObjectRWUnlock(obj->volumes); + virObjectRWUnlockRead(obj->volumes); =20 if (volobj) return volobj->voldef; @@ -814,7 +814,7 @@ virStorageVolDefFindByKey(virStoragePoolObjPtr obj, =20 virObjectRWLockRead(obj->volumes); volobj =3D virHashLookup(obj->volumes->objsKey, key); - virObjectRWUnlock(obj->volumes); + virObjectRWUnlockRead(obj->volumes); =20 if (volobj) return volobj->voldef; @@ -830,7 +830,7 @@ virStorageVolDefFindByPath(virStoragePoolObjPtr obj, =20 virObjectRWLockRead(obj->volumes); volobj =3D virHashLookup(obj->volumes->objsPath, path); - virObjectRWUnlock(obj->volumes); + virObjectRWUnlockRead(obj->volumes); =20 if (volobj) return volobj->voldef; @@ -846,7 +846,7 @@ virStorageVolDefFindByName(virStoragePoolObjPtr obj, =20 virObjectRWLockRead(obj->volumes); volobj =3D virHashLookup(obj->volumes->objsName, name); - virObjectRWUnlock(obj->volumes); + virObjectRWUnlockRead(obj->volumes); =20 if (volobj) return volobj->voldef; @@ -895,7 +895,7 @@ virStoragePoolObjNumOfVolumes(virStoragePoolObjPtr obj, =20 virObjectRWLockRead(volumes); virHashForEach(volumes->objsName, virStoragePoolObjNumOfVolumesCb, &da= ta); - virObjectRWUnlock(volumes); + virObjectRWUnlockRead(volumes); =20 return data.count; } @@ -956,7 +956,7 @@ virStoragePoolObjVolumeGetNames(virStoragePoolObjPtr ob= j, =20 virObjectRWLockRead(volumes); virHashForEach(volumes->objsName, virStoragePoolObjVolumeGetNamesCb, &= data); - virObjectRWUnlock(volumes); + virObjectRWUnlockRead(volumes); =20 if (data.error) goto error; @@ -1032,17 +1032,17 @@ virStoragePoolObjVolumeListExport(virConnectPtr con= n, =20 if (!vols) { int ret =3D virHashSize(volumes->objsName); - virObjectRWUnlock(volumes); + virObjectRWUnlockRead(volumes); return ret; } =20 if (VIR_ALLOC_N(data.vols, virHashSize(volumes->objsName) + 1) < 0) { - virObjectRWUnlock(volumes); + virObjectRWUnlockRead(volumes); return -1; } =20 virHashForEach(volumes->objsName, virStoragePoolObjVolumeListExportCal= lback, &data); - virObjectRWUnlock(volumes); + virObjectRWUnlockRead(volumes); =20 if (data.error) goto error; @@ -1584,7 +1584,7 @@ virStoragePoolObjListAdd(virStoragePoolObjListPtr poo= ls, goto error; if (rc > 0) { virStoragePoolObjAssignDef(obj, def, flags); - virObjectRWUnlock(pools); + virObjectRWUnlockWrite(pools); return obj; } =20 @@ -1602,12 +1602,12 @@ virStoragePoolObjListAdd(virStoragePoolObjListPtr p= ools, } virObjectRef(obj); obj->def =3D def; - virObjectRWUnlock(pools); + virObjectRWUnlockWrite(pools); return obj; =20 error: virStoragePoolObjEndAPI(&obj); - virObjectRWUnlock(pools); + virObjectRWUnlockWrite(pools); return NULL; } =20 @@ -1867,7 +1867,7 @@ virStoragePoolObjNumOfStoragePools(virStoragePoolObjL= istPtr pools, =20 virObjectRWLockRead(pools); virHashForEach(pools->objs, virStoragePoolObjNumOfStoragePoolsCb, &dat= a); - virObjectRWUnlock(pools); + virObjectRWUnlockRead(pools); =20 return data.count; } @@ -1931,7 +1931,7 @@ virStoragePoolObjGetNames(virStoragePoolObjListPtr po= ols, =20 virObjectRWLockRead(pools); virHashForEach(pools->objs, virStoragePoolObjGetNamesCb, &data); - virObjectRWUnlock(pools); + virObjectRWUnlockRead(pools); =20 if (data.error) goto error; @@ -2081,7 +2081,7 @@ virStoragePoolObjListExport(virConnectPtr conn, goto error; =20 virHashForEach(poolobjs->objs, virStoragePoolObjListExportCallback, &d= ata); - virObjectRWUnlock(poolobjs); + virObjectRWUnlockRead(poolobjs); =20 if (data.error) goto error; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c95c1a078c..c2abbf65c2 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2745,7 +2745,8 @@ virObjectRef; virObjectRWLockableNew; virObjectRWLockRead; virObjectRWLockWrite; -virObjectRWUnlock; +virObjectRWUnlockRead; +virObjectRWUnlockWrite; virObjectUnlock; virObjectUnref; =20 diff --git a/src/util/virobject.c b/src/util/virobject.c index c71781550f..aee1bb4af6 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -294,12 +294,7 @@ virObjectRWLockableNew(virClassPtr klass) if (!(obj =3D virObjectNew(klass))) return NULL; =20 - if (virRWLockInit(&obj->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize RW lock")); - virObjectUnref(obj); - return NULL; - } + g_rw_lock_init(&obj->lock); =20 return obj; } @@ -319,7 +314,7 @@ virObjectRWLockableDispose(void *anyobj) { virObjectRWLockablePtr obj =3D anyobj; =20 - virRWLockDestroy(&obj->lock); + g_rw_lock_clear(&obj->lock); } =20 =20 @@ -458,7 +453,7 @@ virObjectRWLockRead(void *anyobj) if (!obj) return; =20 - virRWLockRead(&obj->lock); + g_rw_lock_reader_lock(&obj->lock); } =20 =20 @@ -487,7 +482,7 @@ virObjectRWLockWrite(void *anyobj) if (!obj) return; =20 - virRWLockWrite(&obj->lock); + g_rw_lock_writer_lock(&obj->lock); } =20 =20 @@ -518,16 +513,26 @@ virObjectUnlock(void *anyobj) * virObjectRWLockRead or virObjectRWLockWrite. */ void -virObjectRWUnlock(void *anyobj) +virObjectRWUnlockWrite(void *anyobj) { virObjectRWLockablePtr obj =3D virObjectGetRWLockableObj(anyobj); =20 if (!obj) return; =20 - virRWLockUnlock(&obj->lock); + g_rw_lock_writer_unlock(&obj->lock); } =20 +void +virObjectRWUnlockRead(void *anyobj) +{ + virObjectRWLockablePtr obj =3D virObjectGetRWLockableObj(anyobj); + + if (!obj) + return; + + g_rw_lock_reader_unlock(&obj->lock); +} =20 /** * virObjectIsClass: diff --git a/src/util/virobject.h b/src/util/virobject.h index 62a8a3d132..fcfe77578b 100644 --- a/src/util/virobject.h +++ b/src/util/virobject.h @@ -63,7 +63,7 @@ struct _virObjectLockable { =20 struct _virObjectRWLockable { virObject parent; - virRWLock lock; + GRWLock lock; }; =20 virClassPtr virClassForObject(void); @@ -150,7 +150,11 @@ virObjectUnlock(void *lockableobj) ATTRIBUTE_NONNULL(1); =20 void -virObjectRWUnlock(void *lockableobj) +virObjectRWUnlockRead(void *lockableobj) + ATTRIBUTE_NONNULL(1); + +void +virObjectRWUnlockWrite(void *lockableobj) ATTRIBUTE_NONNULL(1); =20 void --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1586527022; cv=none; d=zohomail.com; s=zohoarc; b=Nd24cbzovkwlD/Z8w9yUDokAh1TSDXx1mlRFv+D1piV8lFh2KyIpwweT5ece1dGIHPmFl2WRMzOqL0gd9qm8HTBLpWoD7WsYU1Ro607uAvP4L9YCkYRrmoAs8o//7UnUfMemrd2AM39A53/Qu1QtrtRe5V7KsvCyBrWnCB49SUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527022; 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=UPQKItS1ytxTIY2LKXrZpSlruMF0fmSo7mjBJpfL6cw=; b=lNPY265jIWrNaGadetJpRW1H7dxATzppIKJaxaXqSCbf4K5R2IOCTO6YGkSgNG4VTzvbrWWGS8/X+t01dhvazt29R4XvbQMoEfHIs/CMS/9ho1yn59rIbyri7+FFhSN7oFq4dBMWuMJdCZHavIyLupLGaGQ+zd678nWOw33d0sk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586527022626660.0342765355172; Fri, 10 Apr 2020 06:57:02 -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-386-ubdNZ9dwPaq4RycRf2l87g-1; Fri, 10 Apr 2020 09:56:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A099018B5F6B; Fri, 10 Apr 2020 13:56:52 +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 7BBC69E0C6; Fri, 10 Apr 2020 13:56:52 +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 3425193F4F; Fri, 10 Apr 2020 13:56:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuPBq023394 for ; Fri, 10 Apr 2020 09:56:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id A15052166B35; Fri, 10 Apr 2020 13:56:25 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D0AD2166B34 for ; Fri, 10 Apr 2020 13:56:25 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 83A8E101A55D for ; Fri, 10 Apr 2020 13:56:25 +0000 (UTC) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-120-K9_CD5ypO9KSLgPIbkHZEA-1; Fri, 10 Apr 2020 09:56:23 -0400 Received: by mail-wr1-f45.google.com with SMTP id h9so2372231wrc.8 for ; Fri, 10 Apr 2020 06:56:22 -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.56.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527021; 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=UPQKItS1ytxTIY2LKXrZpSlruMF0fmSo7mjBJpfL6cw=; b=FAOKwunw/yqa4Dp81wHeNnMnS1yzKglefW0zq+hRZx8qcaOLLqA65sI5+ErN0SagjVQHDF Fdsv/7/cYSRDvO9loOCblkg+B7PmYcqYORxG2qQY4YMvYnDXG9k21NgWL0ue9LvjN5VouY gZLwLt0+p//LC95yBjjHSwxdlkGFXUQ= X-MC-Unique: ubdNZ9dwPaq4RycRf2l87g-1 X-MC-Unique: K9_CD5ypO9KSLgPIbkHZEA-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=G3zh9w6xmXN8o1I44yFxGevWj7JqA3yqCAasdVtD2Ng=; b=VenbdWRvUN/GFQTffVxuXtknMwZjf3uFTP9CwmbG9gQePbubXD2M9vulrdSyqUG0Vw za2aGyzB4BFQbiSdAKlv7ybSj+wf2BBcsMvoZSAacG9yB8Jg5ClhxE1fltSWG2a5F1Yo +hyEtWa0BjkdmGJ3AeMGB69hteX9w6G33mkkUIsgZ8NhS3rCtFCJVZ8DwZmt1s5T59Fx Cf8BJa35PGc8Bf34epdwJK9mhsShXU9zBHARsC5S+g6uR8gX0TfbIJR9aEKE+eLAxPhA +2wgRYbLk+ayGoQxVRd0XPS47wwiLe4WaPgjC0DzEnElrAq2YROwFiwDjRbVh/AOUNqw +Q1Q== X-Gm-Message-State: AGi0Pub9VSGEcTJXb4zmwlbnBsPnkgvDhQ1V8eW99XHligtNYein7f03 OrSecj/KsLSf4NT1p9HOeBRHAMnHWrw= X-Google-Smtp-Source: APiQypLc0F5ml8+R7Z80BLR5wWkmQzY40Gb2SgBmtd5687C8aa+3rAg5sbN3YJgVooRuqCoAbHndWw== X-Received: by 2002:adf:e282:: with SMTP id v2mr4691891wri.329.1586526981602; Fri, 10 Apr 2020 06:56:21 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 41/43] util: virthread: remove virRWLock Date: Fri, 10 Apr 2020 15:55:08 +0200 Message-Id: <20200410135510.2148319-42-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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuPBq023394 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.13 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" All instances where virRWLock where used were replaced by GRWLock. Signed-off-by: Rafael Fonseca --- src/libvirt_private.syms | 5 ----- src/util/virthread.c | 33 --------------------------------- src/util/virthread.h | 16 ---------------- 3 files changed, 54 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c2abbf65c2..4dfafdfd3e 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3271,11 +3271,6 @@ virMutexInitRecursive; virMutexLock; virMutexUnlock; virOnce; -virRWLockDestroy; -virRWLockInit; -virRWLockRead; -virRWLockUnlock; -virRWLockWrite; virThreadCancel; virThreadCreateFull; virThreadID; diff --git a/src/util/virthread.c b/src/util/virthread.c index 64013b575c..1ec5096ced 100644 --- a/src/util/virthread.c +++ b/src/util/virthread.c @@ -89,39 +89,6 @@ void virMutexUnlock(virMutexPtr m) } =20 =20 -int virRWLockInit(virRWLockPtr m) -{ - int ret; - ret =3D pthread_rwlock_init(&m->lock, NULL); - if (ret !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -void virRWLockDestroy(virRWLockPtr m) -{ - pthread_rwlock_destroy(&m->lock); -} - - -void virRWLockRead(virRWLockPtr m) -{ - pthread_rwlock_rdlock(&m->lock); -} - -void virRWLockWrite(virRWLockPtr m) -{ - pthread_rwlock_wrlock(&m->lock); -} - - -void virRWLockUnlock(virRWLockPtr m) -{ - pthread_rwlock_unlock(&m->lock); -} - int virCondInit(virCondPtr c) { int ret; diff --git a/src/util/virthread.h b/src/util/virthread.h index c227951ddd..a57c99bdf0 100644 --- a/src/util/virthread.h +++ b/src/util/virthread.h @@ -33,14 +33,6 @@ struct virMutex { pthread_mutex_t lock; }; =20 -typedef struct virRWLock virRWLock; -typedef virRWLock *virRWLockPtr; - -struct virRWLock { - pthread_rwlock_t lock; -}; - - typedef struct virCond virCond; typedef virCond *virCondPtr; =20 @@ -133,14 +125,6 @@ void virMutexLock(virMutexPtr m); void virMutexUnlock(virMutexPtr m); =20 =20 -int virRWLockInit(virRWLockPtr m) G_GNUC_WARN_UNUSED_RESULT; -void virRWLockDestroy(virRWLockPtr m); - -void virRWLockRead(virRWLockPtr m); -void virRWLockWrite(virRWLockPtr m); -void virRWLockUnlock(virRWLockPtr m); - - int virCondInit(virCondPtr c) G_GNUC_WARN_UNUSED_RESULT; int virCondDestroy(virCondPtr c); =20 --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1586527021; cv=none; d=zohomail.com; s=zohoarc; b=CeGyyunlki2QlB6KyZWGU8XYFyrcqcVWbvAci17e0MtfTVxzhNkzBET3x4my3XrvECaeH0k/MMIcQtBYhLk0E3ypL6nO/gsWkkuiby8PEyQarfLd7+v3VXFOUomXvtqCzQL6SoBKFwtzmJPpdvOQounzfrxAbVprd3EZRJcd3K8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527021; 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=qvbLaCaW1H9Pn8huEeQjhEDfA5p5zReQYgS9UJtNFE0=; b=j///2RELu6p9n4CB58Yj8sG2WUGXfTo0eyJhwiYVRSz9ahohAiC/SAwKonZCuDvDvzoKDu/mlJ82iSaQiB7Qd/B1xwilEz2boJgKaXC8qzBXn+M8/fAGuVmAxyJsrTJNcJZ3y+1Q5WCmTXmO/wuK0/IFisvy1pFrxiTDRGfy/VU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586527021383555.6964475818581; Fri, 10 Apr 2020 06:57:01 -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-194-_Kd3wUZNPU2SO14gBNkzKg-1; Fri, 10 Apr 2020 09:56:57 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 746FF800D5B; Fri, 10 Apr 2020 13:56:51 +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 47B861B464; Fri, 10 Apr 2020 13:56:51 +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 F1FA093F4B; Fri, 10 Apr 2020 13:56:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03ADuUF9023457 for ; Fri, 10 Apr 2020 09:56:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id A28FA2026FFE; Fri, 10 Apr 2020 13:56:30 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99C412028CD4 for ; Fri, 10 Apr 2020 13:56:28 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 78D7D802D23 for ; Fri, 10 Apr 2020 13:56:28 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-UEHZYbGeOsu998pnlxxO_Q-1; Fri, 10 Apr 2020 09:56:25 -0400 Received: by mail-wm1-f65.google.com with SMTP id a201so2443463wme.1 for ; Fri, 10 Apr 2020 06:56:25 -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.56.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527020; 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=qvbLaCaW1H9Pn8huEeQjhEDfA5p5zReQYgS9UJtNFE0=; b=KHk2i+iCSDloUEO0E3fbhODB5LB8EIkcmBV1nyZJZm1Resda9Mvnvzy+q5sKEzv/UYb/Ue wrPJjJNy5vLlQyfHPRxbhr1MKZhxlV/PEIt06yFNo5/JPRaXUtrfj1OXgwmGyrKBilUWLR bhyPA5Ahhcu61A8RwvH8QwGAKYLEYoc= X-MC-Unique: _Kd3wUZNPU2SO14gBNkzKg-1 X-MC-Unique: UEHZYbGeOsu998pnlxxO_Q-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=XFjtNYB1CjiuEiwR7GTpO3oWLNIZFWB3LSZYSS6mdsc=; b=BiFLIkjq741XSdJ6bcaO5P+zqGeKwCuDylezjZkVRZSD9/8f/DLFVQRo8LN1nJrLID frC5ENS4DE3qooWqY8a0lJCIPmFgSEkZXJtd/PbBe63zz5rMSelXzuKvo7KqVhbbzd4m DOSyGbxNa1NSytkRLAvO88tFwY9/Gm3BXcpenKueTqY325+9AXcx3kGb0DpGwp8/plr2 UFb5WP1kCLZalhbXlo1ND4x8dhFRThvbuNZt4ZGGHdNC+aV4Q9PepR4xLrPsNe3TeESA knZpwHDSiE3uQU0bayVij0aNpdbObtxsm+U+oCROw9098f9Jn0IBXE1NP4cHQVpZRXGx QFMw== X-Gm-Message-State: AGi0PuZOSs/aavh8pDRIZfDKlRYe/u+FKVwwNn8kkDJ7Ct4+dV40fD82 k8tkmeTz3+zRWPMJhqO41rTlh6xWnqY= X-Google-Smtp-Source: APiQypIDOY7COhSszmXu50qBphXdp/16G28vcAoz+i4eCnLPLbGZWhQtJhgBTCSUFy+N3tsuQe+aRw== X-Received: by 2002:a7b:ce0b:: with SMTP id m11mr5382899wmc.67.1586526983101; Fri, 10 Apr 2020 06:56:23 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 42/43] util: virObjectLockable: convert virMutex to GMutex Date: Fri, 10 Apr 2020 15:55:09 +0200 Message-Id: <20200410135510.2148319-43-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.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 03ADuUF9023457 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.16 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" Because virCond usage is connected to virMutex, this patch also converts virCond to GCond. An important note to make here: GMutex doesn't like when you try to clear a lock that's still locked. So I had to hunt the few cases where that happened and add an explicit virObjectUnlock call before unreffing the object. Signed-off-by: Rafael Fonseca --- src/conf/domain_conf.c | 27 ++------- src/conf/domain_conf.h | 5 +- src/libxl/libxl_domain.c | 18 ++---- src/libxl/libxl_domain.h | 2 +- src/lxc/lxc_domain.c | 18 ++---- src/lxc/lxc_domain.h | 2 +- src/node_device/node_device_udev.c | 22 +++---- src/qemu/qemu_agent.c | 50 +++++++--------- src/qemu/qemu_domain.c | 95 ++++++++++++++---------------- src/qemu/qemu_domain.h | 4 +- src/qemu/qemu_hotplug.c | 28 +++------ src/qemu/qemu_hotplug.h | 2 +- src/qemu/qemu_monitor.c | 27 ++++----- src/rpc/virnetclient.c | 25 +++----- src/util/virfdstream.c | 26 +++----- src/util/virobject.c | 13 ++-- src/util/virobject.h | 2 +- src/vz/vz_utils.c | 41 ++++--------- src/vz/vz_utils.h | 6 +- tests/qemuhotplugmock.c | 6 +- tests/qemuhotplugtest.c | 2 + tests/qemumonitortestutils.c | 5 ++ tests/qemusecuritytest.c | 10 +++- tests/qemuxml2argvtest.c | 1 + tools/virsh-console.c | 23 ++------ 25 files changed, 172 insertions(+), 288 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 639d471424..d4629a936a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3535,7 +3535,7 @@ static void virDomainObjDispose(void *obj) virDomainObjPtr dom =3D obj; =20 VIR_DEBUG("obj=3D%p", dom); - virCondDestroy(&dom->cond); + g_cond_clear(&dom->cond); virDomainDefFree(dom->def); virDomainDefFree(dom->newDef); =20 @@ -3557,11 +3557,7 @@ virDomainObjNew(virDomainXMLOptionPtr xmlopt) if (!(domain =3D virObjectLockableNew(virDomainObjClass))) return NULL; =20 - if (virCondInit(&domain->cond) < 0) { - virReportSystemError(errno, "%s", - _("failed to initialize domain condition")); - goto error; - } + g_cond_init(&domain->cond); =20 if (xmlopt->privateData.alloc) { domain->privateData =3D (xmlopt->privateData.alloc)(xmlopt->config= .priv); @@ -3670,18 +3666,14 @@ virDomainObjEndAPI(virDomainObjPtr *vm) void virDomainObjBroadcast(virDomainObjPtr vm) { - virCondBroadcast(&vm->cond); + g_cond_broadcast(&vm->cond); } =20 =20 int virDomainObjWait(virDomainObjPtr vm) { - if (virCondWait(&vm->cond, &vm->parent.lock) < 0) { - virReportSystemError(errno, "%s", - _("failed to wait for domain condition")); - return -1; - } + g_cond_wait(&vm->cond, &vm->parent.lock); =20 if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", @@ -3697,22 +3689,15 @@ virDomainObjWait(virDomainObjPtr vm) * Waits for domain condition to be triggered for a specific period of tim= e. * * Returns: - * -1 in case of error * 0 on success * 1 on timeout */ int virDomainObjWaitUntil(virDomainObjPtr vm, - unsigned long long whenms) + gint64 whenms) { - if (virCondWaitUntil(&vm->cond, &vm->parent.lock, whenms) < 0) { - if (errno !=3D ETIMEDOUT) { - virReportSystemError(errno, "%s", - _("failed to wait for domain condition")); - return -1; - } + if (!g_cond_wait_until(&vm->cond, &vm->parent.lock, whenms)) return 1; - } return 0; } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9310fab169..647baf40b2 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2630,7 +2630,7 @@ struct _virDomainStateReason { =20 struct _virDomainObj { virObjectLockable parent; - virCond cond; + GCond cond; =20 pid_t pid; virDomainStateReason state; @@ -2892,8 +2892,7 @@ bool virDomainObjTaint(virDomainObjPtr obj, =20 void virDomainObjBroadcast(virDomainObjPtr vm); int virDomainObjWait(virDomainObjPtr vm); -int virDomainObjWaitUntil(virDomainObjPtr vm, - unsigned long long whenms); +int virDomainObjWaitUntil(virDomainObjPtr vm, gint64 whenms); =20 void virDomainPanicDefFree(virDomainPanicDefPtr panic); void virDomainResourceDefFree(virDomainResourceDefPtr resource); diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index cc53a765e1..671e49670b 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -69,8 +69,7 @@ libxlDomainObjInitJob(libxlDomainObjPrivatePtr priv) { memset(&priv->job, 0, sizeof(priv->job)); =20 - if (virCondInit(&priv->job.cond) < 0) - return -1; + g_cond_init(&priv->job.cond); =20 if (VIR_ALLOC(priv->job.current) < 0) return -1; @@ -90,12 +89,12 @@ libxlDomainObjResetJob(libxlDomainObjPrivatePtr priv) static void libxlDomainObjFreeJob(libxlDomainObjPrivatePtr priv) { - ignore_value(virCondDestroy(&priv->job.cond)); + g_cond_clear(&priv->job.cond); VIR_FREE(priv->job.current); } =20 /* Give up waiting for mutex after 30 seconds */ -#define LIBXL_JOB_WAIT_TIME (1000ull * 30) +#define LIBXL_JOB_WAIT_TIME (30 * G_TIME_SPAN_SECOND) =20 /* * obj must be locked before calling, libxlDriverPrivatePtr must NOT be lo= cked @@ -112,17 +111,12 @@ libxlDomainObjBeginJob(libxlDriverPrivatePtr driver G= _GNUC_UNUSED, enum libxlDomainJob job) { libxlDomainObjPrivatePtr priv =3D obj->privateData; - unsigned long long now; - unsigned long long then; - - if (virTimeMillisNow(&now) < 0) - return -1; - then =3D now + LIBXL_JOB_WAIT_TIME; + gint64 then =3D g_get_monotonic_time() + LIBXL_JOB_WAIT_TIME; =20 while (priv->job.active) { VIR_DEBUG("Wait normal job condition for starting job: %s", libxlDomainJobTypeToString(job)); - if (virCondWaitUntil(&priv->job.cond, &obj->parent.lock, then) < 0) + if (!g_cond_wait_until(&priv->job.cond, &obj->parent.lock, then)) goto error; } =20 @@ -175,7 +169,7 @@ libxlDomainObjEndJob(libxlDriverPrivatePtr driver G_GNU= C_UNUSED, libxlDomainJobTypeToString(job)); =20 libxlDomainObjResetJob(priv); - virCondSignal(&priv->job.cond); + g_cond_signal(&priv->job.cond); } =20 int diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h index 7e28093722..5f04f3aacb 100644 --- a/src/libxl/libxl_domain.h +++ b/src/libxl/libxl_domain.h @@ -47,7 +47,7 @@ VIR_ENUM_DECL(libxlDomainJob); =20 =20 struct libxlDomainJobObj { - virCond cond; /* Use to coordinate jobs */ + GCond cond; /* Use to coordinate jobs */ enum libxlDomainJob active; /* Currently running job */ int owner; /* Thread which set current job */ unsigned long long started; /* When the job started */ diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index 59f803837a..a09788dd12 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -50,8 +50,7 @@ virLXCDomainObjInitJob(virLXCDomainObjPrivatePtr priv) { memset(&priv->job, 0, sizeof(priv->job)); =20 - if (virCondInit(&priv->job.cond) < 0) - return -1; + g_cond_init(&priv->job.cond); =20 return 0; } @@ -68,11 +67,11 @@ virLXCDomainObjResetJob(virLXCDomainObjPrivatePtr priv) static void virLXCDomainObjFreeJob(virLXCDomainObjPrivatePtr priv) { - ignore_value(virCondDestroy(&priv->job.cond)); + g_cond_clear(&priv->job.cond); } =20 /* Give up waiting for mutex after 30 seconds */ -#define LXC_JOB_WAIT_TIME (1000ull * 30) +#define LXC_JOB_WAIT_TIME (30 * G_TIME_SPAN_SECOND) =20 /* * obj must be locked before calling, virLXCDriverPtr must NOT be locked @@ -89,17 +88,12 @@ virLXCDomainObjBeginJob(virLXCDriverPtr driver G_GNUC_U= NUSED, enum virLXCDomainJob job) { virLXCDomainObjPrivatePtr priv =3D obj->privateData; - unsigned long long now; - unsigned long long then; - - if (virTimeMillisNow(&now) < 0) - return -1; - then =3D now + LXC_JOB_WAIT_TIME; + gint64 then =3D g_get_monotonic_time() + LXC_JOB_WAIT_TIME; =20 while (priv->job.active) { VIR_DEBUG("Wait normal job condition for starting job: %s", virLXCDomainJobTypeToString(job)); - if (virCondWaitUntil(&priv->job.cond, &obj->parent.lock, then) < 0) + if (!g_cond_wait_until(&priv->job.cond, &obj->parent.lock, then)) goto error; } =20 @@ -146,7 +140,7 @@ virLXCDomainObjEndJob(virLXCDriverPtr driver G_GNUC_UNU= SED, virLXCDomainJobTypeToString(job)); =20 virLXCDomainObjResetJob(priv); - virCondSignal(&priv->job.cond); + g_cond_signal(&priv->job.cond); } =20 =20 diff --git a/src/lxc/lxc_domain.h b/src/lxc/lxc_domain.h index 319f83338f..dfc16fae2b 100644 --- a/src/lxc/lxc_domain.h +++ b/src/lxc/lxc_domain.h @@ -69,7 +69,7 @@ VIR_ENUM_DECL(virLXCDomainJob); =20 =20 struct virLXCDomainJobObj { - virCond cond; /* Use to coordinate jobs */ + GCond cond; /* Use to coordinate jobs */ enum virLXCDomainJob active; /* Currently running job */ int owner; /* Thread which set current job */ }; diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 433de0aae0..22106c3f30 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -63,7 +63,7 @@ struct _udevEventData { =20 /* Thread data */ virThread th; - virCond threadCond; + GCond threadCond; bool threadQuit; bool dataReady; }; @@ -86,7 +86,7 @@ udevEventDataDispose(void *obj) udev_monitor_unref(priv->udev_monitor); udev_unref(udev); =20 - virCondDestroy(&priv->threadCond); + g_cond_clear(&priv->threadCond); } =20 =20 @@ -112,10 +112,7 @@ udevEventDataNew(void) if (!(ret =3D virObjectLockableNew(udevEventDataClass))) return NULL; =20 - if (virCondInit(&ret->threadCond) < 0) { - virObjectUnref(ret); - return NULL; - } + g_cond_init(&ret->threadCond); =20 ret->watch =3D -1; return ret; @@ -1463,7 +1460,7 @@ nodeStateCleanup(void) if (priv) { virObjectLock(priv); priv->threadQuit =3D true; - virCondSignal(&priv->threadCond); + g_cond_signal(&priv->threadCond); virObjectUnlock(priv); virThreadJoin(&priv->th); } @@ -1563,12 +1560,7 @@ udevEventHandleThread(void *opaque G_GNUC_UNUSED) while (1) { virObjectLock(priv); while (!priv->dataReady && !priv->threadQuit) { - if (virCondWait(&priv->threadCond, &priv->parent.lock)) { - virReportSystemError(errno, "%s", - _("handler failed to wait on conditio= n")); - virObjectUnlock(priv); - return; - } + g_cond_wait(&priv->threadCond, &priv->parent.lock); } =20 if (priv->threadQuit) { @@ -1635,7 +1627,7 @@ udevEventHandleCallback(int watch G_GNUC_UNUSED, else priv->dataReady =3D true; =20 - virCondSignal(&priv->threadCond); + g_cond_signal(&priv->threadCond); virObjectUnlock(priv); } =20 @@ -1757,7 +1749,7 @@ nodeStateInitializeEnumerate(void *opaque) ignore_value(virEventRemoveHandle(priv->watch)); priv->watch =3D -1; priv->threadQuit =3D true; - virCondSignal(&priv->threadCond); + g_cond_signal(&priv->threadCond); virObjectUnlock(priv); } =20 diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index d7fcc869c6..597df38752 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -99,7 +99,7 @@ struct _qemuAgentMessage { struct _qemuAgent { virObjectLockable parent; =20 - virCond notify; + GCond notify; =20 int fd; =20 @@ -176,7 +176,7 @@ static void qemuAgentDispose(void *obj) VIR_DEBUG("agent=3D%p", agent); if (agent->cb && agent->cb->destroy) (agent->cb->destroy)(agent, agent->vm); - virCondDestroy(&agent->notify); + g_cond_clear(&agent->notify); VIR_FREE(agent->buffer); g_main_context_unref(agent->context); virResetError(&agent->lastError); @@ -403,7 +403,7 @@ qemuAgentIOProcess(qemuAgentPtr agent) VIR_DEBUG("Process done %zu used %d", agent->bufferOffset, len); #endif if (msg && msg->finished) - virCondBroadcast(&agent->notify); + g_cond_broadcast(&agent->notify); return len; } =20 @@ -628,7 +628,7 @@ qemuAgentIO(GSocket *socket G_GNUC_UNUSED, * then wakeup that waiter */ if (agent->msg && !agent->msg->finished) { agent->msg->finished =3D 1; - virCondSignal(&agent->notify); + g_cond_signal(&agent->notify); } } =20 @@ -643,7 +643,7 @@ qemuAgentIO(GSocket *socket G_GNUC_UNUSED, virDomainObjPtr vm =3D agent->vm; =20 /* Make sure anyone waiting wakes up now */ - virCondSignal(&agent->notify); + g_cond_signal(&agent->notify); virObjectUnlock(agent); virObjectUnref(agent); VIR_DEBUG("Triggering EOF callback"); @@ -654,7 +654,7 @@ qemuAgentIO(GSocket *socket G_GNUC_UNUSED, virDomainObjPtr vm =3D agent->vm; =20 /* Make sure anyone waiting wakes up now */ - virCondSignal(&agent->notify); + g_cond_signal(&agent->notify); virObjectUnlock(agent); virObjectUnref(agent); VIR_DEBUG("Triggering error callback"); @@ -692,12 +692,8 @@ qemuAgentOpen(virDomainObjPtr vm, =20 agent->timeout =3D QEMU_DOMAIN_PRIVATE(vm)->agentTimeout; agent->fd =3D -1; - if (virCondInit(&agent->notify) < 0) { - virReportSystemError(errno, "%s", - _("cannot initialize agent condition")); - virObjectUnref(agent); - return NULL; - } + g_cond_init(&agent->notify); + agent->vm =3D vm; agent->cb =3D cb; agent->singleSync =3D singleSync; @@ -752,7 +748,7 @@ qemuAgentNotifyCloseLocked(qemuAgentPtr agent) * wake him up. No message will arrive anyway. */ if (agent->msg && !agent->msg->finished) { agent->msg->finished =3D 1; - virCondSignal(&agent->notify); + g_cond_signal(&agent->notify); } } } @@ -820,7 +816,7 @@ static int qemuAgentSend(qemuAgentPtr agent, int seconds) { int ret =3D -1; - unsigned long long then =3D 0; + gint64 then =3D 0; =20 /* Check whether qemu quit unexpectedly */ if (agent->lastError.code !=3D VIR_ERR_OK) { @@ -831,29 +827,23 @@ static int qemuAgentSend(qemuAgentPtr agent, } =20 if (seconds > VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) { - unsigned long long now; - if (virTimeMillisNow(&now) < 0) - return -1; if (seconds =3D=3D VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT) seconds =3D QEMU_AGENT_WAIT_TIME; - then =3D now + seconds * 1000ull; + then =3D g_get_monotonic_time() + seconds * G_TIME_SPAN_SECOND; } =20 agent->msg =3D msg; qemuAgentUpdateWatch(agent); =20 while (!agent->msg->finished) { - if ((then && virCondWaitUntil(&agent->notify, &agent->parent.lock,= then) < 0) || - (!then && virCondWait(&agent->notify, &agent->parent.lock) < 0= )) { - if (errno =3D=3D ETIMEDOUT) { - virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s", - _("Guest agent not available for now")); - ret =3D -2; - } else { - virReportSystemError(errno, "%s", - _("Unable to wait on agent socket " - "condition")); - } + if (!then) { + g_cond_wait(&agent->notify, &agent->parent.lock); + } else if (!g_cond_wait_until(&agent->notify, + &agent->parent.lock, + then)) { + virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s", + _("Guest agent not available for now")); + ret =3D -2; agent->inSync =3D false; goto cleanup; } @@ -1210,7 +1200,7 @@ void qemuAgentNotifyEvent(qemuAgentPtr agent, /* somebody waiting for this event, wake him up. */ if (agent->msg && !agent->msg->finished) { agent->msg->finished =3D 1; - virCondSignal(&agent->notify); + g_cond_signal(&agent->notify); } } =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 91e234d644..ac02f54cb8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -334,13 +334,8 @@ qemuDomainObjInitJob(qemuDomainObjPrivatePtr priv) { memset(&priv->job, 0, sizeof(priv->job)); =20 - if (virCondInit(&priv->job.cond) < 0) - return -1; - - if (virCondInit(&priv->job.asyncCond) < 0) { - virCondDestroy(&priv->job.cond); - return -1; - } + g_cond_init(&priv->job.cond); + g_cond_init(&priv->job.asyncCond); =20 return 0; } @@ -417,8 +412,8 @@ qemuDomainObjFreeJob(qemuDomainObjPrivatePtr priv) qemuDomainObjResetAsyncJob(priv); VIR_FREE(priv->job.current); VIR_FREE(priv->job.completed); - virCondDestroy(&priv->job.cond); - virCondDestroy(&priv->job.asyncCond); + g_cond_clear(&priv->job.cond); + g_cond_clear(&priv->job.asyncCond); } =20 static bool @@ -6181,7 +6176,7 @@ qemuDomainObjCanSetJob(qemuDomainObjPrivatePtr priv, } =20 /* Give up waiting for mutex after 30 seconds */ -#define QEMU_JOB_WAIT_TIME (1000ull * 30) +#define QEMU_JOB_WAIT_TIME (30 * G_TIME_SPAN_SECOND) =20 /** * qemuDomainObjBeginJobInternal: @@ -6214,17 +6209,16 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driv= er, bool nowait) { qemuDomainObjPrivatePtr priv =3D obj->privateData; - unsigned long long now; - unsigned long long then; + gint64 now, then =3D 0; bool nested =3D job =3D=3D QEMU_JOB_ASYNC_NESTED; bool async =3D job =3D=3D QEMU_JOB_ASYNC; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); const char *blocker =3D NULL; const char *agentBlocker =3D NULL; int ret =3D -1; - unsigned long long duration =3D 0; - unsigned long long agentDuration =3D 0; - unsigned long long asyncDuration =3D 0; + gint64 duration =3D 0; + gint64 agentDuration =3D 0; + gint64 asyncDuration =3D 0; =20 VIR_DEBUG("Starting job: job=3D%s agentJob=3D%s asyncJob=3D%s " "(vm=3D%p name=3D%s, current job=3D%s agentJob=3D%s async=3D= %s)", @@ -6236,11 +6230,8 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr drive= r, qemuDomainAgentJobTypeToString(priv->job.agentActive), qemuDomainAsyncJobTypeToString(priv->job.asyncJob)); =20 - if (virTimeMillisNow(&now) < 0) - return -1; - priv->jobs_queued++; - then =3D now + QEMU_JOB_WAIT_TIME; + then =3D g_get_monotonic_time() + QEMU_JOB_WAIT_TIME; =20 retry: if ((!async && job !=3D QEMU_JOB_DESTROY) && @@ -6254,7 +6245,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, goto cleanup; =20 VIR_DEBUG("Waiting for async job (vm=3D%p name=3D%s)", obj, obj->d= ef->name); - if (virCondWaitUntil(&priv->job.asyncCond, &obj->parent.lock, then= ) < 0) + if (!g_cond_wait_until(&priv->job.asyncCond, &obj->parent.lock, th= en)) goto error; } =20 @@ -6263,7 +6254,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, goto cleanup; =20 VIR_DEBUG("Waiting for job (vm=3D%p name=3D%s)", obj, obj->def->na= me); - if (virCondWaitUntil(&priv->job.cond, &obj->parent.lock, then) < 0) + if (!g_cond_wait_until(&priv->job.cond, &obj->parent.lock, then)) goto error; } =20 @@ -6272,7 +6263,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, if (!nested && !qemuDomainNestedJobAllowed(priv, job)) goto retry; =20 - ignore_value(virTimeMillisNow(&now)); + now =3D g_get_monotonic_time(); =20 if (job) { qemuDomainObjResetJob(priv); @@ -6322,7 +6313,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, return 0; =20 error: - ignore_value(virTimeMillisNow(&now)); + now =3D g_get_monotonic_time(); if (priv->job.active && priv->job.started) duration =3D now - priv->job.started; if (priv->job.agentActive && priv->job.agentStarted) @@ -6333,7 +6324,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, VIR_WARN("Cannot start job (%s, %s, %s) for domain %s; " "current job is (%s, %s, %s) " "owned by (%llu %s, %llu %s, %llu %s (flags=3D0x%lx)) " - "for (%llus, %llus, %llus)", + "for (%"G_GINT64_FORMAT"s, %"G_GINT64_FORMAT"s, %"G_GINT64_FO= RMAT"s)", qemuDomainJobTypeToString(job), qemuDomainAgentJobTypeToString(agentJob), qemuDomainAsyncJobTypeToString(asyncJob), @@ -6345,7 +6336,9 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, priv->job.agentOwner, NULLSTR(priv->job.agentOwnerAPI), priv->job.asyncOwner, NULLSTR(priv->job.asyncOwnerAPI), priv->job.apiFlags, - duration / 1000, agentDuration / 1000, asyncDuration / 1000); + duration / G_TIME_SPAN_MILLISECOND, + agentDuration / G_TIME_SPAN_MILLISECOND, + asyncDuration / G_TIME_SPAN_MILLISECOND); =20 if (job) { if (nested || qemuDomainNestedJobAllowed(priv, job)) @@ -6357,29 +6350,8 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr drive= r, if (agentJob) agentBlocker =3D priv->job.agentOwnerAPI; =20 - if (errno =3D=3D ETIMEDOUT) { - if (blocker && agentBlocker) { - virReportError(VIR_ERR_OPERATION_TIMEOUT, - _("cannot acquire state change " - "lock (held by monitor=3D%s agent=3D%s)"), - blocker, agentBlocker); - } else if (blocker) { - virReportError(VIR_ERR_OPERATION_TIMEOUT, - _("cannot acquire state change " - "lock (held by monitor=3D%s)"), - blocker); - } else if (agentBlocker) { - virReportError(VIR_ERR_OPERATION_TIMEOUT, - _("cannot acquire state change " - "lock (held by agent=3D%s)"), - agentBlocker); - } else { - virReportError(VIR_ERR_OPERATION_TIMEOUT, "%s", - _("cannot acquire state change lock")); - } - ret =3D -2; - } else if (cfg->maxQueuedJobs && - priv->jobs_queued > cfg->maxQueuedJobs) { + if (cfg->maxQueuedJobs && + priv->jobs_queued > cfg->maxQueuedJobs) { if (blocker && agentBlocker) { virReportError(VIR_ERR_OPERATION_FAILED, _("cannot acquire state change " @@ -6405,7 +6377,26 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr drive= r, } ret =3D -2; } else { - virReportSystemError(errno, "%s", _("cannot acquire job mutex")); + if (blocker && agentBlocker) { + virReportError(VIR_ERR_OPERATION_TIMEOUT, + _("cannot acquire state change " + "lock (held by monitor=3D%s agent=3D%s)"), + blocker, agentBlocker); + } else if (blocker) { + virReportError(VIR_ERR_OPERATION_TIMEOUT, + _("cannot acquire state change " + "lock (held by monitor=3D%s)"), + blocker); + } else if (agentBlocker) { + virReportError(VIR_ERR_OPERATION_TIMEOUT, + _("cannot acquire state change " + "lock (held by agent=3D%s)"), + agentBlocker); + } else { + virReportError(VIR_ERR_OPERATION_TIMEOUT, "%s", + _("cannot acquire state change lock")); + } + ret =3D -2; } =20 cleanup: @@ -6542,7 +6533,7 @@ qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomai= nObjPtr obj) qemuDomainObjSaveStatus(driver, obj); /* We indeed need to wake up ALL threads waiting because * grabbing a job requires checking more variables. */ - virCondBroadcast(&priv->job.cond); + g_cond_broadcast(&priv->job.cond); } =20 void @@ -6561,7 +6552,7 @@ qemuDomainObjEndAgentJob(virDomainObjPtr obj) qemuDomainObjResetAgentJob(priv); /* We indeed need to wake up ALL threads waiting because * grabbing a job requires checking more variables. */ - virCondBroadcast(&priv->job.cond); + g_cond_broadcast(&priv->job.cond); } =20 void @@ -6577,7 +6568,7 @@ qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver, vir= DomainObjPtr obj) =20 qemuDomainObjResetAsyncJob(priv); qemuDomainObjSaveStatus(driver, obj); - virCondBroadcast(&priv->job.asyncCond); + g_cond_broadcast(&priv->job.asyncCond); } =20 void diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index cf19f4d101..0d1bafac94 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -180,7 +180,7 @@ struct _qemuDomainJobInfo { typedef struct _qemuDomainJobObj qemuDomainJobObj; typedef qemuDomainJobObj *qemuDomainJobObjPtr; struct _qemuDomainJobObj { - virCond cond; /* Use to coordinate jobs */ + GCond cond; /* Use to coordinate jobs */ =20 /* The following members are for QEMU_JOB_* */ qemuDomainJob active; /* Currently running job */ @@ -195,7 +195,7 @@ struct _qemuDomainJobObj { unsigned long long agentStarted; /* When the current agent job star= ted */ =20 /* The following members are for QEMU_ASYNC_JOB_* */ - virCond asyncCond; /* Use to coordinate with async jo= bs */ + GCond asyncCond; /* Use to coordinate with async jo= bs */ qemuDomainAsyncJob asyncJob; /* Currently active async job */ unsigned long long asyncOwner; /* Thread which set current async = job */ const char *asyncOwnerAPI; /* The API which owns the async jo= b */ diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 14654a17d7..0e677bdce9 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -59,14 +59,14 @@ =20 VIR_LOG_INIT("qemu.qemu_hotplug"); =20 -#define CHANGE_MEDIA_TIMEOUT 5000 +#define CHANGE_MEDIA_TIMEOUT (5 * G_TIME_SPAN_MILLISECOND) =20 /* Timeout in miliseconds for device removal. PPC64 domains * can experience a bigger delay in unplug operations during * heavy guest activity (vcpu being the most notable case), thus * the timeout for PPC64 is also bigger. */ -#define QEMU_UNPLUG_TIMEOUT 1000ull * 5 -#define QEMU_UNPLUG_TIMEOUT_PPC64 1000ull * 10 +#define QEMU_UNPLUG_TIMEOUT (5 * G_TIME_SPAN_MILLISECOND) +#define QEMU_UNPLUG_TIMEOUT_PPC64 (10 * G_TIME_SPAN_MILLISECOND) =20 =20 static void @@ -201,15 +201,11 @@ static int qemuHotplugWaitForTrayEject(virDomainObjPtr vm, virDomainDiskDefPtr disk) { - unsigned long long now; + gint64 now =3D g_get_monotonic_time(); int rc; =20 - if (virTimeMillisNow(&now) < 0) - return -1; - while (disk->tray_status !=3D VIR_DOMAIN_DISK_TRAY_OPEN) { - if ((rc =3D virDomainObjWaitUntil(vm, now + CHANGE_MEDIA_TIMEOUT))= < 0) - return -1; + rc =3D virDomainObjWaitUntil(vm, now + CHANGE_MEDIA_TIMEOUT); =20 if (rc > 0) { /* the caller called qemuMonitorEjectMedia which usually repor= ts an @@ -5122,7 +5118,7 @@ qemuDomainResetDeviceRemoval(virDomainObjPtr vm) } =20 =20 -unsigned long long +gint64 qemuDomainGetUnplugTimeout(virDomainObjPtr vm) { if (qemuDomainIsPSeries(vm->def)) @@ -5145,22 +5141,14 @@ static int qemuDomainWaitForDeviceRemoval(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - unsigned long long until; + gint64 until; int rc; =20 - if (virTimeMillisNow(&until) < 0) - return 1; - until +=3D qemuDomainGetUnplugTimeout(vm); + until =3D g_get_monotonic_time() + qemuDomainGetUnplugTimeout(vm); =20 while (priv->unplug.alias) { if ((rc =3D virDomainObjWaitUntil(vm, until)) =3D=3D 1) return 0; - - if (rc < 0) { - VIR_WARN("Failed to wait on unplug condition for domain '%s' " - "device '%s'", vm->def->name, priv->unplug.alias); - return 1; - } } =20 if (priv->unplug.status =3D=3D QEMU_DOMAIN_UNPLUGGING_DEVICE_STATUS_GU= EST_REJECTED) { diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h index 4a49e04a15..f610d7c70f 100644 --- a/src/qemu/qemu_hotplug.h +++ b/src/qemu/qemu_hotplug.h @@ -151,7 +151,7 @@ int qemuDomainSetVcpuInternal(virQEMUDriverPtr driver, virBitmapPtr vcpus, bool state); =20 -unsigned long long qemuDomainGetUnplugTimeout(virDomainObjPtr vm); +gint64 qemuDomainGetUnplugTimeout(virDomainObjPtr vm); =20 int qemuHotplugAttachDBusVMState(virQEMUDriverPtr driver, virDomainObjPtr vm, diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a62fed845e..4537b3e562 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -70,7 +70,7 @@ VIR_LOG_INIT("qemu.qemu_monitor"); struct _qemuMonitor { virObjectLockable parent; =20 - virCond notify; + GCond notify; =20 int fd; =20 @@ -228,7 +228,7 @@ qemuMonitorDispose(void *obj) =20 g_main_context_unref(mon->context); virResetError(&mon->lastError); - virCondDestroy(&mon->notify); + g_cond_clear(&mon->notify); VIR_FREE(mon->buffer); virJSONValueFree(mon->options); VIR_FREE(mon->balloonpath); @@ -357,7 +357,7 @@ qemuMonitorIOProcess(qemuMonitorPtr mon) * while dealing with qemu event, mon->msg could be changed which * means the above 'msg' may be invalid, thus we use 'mon->msg' here */ if (mon->msg && mon->msg->finished) - virCondBroadcast(&mon->notify); + g_cond_broadcast(&mon->notify); return len; } =20 @@ -618,7 +618,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, * then wakeup that waiter */ if (mon->msg && !mon->msg->finished) { mon->msg->finished =3D 1; - virCondSignal(&mon->notify); + g_cond_signal(&mon->notify); } } =20 @@ -632,7 +632,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, virDomainObjPtr vm =3D mon->vm; =20 /* Make sure anyone waiting wakes up now */ - virCondSignal(&mon->notify); + g_cond_signal(&mon->notify); virObjectUnlock(mon); VIR_DEBUG("Triggering EOF callback"); (eofNotify)(mon, vm, mon->callbackOpaque); @@ -642,7 +642,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, virDomainObjPtr vm =3D mon->vm; =20 /* Make sure anyone waiting wakes up now */ - virCondSignal(&mon->notify); + g_cond_signal(&mon->notify); virObjectUnlock(mon); VIR_DEBUG("Triggering error callback"); (errorNotify)(mon, vm, mon->callbackOpaque); @@ -683,11 +683,8 @@ qemuMonitorOpenInternal(virDomainObjPtr vm, if (!(mon =3D virObjectLockableNew(qemuMonitorClass))) return NULL; =20 - if (virCondInit(&mon->notify) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize monitor condition")); - goto cleanup; - } + g_cond_init(&mon->notify); + mon->fd =3D fd; mon->context =3D g_main_context_ref(context); mon->vm =3D virObjectRef(vm); @@ -881,7 +878,7 @@ qemuMonitorClose(qemuMonitorPtr mon) virResetLastError(); } mon->msg->finished =3D 1; - virCondSignal(&mon->notify); + g_cond_signal(&mon->notify); } =20 /* Propagate existing monitor error in case the current thread has no @@ -935,11 +932,7 @@ qemuMonitorSend(qemuMonitorPtr mon, mon, mon->msg->txBuffer, mon->msg->txFD); =20 while (!mon->msg->finished) { - if (virCondWait(&mon->notify, &mon->parent.lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to wait on monitor condition")); - goto cleanup; - } + g_cond_wait(&mon->notify, &mon->parent.lock); } =20 if (mon->lastError.code !=3D VIR_ERR_OK) { diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 1c5bef86a1..28192c7046 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -58,7 +58,7 @@ struct _virNetClientCall { bool nonBlock; bool haveThread; =20 - virCond cond; + GCond cond; =20 virNetClientCallPtr next; }; @@ -1513,12 +1513,12 @@ static bool virNetClientIOEventLoopRemoveDone(virNe= tClientCallPtr call, */ if (call->haveThread) { VIR_DEBUG("Waking up sleep %p", call); - virCondSignal(&call->cond); + g_cond_signal(&call->cond); } else { VIR_DEBUG("Removing completed call %p", call); if (call->expectReply) VIR_WARN("Got a call expecting a reply but without a waiting t= hread"); - virCondDestroy(&call->cond); + g_cond_clear(&call->cond); VIR_FREE(call->msg); VIR_FREE(call); } @@ -1545,7 +1545,7 @@ virNetClientIOEventLoopRemoveAll(virNetClientCallPtr = call, return false; =20 VIR_DEBUG("Removing call %p", call); - virCondDestroy(&call->cond); + g_cond_clear(&call->cond); VIR_FREE(call->msg); VIR_FREE(call); return true; @@ -1563,7 +1563,7 @@ virNetClientIOEventLoopPassTheBuck(virNetClientPtr cl= ient, while (tmp) { if (tmp !=3D thiscall && tmp->haveThread) { VIR_DEBUG("Passing the buck to %p", tmp); - virCondSignal(&tmp->cond); + g_cond_signal(&tmp->cond); return; } tmp =3D tmp->next; @@ -1897,12 +1897,7 @@ static int virNetClientIO(virNetClientPtr client, VIR_DEBUG("Going to sleep head=3D%p call=3D%p", client->waitDispatch, thiscall); /* Go to sleep while other thread is working... */ - if (virCondWait(&thiscall->cond, &client->parent.lock) < 0) { - virNetClientCallRemove(&client->waitDispatch, thiscall); - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("failed to wait on condition")); - return -1; - } + g_cond_wait(&thiscall->cond, &client->parent.lock); =20 VIR_DEBUG("Woken up from sleep head=3D%p call=3D%p", client->waitDispatch, thiscall); @@ -2042,11 +2037,7 @@ virNetClientCallNew(virNetMessagePtr msg, if (VIR_ALLOC(call) < 0) goto error; =20 - if (virCondInit(&call->cond) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize condition variable")); - goto error; - } + g_cond_init(&call->cond); =20 msg->donefds =3D 0; if (msg->bufferLength) @@ -2124,7 +2115,7 @@ static int virNetClientSendInternal(virNetClientPtr c= lient, if (ret =3D=3D 1) return 1; =20 - virCondDestroy(&call->cond); + g_cond_clear(&call->cond); VIR_FREE(call); return ret; } diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c index 111e451f8c..26619472da 100644 --- a/src/util/virfdstream.c +++ b/src/util/virfdstream.c @@ -103,7 +103,7 @@ struct virFDStreamData { =20 /* Thread data */ virThreadPtr thread; - virCond threadCond; + GCond threadCond; virErrorPtr threadErr; bool threadQuit; bool threadAbort; @@ -149,7 +149,7 @@ virFDStreamMsgQueuePush(virFDStreamDataPtr fdst, tmp =3D &(*tmp)->next; =20 *tmp =3D msg; - virCondSignal(&fdst->threadCond); + g_cond_signal(&fdst->threadCond); =20 if (safewrite(fd, &c, sizeof(c)) !=3D sizeof(c)) { virReportSystemError(errno, @@ -175,7 +175,7 @@ virFDStreamMsgQueuePop(virFDStreamDataPtr fdst, tmp->next =3D NULL; } =20 - virCondSignal(&fdst->threadCond); + g_cond_signal(&fdst->threadCond); =20 if (saferead(fd, &c, sizeof(c)) !=3D sizeof(c)) { virReportSystemError(errno, @@ -591,11 +591,7 @@ virFDStreamThread(void *opaque) =20 while (doRead =3D=3D (fdst->msg !=3D NULL) && !fdst->threadQuit) { - if (virCondWait(&fdst->threadCond, &fdst->parent.lock)) { - virReportSystemError(errno, "%s", - _("failed to wait on condition")); - goto error; - } + g_cond_wait(&fdst->threadCond, &fdst->parent.lock); } =20 if (fdst->threadQuit) { @@ -654,7 +650,7 @@ virFDStreamJoinWorker(virFDStreamDataPtr fdst, =20 fdst->threadAbort =3D streamAbort; fdst->threadQuit =3D true; - virCondSignal(&fdst->threadCond); + g_cond_signal(&fdst->threadCond); =20 /* Give the thread a chance to lock the FD stream object. */ virObjectUnlock(fdst); @@ -669,7 +665,7 @@ virFDStreamJoinWorker(virFDStreamDataPtr fdst, ret =3D 0; cleanup: VIR_FREE(fdst->thread); - virCondDestroy(&fdst->threadCond); + g_cond_clear(&fdst->threadCond); return ret; } =20 @@ -891,7 +887,7 @@ static int virFDStreamRead(virStreamPtr st, char *bytes= , size_t nbytes) goto cleanup; } else { virObjectUnlock(fdst); - virCondSignal(&fdst->threadCond); + g_cond_signal(&fdst->threadCond); virObjectLock(fdst); } } @@ -1057,7 +1053,7 @@ virFDStreamInData(virStreamPtr st, goto cleanup; } else { virObjectUnlock(fdst); - virCondSignal(&fdst->threadCond); + g_cond_signal(&fdst->threadCond); virObjectLock(fdst); } } @@ -1128,11 +1124,7 @@ static int virFDStreamOpenInternal(virStreamPtr st, if (VIR_ALLOC(fdst->thread) < 0) goto error; =20 - if (virCondInit(&fdst->threadCond) < 0) { - virReportSystemError(errno, "%s", - _("cannot initialize condition variable")= ); - goto error; - } + g_cond_init(&fdst->threadCond); =20 if (virThreadCreateFull(fdst->thread, true, diff --git a/src/util/virobject.c b/src/util/virobject.c index aee1bb4af6..5bf4706f79 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -268,12 +268,7 @@ virObjectLockableNew(virClassPtr klass) if (!(obj =3D virObjectNew(klass))) return NULL; =20 - if (virMutexInit(&obj->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); - virObjectUnref(obj); - return NULL; - } + g_mutex_init(&obj->lock); =20 return obj; } @@ -305,7 +300,7 @@ virObjectLockableDispose(void *anyobj) { virObjectLockablePtr obj =3D anyobj; =20 - virMutexDestroy(&obj->lock); + g_mutex_clear(&obj->lock); } =20 =20 @@ -424,7 +419,7 @@ virObjectLock(void *anyobj) if (!obj) return; =20 - virMutexLock(&obj->lock); + g_mutex_lock(&obj->lock); } =20 =20 @@ -501,7 +496,7 @@ virObjectUnlock(void *anyobj) if (!obj) return; =20 - virMutexUnlock(&obj->lock); + g_mutex_unlock(&obj->lock); } =20 =20 diff --git a/src/util/virobject.h b/src/util/virobject.h index fcfe77578b..1f6f581e28 100644 --- a/src/util/virobject.h +++ b/src/util/virobject.h @@ -58,7 +58,7 @@ struct _virObject { =20 struct _virObjectLockable { virObject parent; - virMutex lock; + GMutex lock; }; =20 struct _virObjectRWLockable { diff --git a/src/vz/vz_utils.c b/src/vz/vz_utils.c index c31ff53cfb..73dec18515 100644 --- a/src/vz/vz_utils.c +++ b/src/vz/vz_utils.c @@ -559,17 +559,11 @@ vzDomObjAlloc(void *opaque G_GNUC_UNUSED) if (VIR_ALLOC(pdom) < 0) return NULL; =20 - if (virCondInit(&pdom->job.cond) < 0) - goto error; + g_cond_init(&pdom->job.cond); =20 pdom->stats =3D PRL_INVALID_HANDLE; =20 return pdom; - - error: - VIR_FREE(pdom); - - return NULL; } =20 void @@ -582,45 +576,33 @@ vzDomObjFree(void* p) =20 PrlHandle_Free(pdom->sdkdom); PrlHandle_Free(pdom->stats); - virCondDestroy(&pdom->job.cond); + g_cond_clear(&pdom->job.cond); VIR_FREE(pdom); }; =20 -#define VZ_JOB_WAIT_TIME (1000 * 30) +#define VZ_JOB_WAIT_TIME (30 * G_TIME_SPAN_SECOND) =20 int vzDomainObjBeginJob(virDomainObjPtr dom) { vzDomObjPtr pdom =3D dom->privateData; - unsigned long long now; - unsigned long long then; - - if (virTimeMillisNow(&now) < 0) - return -1; - then =3D now + VZ_JOB_WAIT_TIME; + gint64 then =3D g_get_monotonic_time() + VZ_JOB_WAIT_TIME; =20 while (pdom->job.active) { - if (virCondWaitUntil(&pdom->job.cond, &dom->parent.lock, then) < 0) + if (!g_cond_wait_until(&pdom->job.cond, &dom->parent.lock, then)) goto error; } =20 - if (virTimeMillisNow(&now) < 0) - return -1; - pdom->job.active =3D true; - pdom->job.started =3D now; + pdom->job.started =3D g_get_monotonic_time(); pdom->job.elapsed =3D 0; pdom->job.progress =3D 0; pdom->job.hasProgress =3D false; return 0; =20 error: - if (errno =3D=3D ETIMEDOUT) - virReportError(VIR_ERR_OPERATION_TIMEOUT, - "%s", _("cannot acquire state change lock")); - else - virReportSystemError(errno, - "%s", _("cannot acquire job mutex")); + virReportError(VIR_ERR_OPERATION_TIMEOUT, + "%s", _("cannot acquire state change lock")); return -1; } =20 @@ -631,19 +613,18 @@ vzDomainObjEndJob(virDomainObjPtr dom) =20 pdom->job.active =3D false; pdom->job.cancelled =3D false; - virCondSignal(&pdom->job.cond); + g_cond_signal(&pdom->job.cond); } =20 int vzDomainJobUpdateTime(vzDomainJobObjPtr job) { - unsigned long long now; + gint64 now; =20 if (!job->started) return 0; =20 - if (virTimeMillisNow(&now) < 0) - return -1; + now =3D g_get_monotonic_time(); =20 if (now < job->started) { VIR_WARN("Async job starts in the future"); diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h index 7ebb34bb11..6497e5530f 100644 --- a/src/vz/vz_utils.h +++ b/src/vz/vz_utils.h @@ -93,11 +93,11 @@ typedef struct _vzConn vzConn; typedef struct _vzConn *vzConnPtr; =20 struct _vzDomainJobObj { - virCond cond; + GCond cond; bool active; /* when the job started, zeroed on time discontinuities */ - unsigned long long started; - unsigned long long elapsed; + gint64 started; + gint64 elapsed; bool hasProgress; int progress; /* percents */ PRL_HANDLE sdkJob; diff --git a/tests/qemuhotplugmock.c b/tests/qemuhotplugmock.c index 8e5b07788d..71fe2db88c 100644 --- a/tests/qemuhotplugmock.c +++ b/tests/qemuhotplugmock.c @@ -38,15 +38,15 @@ init_syms(void) VIR_MOCK_REAL_INIT(virFileExists); } =20 -unsigned long long +gint64 qemuDomainGetUnplugTimeout(virDomainObjPtr vm G_GNUC_UNUSED) { /* Wait only 100ms for DEVICE_DELETED event. Give a greater * timeout in case of PSeries guest to be consistent with the * original logic. */ if (qemuDomainIsPSeries(vm->def)) - return 200; - return 100; + return 200 * G_TIME_SPAN_MILLISECOND; + return 100 * G_TIME_SPAN_MILLISECOND; } =20 =20 diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index d9244dca44..581a09d204 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -352,6 +352,7 @@ testQemuHotplug(const void *data) if (keep) { test->vm =3D vm; } else { + virObjectUnlock(vm); virObjectUnref(vm); test->vm =3D NULL; } @@ -396,6 +397,7 @@ testQemuHotplugCpuDataFree(struct testQemuHotplugCpuDat= a *data) priv =3D data->vm->privateData; priv->mon =3D NULL; =20 + virObjectUnlock(data->vm); virObjectUnref(data->vm); } =20 diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 78fc94e710..9c5a7249ae 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -79,6 +79,8 @@ struct _qemuMonitorTest { =20 virDomainObjPtr vm; virHashTablePtr qapischema; + + bool vmCreated; }; =20 =20 @@ -392,6 +394,8 @@ qemuMonitorTestFree(qemuMonitorTestPtr test) =20 g_object_unref(test->eventThread); =20 + if (test->vmCreated) + virObjectUnlock(test->vm); virObjectUnref(test->vm); =20 if (test->started) @@ -1062,6 +1066,7 @@ qemuMonitorCommonTestNew(virDomainXMLOptionPtr xmlopt, test->vm =3D virDomainObjNew(xmlopt); if (!test->vm) goto error; + test->vmCreated =3D true; if (!(test->vm->def =3D virDomainDefNew())) goto error; } diff --git a/tests/qemusecuritytest.c b/tests/qemusecuritytest.c index a1ef9d8802..65322ae29e 100644 --- a/tests/qemusecuritytest.c +++ b/tests/qemusecuritytest.c @@ -100,19 +100,19 @@ testDomain(const void *opaque) if (virStorageSourceIsLocalStorage(src) && src->path && (src->shared || src->readonly) && virStringListAdd(¬Restored, src->path) < 0) - return -1; + goto unlock; =20 for (n =3D src->backingStore; virStorageSourceIsBacking(n); n =3D = n->backingStore) { if (virStorageSourceIsLocalStorage(n) && n->path && virStringListAdd(¬Restored, n->path) < 0) - return -1; + goto unlock; } } =20 /* Mocking is enabled only when this env variable is set. * See mock code for explanation. */ if (g_setenv(ENVVAR, "1", FALSE) =3D=3D FALSE) - return -1; + goto unlock; =20 if (qemuSecuritySetAllLabel(data->driver, vm, NULL, false) < 0) goto cleanup; @@ -124,9 +124,13 @@ testDomain(const void *opaque) =20 ret =3D 0; cleanup: + virObjectUnlock(vm); g_unsetenv(ENVVAR); freePaths(); return ret; +unlock: + virObjectUnlock(vm); + return -1; } =20 =20 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 405227fdf6..180201f74e 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -592,6 +592,7 @@ testCompareXMLToArgv(const void *data) VIR_FREE(actualargv); virDomainChrSourceDefClear(&monitor_chr); virCommandFree(cmd); + virObjectUnlock(vm); virObjectUnref(vm); virSetConnectSecret(NULL); virSetConnectStorage(NULL); diff --git a/tools/virsh-console.c b/tools/virsh-console.c index 2e498a6903..ac4d65cb0e 100644 --- a/tools/virsh-console.c +++ b/tools/virsh-console.c @@ -63,7 +63,7 @@ struct virConsole { =20 virStreamPtr st; bool quit; - virCond cond; + GCond cond; =20 int stdinWatch; int stdoutWatch; @@ -130,7 +130,7 @@ virConsoleShutdown(virConsolePtr con, con->stdoutWatch =3D -1; if (!con->quit) { con->quit =3D true; - virCondSignal(&con->cond); + g_cond_signal(&con->cond); } } =20 @@ -143,7 +143,7 @@ virConsoleDispose(void *obj) if (con->st) virStreamFree(con->st); =20 - virCondDestroy(&con->cond); + g_cond_clear(&con->cond); virResetError(&con->error); } =20 @@ -376,21 +376,12 @@ virConsoleNew(void) if (!(con =3D virObjectLockableNew(virConsoleClass))) return NULL; =20 - if (virCondInit(&con->cond) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize console condition")); - - goto error; - } + g_cond_init(&con->cond); =20 con->stdinWatch =3D -1; con->stdoutWatch =3D -1; =20 return con; - - error: - virObjectUnref(con); - return NULL; } =20 =20 @@ -484,11 +475,7 @@ virshRunConsole(vshControl *ctl, } =20 while (!con->quit) { - if (virCondWait(&con->cond, &con->parent.lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unable to wait on console condition")); - goto cleanup; - } + g_cond_wait(&con->cond, &con->parent.lock); } =20 if (con->error.code =3D=3D VIR_ERR_OK) --=20 2.25.2 From nobody Sun Feb 8 16:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586527028; cv=none; d=zohomail.com; s=zohoarc; b=cavQqnh1Yaa2CZq4ZivawKYU7j2UchQQpyhlJqoNmOsdD1upTKPGq+W4LDVm97oGn+eHwXE08O6KViJBZAOZwAgVmai5AVuDhEs2DxejLlWttXoaW/5tdWa/7p175TaQTmc6yRj+PPxXoUJamzTemT6Rqpr4Bl4LLJHRI4mUsBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586527028; 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=pGwxCYBIih4RwnZb0mfykv6zZ+9kklSv9E0sjNX0aIE=; b=m6bPOhDul9c9h6sB6x8PaDw/z0TkLXeF6tEunsWsS5FyVjmUo5hRe+/+n7Tb4P8mZEyjK2tamUXW0cwTJJpfIhEgbDAjn7pl3CYtOB8pksU+RJhzv3CPHnY1nqEkHYiLDI6WPI3wb6EppES8l8jdAMiMNvbQQRynI2GMk9E/vVs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586527028345656.5836287046487; Fri, 10 Apr 2020 06:57:08 -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-370-S_urH9KQM7WRzoPP2MJtpw-1; Fri, 10 Apr 2020 09:57:01 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 19E9618B5F77; Fri, 10 Apr 2020 13:56:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E5E57CFDEA; Fri, 10 Apr 2020 13:56:55 +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 9EF6D1819AD4; Fri, 10 Apr 2020 13:56:55 +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 03ADuSc8023434 for ; Fri, 10 Apr 2020 09:56:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 86BB5127513; Fri, 10 Apr 2020 13:56:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82B3F127512 for ; Fri, 10 Apr 2020 13:56:28 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 68D16800294 for ; Fri, 10 Apr 2020 13:56:28 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-_RKr5bGPPOKnwmn-aHe2JQ-1; Fri, 10 Apr 2020 09:56:25 -0400 Received: by mail-wm1-f67.google.com with SMTP id z6so2821467wml.2 for ; Fri, 10 Apr 2020 06:56:25 -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.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 06:56:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586527027; 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=pGwxCYBIih4RwnZb0mfykv6zZ+9kklSv9E0sjNX0aIE=; b=FxdOv/PYrpIvkv7tizNSWWjnfs8jNajT8bQojm1romoQICz2lOhgWIod6j9h8bUESjaJm6 u0LYgsnMkAQ09hesYewqhMocmkQ0AdQZm/qyCKK0SCJsPLPWM9x76QhN7k4uqmCljpe4+y ylv78NmCxq2ZpFqyQX2jWzrfIkQ3Ux8= X-MC-Unique: S_urH9KQM7WRzoPP2MJtpw-1 X-MC-Unique: _RKr5bGPPOKnwmn-aHe2JQ-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=3BuRWAd0/ftW54WQgiRWXklrFf6hnfW/ri9HkElV+pk=; b=UWKGRsH//9GhYOOy9rbZryf3mxPYMQEOtEtMCSrlS0onJLFNPJaPr6DOV7G90K6fbh raSuJ1HPNObZC0pbLXmCduicyxGqAZT33sGkftj7Nf9h+e/yto2Rdp8ewkEZivUcr/IO 27eBRNsPlsGUUtl/bU0gH377vA/3vl9dvT8rNV0L4bLVFl4FWy3UR/KYTrQBkrDWINvo SlCXGRDBxgOfm0hmnNJMfNs3Vu5VhSKXcx9LNo4qQnVtqdPXZbd+lAOEIg0+1KgAxihk 5QS3C5u89Brmr0oHNilWG+IwgWo29kv7qfBTURUQkGa26pn+ckHZNINsI4Pzj/+a8Jca WjxA== X-Gm-Message-State: AGi0PuaBDGXCXPoPju+LV0VKGCa3zD0N7Orf8yCtdZqgRlIXtiEEvZyh MwgjphZcdI4/Sc3d91cLwNluY1NE+vk= X-Google-Smtp-Source: APiQypLfnAwPubykRQg671LipTtR75Qf8m6Sw/R9PEG1mtuLDZ7fqs8msMkEpR2XHBmR3bE0LjoZ9g== X-Received: by 2002:a1c:f21a:: with SMTP id s26mr5394246wmc.187.1586526984227; Fri, 10 Apr 2020 06:56:24 -0700 (PDT) From: Rafael Fonseca To: libvir-list@redhat.com Subject: [PATCH 43/43] util: virthread: remove GMutex and Gcond Date: Fri, 10 Apr 2020 15:55:10 +0200 Message-Id: <20200410135510.2148319-44-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 03ADuSc8023434 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.15 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" All instances where they were used have now been converted to the Glib equivalents. Signed-off-by: Rafael Fonseca --- examples/systemtap/lock-debug.stp | 4 +- src/libvirt_private.syms | 11 ---- src/util/virthread.c | 101 ------------------------------ src/util/virthread.h | 41 ------------ 4 files changed, 2 insertions(+), 155 deletions(-) diff --git a/examples/systemtap/lock-debug.stp b/examples/systemtap/lock-de= bug.stp index 0c9cc38692..dd8ee42b54 100644 --- a/examples/systemtap/lock-debug.stp +++ b/examples/systemtap/lock-debug.stp @@ -35,12 +35,12 @@ probe library =3D process( %( $# > 0 %? @1 %: "/usr/lib= /libvirt.so" %) ) if (filter()) next } =20 -probe lock =3D library.function("virMutexLock") +probe lock =3D library.function("g_mutex_lock") { lockname =3D usymdata($m) } =20 -probe unlock =3D library.function("virMutexUnlock") +probe unlock =3D library.function("g_mutex_unlock") { lockname =3D usymdata($m) } diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 4dfafdfd3e..054a1a5fce 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3259,17 +3259,6 @@ virSystemdTerminateMachine; =20 =20 # util/virthread.h -virCondBroadcast; -virCondDestroy; -virCondInit; -virCondSignal; -virCondWait; -virCondWaitUntil; -virMutexDestroy; -virMutexInit; -virMutexInitRecursive; -virMutexLock; -virMutexUnlock; virOnce; virThreadCancel; virThreadCreateFull; diff --git a/src/util/virthread.c b/src/util/virthread.c index 1ec5096ced..5300273f0e 100644 --- a/src/util/virthread.c +++ b/src/util/virthread.c @@ -43,107 +43,6 @@ int virOnce(virOnceControlPtr once, virOnceFunc init) } =20 =20 -int virMutexInit(virMutexPtr m) -{ - int ret; - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL); - ret =3D pthread_mutex_init(&m->lock, &attr); - pthread_mutexattr_destroy(&attr); - if (ret !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -int virMutexInitRecursive(virMutexPtr m) -{ - int ret; - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - ret =3D pthread_mutex_init(&m->lock, &attr); - pthread_mutexattr_destroy(&attr); - if (ret !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -void virMutexDestroy(virMutexPtr m) -{ - pthread_mutex_destroy(&m->lock); -} - -void virMutexLock(virMutexPtr m) -{ - pthread_mutex_lock(&m->lock); -} - -void virMutexUnlock(virMutexPtr m) -{ - pthread_mutex_unlock(&m->lock); -} - - -int virCondInit(virCondPtr c) -{ - int ret; - if ((ret =3D pthread_cond_init(&c->cond, NULL)) !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -int virCondDestroy(virCondPtr c) -{ - int ret; - if ((ret =3D pthread_cond_destroy(&c->cond)) !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -int virCondWait(virCondPtr c, virMutexPtr m) -{ - int ret; - if ((ret =3D pthread_cond_wait(&c->cond, &m->lock)) !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -int virCondWaitUntil(virCondPtr c, virMutexPtr m, unsigned long long whenm= s) -{ - int ret; - struct timespec ts; - - ts.tv_sec =3D whenms / 1000; - ts.tv_nsec =3D (whenms % 1000) * 1000000; - - if ((ret =3D pthread_cond_timedwait(&c->cond, &m->lock, &ts)) !=3D 0) { - errno =3D ret; - return -1; - } - return 0; -} - -void virCondSignal(virCondPtr c) -{ - pthread_cond_signal(&c->cond); -} - -void virCondBroadcast(virCondPtr c) -{ - pthread_cond_broadcast(&c->cond); -} - struct virThreadArgs { virThreadFunc func; char *name; diff --git a/src/util/virthread.h b/src/util/virthread.h index a57c99bdf0..d55407d693 100644 --- a/src/util/virthread.h +++ b/src/util/virthread.h @@ -26,20 +26,6 @@ =20 #include =20 -typedef struct virMutex virMutex; -typedef virMutex *virMutexPtr; - -struct virMutex { - pthread_mutex_t lock; -}; - -typedef struct virCond virCond; -typedef virCond *virCondPtr; - -struct virCond { - pthread_cond_t cond; -}; - typedef struct virThreadLocal virThreadLocal; typedef virThreadLocal *virThreadLocalPtr; =20 @@ -62,11 +48,6 @@ struct virOnceControl { }; =20 =20 -#define VIR_MUTEX_INITIALIZER \ - { \ - .lock =3D PTHREAD_MUTEX_INITIALIZER \ - } - #define VIR_ONCE_CONTROL_INITIALIZER \ { \ .once =3D PTHREAD_ONCE_INIT \ @@ -117,28 +98,6 @@ unsigned long long virThreadID(virThreadPtr thread); int virOnce(virOnceControlPtr once, virOnceFunc init) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; =20 -int virMutexInit(virMutexPtr m) G_GNUC_WARN_UNUSED_RESULT; -int virMutexInitRecursive(virMutexPtr m) G_GNUC_WARN_UNUSED_RESULT; -void virMutexDestroy(virMutexPtr m); - -void virMutexLock(virMutexPtr m); -void virMutexUnlock(virMutexPtr m); - - -int virCondInit(virCondPtr c) G_GNUC_WARN_UNUSED_RESULT; -int virCondDestroy(virCondPtr c); - -/* virCondWait, virCondWaitUntil: - * These functions can return without the associated predicate - * changing value. Therefore in nearly all cases they - * should be enclosed in a while loop that checks the predicate. - */ -int virCondWait(virCondPtr c, virMutexPtr m) G_GNUC_WARN_UNUSED_RESULT; -int virCondWaitUntil(virCondPtr c, virMutexPtr m, unsigned long long whenm= s) G_GNUC_WARN_UNUSED_RESULT; - -void virCondSignal(virCondPtr c); -void virCondBroadcast(virCondPtr c); - =20 typedef void (*virThreadLocalCleanup)(void *); int virThreadLocalInit(virThreadLocalPtr l, --=20 2.25.2