From nobody Sun Feb 8 23:13:21 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=pass(p=none dis=none) header.from=redhat.com 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 1580538976865293.6980218554694; Fri, 31 Jan 2020 22:36:16 -0800 (PST) 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-295-jqyKQkDsOFOhpGlYY7Fp5w-1; Sat, 01 Feb 2020 01:36:13 -0500 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 98C0E1005510; Sat, 1 Feb 2020 06:36: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 6F3225D9E5; Sat, 1 Feb 2020 06:36: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 17DD518089CE; Sat, 1 Feb 2020 06:36:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0116XvNW012475 for ; Sat, 1 Feb 2020 01:33:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6CDF377932; Sat, 1 Feb 2020 06:33:57 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-34.brq.redhat.com [10.40.204.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2B0286420 for ; Sat, 1 Feb 2020 06:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580538975; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=wRS5cag+H/33M/d9dM6CVaZSksLUD1v18CPWtjG3HAQ=; b=DnViWaxdYs6SrFFbeZPNU4zBoiTDN0yvWS28DSL4IhwKXO51xrKBlQBAnq+GUHYb9p01xR Us0gYNKHtOSdyMbXVVHHenpETGnnTtMAvWm7AK6YcsPAZgJNUdgp9OxL3zHyVlmYSbr5kd KGdNz4sDtE7h61akyhgxvVgHiTgQT0o= From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/7] src: Replace virAtomicIntGet() with g_atomic_int_get() Date: Sat, 1 Feb 2020 07:33:45 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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-MC-Unique: jqyKQkDsOFOhpGlYY7Fp5w-1 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: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/nwfilter/nwfilter_dhcpsnoop.c | 12 ++++++------ src/util/viratomic.h | 9 --------- src/util/virsystemd.c | 6 +++--- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcp= snoop.c index a1c0c0189e..074cffecb2 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -601,7 +601,7 @@ virNWFilterSnoopReqFree(virNWFilterSnoopReqPtr req) if (!req) return; =20 - if (virAtomicIntGet(&req->refctr) !=3D 0) + if (g_atomic_int_get(&req->refctr) !=3D 0) return; =20 /* free all leases */ @@ -1477,7 +1477,7 @@ virNWFilterDHCPSnoopThread(void *req0) unsigned int diff; =20 /* submit packet to worker thread */ - if (virAtomicIntGet(&pcapConf[i].qCtr) > + if (g_atomic_int_get(&pcapConf[i].qCtr) > pcapConf[i].maxQSize) { if (last_displayed_queue - time(0) > 10) { last_displayed_queue =3D time(0); @@ -1778,7 +1778,7 @@ virNWFilterSnoopLeaseFileSave(virNWFilterSnoopIPLease= Ptr ipl) =20 /* keep dead leases at < ~95% of file size */ if (virAtomicIntInc(&virNWFilterSnoopState.wLeases) >=3D - virAtomicIntGet(&virNWFilterSnoopState.nLeases) * 20) + g_atomic_int_get(&virNWFilterSnoopState.nLeases) * 20) virNWFilterSnoopLeaseFileLoad(); /* load & refresh lease file */ =20 err_exit: @@ -1809,7 +1809,7 @@ virNWFilterSnoopPruneIter(const void *payload, /* * have the entry removed if it has no leases and no one holds a ref */ - del_req =3D ((req->start =3D=3D NULL) && (virAtomicIntGet(&req->refctr= ) =3D=3D 0)); + del_req =3D ((req->start =3D=3D NULL) && (g_atomic_int_get(&req->refct= r) =3D=3D 0)); =20 virNWFilterSnoopReqUnlock(req); =20 @@ -1973,9 +1973,9 @@ virNWFilterSnoopLeaseFileLoad(void) static void virNWFilterSnoopJoinThreads(void) { - while (virAtomicIntGet(&virNWFilterSnoopState.nThreads) !=3D 0) { + while (g_atomic_int_get(&virNWFilterSnoopState.nThreads) !=3D 0) { VIR_WARN("Waiting for snooping threads to terminate: %u", - virAtomicIntGet(&virNWFilterSnoopState.nThreads)); + g_atomic_int_get(&virNWFilterSnoopState.nThreads)); g_usleep(1000 * 1000); } } diff --git a/src/util/viratomic.h b/src/util/viratomic.h index 12b116a6cd..6c1764f7bf 100644 --- a/src/util/viratomic.h +++ b/src/util/viratomic.h @@ -26,15 +26,6 @@ =20 #include "internal.h" =20 -/** - * virAtomicIntGet: - * Gets the current value of atomic. - * - * This call acts as a full compiler and hardware memory barrier - * (before the get) - */ -#define virAtomicIntGet(v) g_atomic_int_get(v) - /** * virAtomicIntSet: * Sets the value of atomic to newval. diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index a9ff782fb8..5b66094de5 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -154,7 +154,7 @@ virSystemdHasMachined(void) int ret; int val; =20 - val =3D virAtomicIntGet(&virSystemdHasMachinedCachedValue); + val =3D g_atomic_int_get(&virSystemdHasMachinedCachedValue); if (val !=3D -1) return val; =20 @@ -176,7 +176,7 @@ virSystemdHasLogind(void) int ret; int val; =20 - val =3D virAtomicIntGet(&virSystemdHasLogindCachedValue); + val =3D g_atomic_int_get(&virSystemdHasLogindCachedValue); if (val !=3D -1) return val; =20 @@ -352,7 +352,7 @@ int virSystemdCreateMachine(const char *name, */ =20 VIR_DEBUG("Attempting to create machine via systemd"); - if (virAtomicIntGet(&hasCreateWithNetwork)) { + if (g_atomic_int_get(&hasCreateWithNetwork)) { virError error; memset(&error, 0, sizeof(error)); =20 --=20 2.24.1