From nobody Mon Feb 9 08:55:38 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