From nobody Mon Feb 9 19:04:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1644359620; cv=none; d=zohomail.com; s=zohoarc; b=XUBypdZvrLbIl9/+5BIGYi4KIjEI0jDTJIyVU0LaL/KFFB9LuZ0+ay8vnlVzIldsMoJ7Y0VtwavQeIcy9Hee8Q6ytTyZdbCTgb6dvmclaPIXbi6IAVV145BpJHLu1faute7byEHJdBDTMFNGP/O1UrQgSTVcAZZ9UwPGhvsM2zQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644359620; 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=mR81FlwEJjxasMjvHuyMVlxuk0fdu8Gt6OucGVtIxqA=; b=GnF878mcVDsw8CUuT7Q8AgcV5qnSpJcfca3UcKWVJREHl0q2gUMtXlhgiGiBWoqzrkzecS87WYqS8tTQa7D59Oq6gr/vYC6HuSlQCkMpM5/INdsVr7MvWWy3rIDLHxgSo6YNFSm+Yc44sfT/I2Odt0oPMmbXCq/kZK6KJAJPd6c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1644359620227824.2458914145822; Tue, 8 Feb 2022 14:33:40 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-475-Teh_CpDeMzS2I9BVJIXQNA-1; Tue, 08 Feb 2022 17:33:37 -0500 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 3630E5AB8; Tue, 8 Feb 2022 22:33: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 1454955F4C; Tue, 8 Feb 2022 22:33: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 D7C83473A0; Tue, 8 Feb 2022 22:33:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 217DCQVH006380 for ; Mon, 7 Feb 2022 08:12:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id EBB8E1038AC4; Mon, 7 Feb 2022 13:12:26 +0000 (UTC) Received: from work.redhat.com (unknown [10.39.192.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FFA21038AC9; Mon, 7 Feb 2022 13:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644359619; 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=mR81FlwEJjxasMjvHuyMVlxuk0fdu8Gt6OucGVtIxqA=; b=Wh8SJDx/WEZtcHcwA2G1RQQS49C2e5sSNYDMFDgolPLU6KEj+Vj1IGLMXEi5P5OwKbUzE2 rtFmg3TRU5V22H3XQmJJGWqZ/K7OiKPiO5eAjPU+QYJsGdvk3Jr56eUbRiI8TfFO53gZ8F 4ZGkaVm7omoNmynwntQzT2TifgiNp+Y= X-MC-Unique: Teh_CpDeMzS2I9BVJIXQNA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/11] bhyve_driver: Use automatic mutex management Date: Mon, 7 Feb 2022 14:12:13 +0100 Message-Id: <20220207131214.54855-11-twiederh@redhat.com> In-Reply-To: <20220207131214.54855-1-twiederh@redhat.com> References: <20220207131214.54855-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644359620791100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/bhyve/bhyve_conf.c | 7 ++----- src/bhyve/bhyve_driver.c | 12 ------------ src/bhyve/bhyve_utils.h | 3 --- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/bhyve/bhyve_conf.c b/src/bhyve/bhyve_conf.c index 5eca0855f0..28981c90b7 100644 --- a/src/bhyve/bhyve_conf.c +++ b/src/bhyve/bhyve_conf.c @@ -85,11 +85,8 @@ virBhyveLoadDriverConfig(struct _virBhyveDriverConfig *c= fg, struct _virBhyveDriverConfig * virBhyveDriverGetConfig(struct _bhyveConn *driver) { - struct _virBhyveDriverConfig *cfg; - bhyveDriverLock(driver); - cfg =3D virObjectRef(driver->config); - bhyveDriverUnlock(driver); - return cfg; + VIR_LOCK_GUARD lock =3D virLockGuardLock(&driver->lock); + return virObjectRef(driver->config); } =20 static void diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 47ee98e650..f580e87419 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -70,18 +70,6 @@ VIR_LOG_INIT("bhyve.bhyve_driver"); =20 struct _bhyveConn *bhyve_driver =3D NULL; =20 -void -bhyveDriverLock(struct _bhyveConn *driver) -{ - virMutexLock(&driver->lock); -} - -void -bhyveDriverUnlock(struct _bhyveConn *driver) -{ - virMutexUnlock(&driver->lock); -} - static int bhyveAutostartDomain(virDomainObj *vm, void *opaque) { diff --git a/src/bhyve/bhyve_utils.h b/src/bhyve/bhyve_utils.h index af7b15486a..5d6e198b09 100644 --- a/src/bhyve/bhyve_utils.h +++ b/src/bhyve/bhyve_utils.h @@ -73,6 +73,3 @@ struct bhyveAutostartData { struct _bhyveConn *driver; virConnectPtr conn; }; - -void bhyveDriverLock(struct _bhyveConn *driver); -void bhyveDriverUnlock(struct _bhyveConn *driver); --=20 2.31.1