From nobody Sun Feb 8 11:07:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1492090449689828.6086214430658; Thu, 13 Apr 2017 06:34:09 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 134523DB; Thu, 13 Apr 2017 13:34:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DBCDE9FDF7; Thu, 13 Apr 2017 13:34: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 76743B3483; Thu, 13 Apr 2017 13:33:14 +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 v3DDXB2k013140 for ; Thu, 13 Apr 2017 09:33:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E3587A43D; Thu, 13 Apr 2017 13:33:11 +0000 (UTC) Received: from virval.usersys.redhat.com (dhcp129-92.brq.redhat.com [10.34.129.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E5D3D7A436 for ; Thu, 13 Apr 2017 13:33:04 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id C08C71041AE; Thu, 13 Apr 2017 15:32:59 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 134523DB Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 134523DB From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 13 Apr 2017 15:32:57 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 8/9] cpu: Introduce virCPUGetHostIsSupported 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 13 Apr 2017 13:34:08 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Sometimes we want to call virCPUGetHost only when it is implemented for a given architecture to avoid logging expected and possibly misleading errors. The new virCPUGetHostIsSupported API may be used to guard such calls to virCPUGetHost. Signed-off-by: Jiri Denemark --- src/cpu/cpu.c | 20 ++++++++++++++++++++ src/cpu/cpu.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 24 insertions(+) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 8a407ac18..702b14dbb 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -358,6 +358,26 @@ virCPUDataFree(virCPUDataPtr data) =20 =20 /** + * virCPUGetHostIsSupported: + * + * @arch: CPU architecture + * + * Check whether virCPUGetHost is supported for @arch. + * + * Returns true if virCPUGetHost is supported, false otherwise. + */ +bool +virCPUGetHostIsSupported(virArch arch) +{ + struct cpuArchDriver *driver; + + VIR_DEBUG("arch=3D%s", virArchToString(arch)); + + return (driver =3D cpuGetSubDriver(arch)) && driver->getHost; +} + + +/** * virCPUGetHost: * * @arch: CPU architecture diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 352445c40..c6ca111e9 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -183,6 +183,9 @@ virCPUDataNew(virArch arch); void virCPUDataFree(virCPUDataPtr data); =20 +bool +virCPUGetHostIsSupported(virArch arch); + virCPUDefPtr virCPUGetHost(virArch arch, virCPUType type, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 8509f639e..d2b7b5cd1 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1033,6 +1033,7 @@ virCPUDataNew; virCPUDataParse; virCPUExpandFeatures; virCPUGetHost; +virCPUGetHostIsSupported; virCPUGetModels; virCPUProbeHost; virCPUTranslate; --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list