From nobody Fri Apr 26 04:13:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1630940344; cv=none; d=zohomail.com; s=zohoarc; b=F+PXag7kQdAFaEJJtqc93Hs5/0yPxRszSRjUe6c2gcdiOUSBqiNA2cz/kX++qSVK0xu+SCUGZdJI4tAEaUdtgAm4P3cvmtU3pAIFRuyia+MStGveNovRk4Pkw6L+3N+bk9fTIOF2GgqS7WVT03GyOn4T/nUQQqod+4t5kP37FtQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630940344; h=Content-Type:Content-Transfer-Encoding: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=8S6cRPOR5KwFYixRaiwThXeUxi3EaW0a4x9aZzwPLm8=; b=OrWAffu8iHpc2QhO9kQ4a8ka5U7IdWQglMnRwFDhOr/PJePC3fgswu66kNPyb7xKunGfWRsRN2iuf1mamK0FuWXgU9p7x6jzheO/Aq9MUeVU09Wn8aLmKh2X09WNXWziNGfnX8/Y1AljqWObGlO8rMu+qEcbPnse/lkJZMUuwvc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1630940344854507.58355448884197; Mon, 6 Sep 2021 07:59:04 -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-202-Lv481XUFPUee0cyRlPrZDA-1; Mon, 06 Sep 2021 10:59:01 -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 29C03802C89; Mon, 6 Sep 2021 14:58:57 +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 00C4677BF7; Mon, 6 Sep 2021 14:58:57 +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 BF0CE1809C98; Mon, 6 Sep 2021 14:58:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 186EwsZp004446 for ; Mon, 6 Sep 2021 10:58:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2F18F77716; Mon, 6 Sep 2021 14:58:54 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADC1D6608B for ; Mon, 6 Sep 2021 14:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630940343; 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=8S6cRPOR5KwFYixRaiwThXeUxi3EaW0a4x9aZzwPLm8=; b=We8zIdFDsl9byTzWstcunAvSK2jJUmhbd8Q5UHeESNUYz51ZlQomIpP5Ew5hMyZzq1NIFJ ZF/NtHkZFyG0YYbumXAFI/vez4iJh8vtAgrni424nKWnM8+JUOIFBKOwHouM21F2xU5xgP GbeGwGDLSl5Aa91knE3ZztTP+Wglw60= X-MC-Unique: Lv481XUFPUee0cyRlPrZDA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/6] libxl: capabilities: assume Xen version >= 4.7 Date: Mon, 6 Sep 2021 16:58:44 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630940346108100002 Remove the code handling old Xen's hwcap words, as well as the comment describing it. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Jim Fehlig --- src/libxl/libxl_capabilities.c | 54 +++++++++++++--------------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index b4bd1d7e62..1953d7a87a 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -90,41 +90,33 @@ libxlCapsAddCPUID(virCPUData *data, virCPUx86CPUID *cpu= id, ssize_t ncaps) * across all supported versions of the libxl driver until libxl exposes a * stable representation of these capabilities. Fortunately not a lot of * variation happened so it's still trivial to keep track of these leafs - * to describe host CPU in libvirt capabilities. v0 stands for Xen 4.4 - * up to 4.6, while v1 is meant for Xen 4.7, as depicted in the table belo= w: + * to describe host CPU in libvirt capabilities. * - * | v0 (Xen 4.4 - 4.6) | v1 (Xen >=3D 4.7) | - * --------------------------------------------- - * word 0 | CPUID.00000001.EDX | CPUID.00000001.EDX | - * word 1 | CPUID.80000001.EDX | CPUID.00000001.ECX | - * word 2 | CPUID.80860001 | CPUID.80000001.EDX | - * word 3 | - Linux - | CPUID.80000001.ECX | - * word 4 | CPUID.00000001.ECX | CPUID.0000000D:1.EAX | - * word 5 | CPUID.C0000001 | CPUID.00000007:0.EBX | - * word 6 | CPUID.80000001.ECX | CPUID.00000007:0.ECX | - * word 7 | CPUID.00000007.EBX | CPUID.80000007.EDX | - * word 8 | - Non existent - | CPUID.80000008.EBX | + * | Xen >=3D 4.7 | + * ------------------------ + * word 0 | CPUID.00000001.EDX | + * word 1 | CPUID.00000001.ECX | + * word 2 | CPUID.80000001.EDX | + * word 3 | CPUID.80000001.ECX | + * word 4 | CPUID.0000000D:1.EAX | + * word 5 | CPUID.00000007:0.EBX | + * word 6 | CPUID.00000007:0.ECX | + * word 7 | CPUID.80000007.EDX | + * word 8 | CPUID.80000008.EBX | * */ static virCPUData * libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap, - enum libxlHwcapVersion version) + enum libxlHwcapVersion version G_GNUC_UNUSED) { ssize_t ncaps; virCPUData *cpudata =3D NULL; virCPUx86CPUID cpuid[] =3D { - { .eax_in =3D 0x00000001, - .edx =3D hwcap[0] }, - { .eax_in =3D 0x00000001, - .ecx =3D (version > LIBXL_HWCAP_V0 ? hwcap[1] : hwcap[4]) }, - { .eax_in =3D 0x80000001, - .edx =3D (version > LIBXL_HWCAP_V0 ? hwcap[2] : hwcap[1]) }, - { .eax_in =3D 0x80000001, - .ecx =3D (version > LIBXL_HWCAP_V0 ? hwcap[3] : hwcap[6]) }, - { .eax_in =3D 0x00000007, - .ebx =3D (version > LIBXL_HWCAP_V0 ? hwcap[5] : hwcap[7]) }, - }; - virCPUx86CPUID cpuid_ver1[] =3D { + { .eax_in =3D 0x00000001, .edx =3D hwcap[0] }, + { .eax_in =3D 0x00000001, .ecx =3D hwcap[1] }, + { .eax_in =3D 0x80000001, .edx =3D hwcap[2] }, + { .eax_in =3D 0x80000001, .ecx =3D hwcap[3] }, + { .eax_in =3D 0x00000007, .ebx =3D hwcap[5] }, { .eax_in =3D 0x0000000D, .ecx_in =3D 1U, .eax =3D hwcap[4] }, { .eax_in =3D 0x00000007, .ecx_in =3D 0U, .ecx =3D hwcap[6] }, { .eax_in =3D 0x80000007, .ecx_in =3D 0U, .edx =3D hwcap[7] }, @@ -137,11 +129,6 @@ libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap, if (libxlCapsAddCPUID(cpudata, cpuid, ncaps) < 0) goto error; =20 - ncaps =3D G_N_ELEMENTS(cpuid_ver1); - if (version > LIBXL_HWCAP_V0 && - libxlCapsAddCPUID(cpudata, cpuid_ver1, ncaps) < 0) - goto error; - return cpudata; =20 error: @@ -156,7 +143,7 @@ libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap, */ static int libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_info, - enum libxlHwcapVersion version) + enum libxlHwcapVersion version G_GNUC_UNUSED) { virCPUData *data =3D NULL; virCPUDef *cpu =3D NULL; @@ -175,8 +162,7 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_inf= o, virCapabilitiesAddHostFeature(caps, "pae") < 0) goto error; =20 - host_lm =3D (phy_info->hw_cap[version > LIBXL_HWCAP_V0 ? 2 : 1] - & LIBXL_X86_FEATURE_LM_MASK); + host_lm =3D (phy_info->hw_cap[2] & LIBXL_X86_FEATURE_LM_MASK); if (host_lm) cpu->arch =3D VIR_ARCH_X86_64; else --=20 2.31.1 From nobody Fri Apr 26 04:13:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1630940404; cv=none; d=zohomail.com; s=zohoarc; b=AxF5fuZdM5yaFsCUUPgSylqlDzXj57igGxUMH0f1a0tnZClALmPkw+t85egROjq5D8FSo2sXTfVcNVfq735PIoHek2kQns1BE7+nedv1XNS0WkCAdrH1fPbEgIqKXwwwzfN7bP98BCLZ3hEKEI2OMiaHhUQ4FFwC6Mvab4xIs44= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630940404; h=Content-Type:Content-Transfer-Encoding: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=C+weTIpjwMZOCXRxgy+EDElNmF1d2fGn9LPfK43QGXk=; b=BH/6upCBPqzBTZB9h7kJ44QOAuF1mM68pNxowEtIxH/YBEz+kq6mtq9G9odfwkWLekZPZPn2J5FGv8ETESEXq08vjN9J4xeXD0+u/aWGUlAS4hzsRZkNRc2tiBCtMlOEkt3pN+SO5Z5YF73zofcab7nPrXtcuM54rYdMhypjF0o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1630940404728826.6061529037339; Mon, 6 Sep 2021 08:00:04 -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-413-HI2fOJNTNK6yBNtVn9QfOA-1; Mon, 06 Sep 2021 10:59:08 -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 C54D2100E40F; Mon, 6 Sep 2021 14:59:02 +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 580AF5D9F4; Mon, 6 Sep 2021 14:59:02 +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 289B744A5F; Mon, 6 Sep 2021 14:59:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 186EwswC004454 for ; Mon, 6 Sep 2021 10:58:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id EFA7577716; Mon, 6 Sep 2021 14:58:54 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AAE56608B for ; Mon, 6 Sep 2021 14:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630940403; 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=C+weTIpjwMZOCXRxgy+EDElNmF1d2fGn9LPfK43QGXk=; b=MQL78HZxCyi9oy7ZR7s8mjHBL1KH0SFjNYJ9IM7T0INHKTL15+lWHoBUJUyrUp+84nNuZD v6Cs31L4OnjHQkpwuB9NHtF019jveLOcz1Q3PaKSKHYmHXMm0AOmXbGFZsf59+cgbVMg/A Ou0Q4ntTtu00XELGEa4XwLDRhcUeO9E= X-MC-Unique: HI2fOJNTNK6yBNtVn9QfOA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/6] libxl: remove enum libxlHwcapVersion Date: Mon, 6 Sep 2021 16:58:45 +0200 Message-Id: <315c682779553766c48ded1fe69d648c541543bc.1630939770.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630940406289100001 As well as the code probing for the version in libxlCapsInitHost. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Jim Fehlig --- src/libxl/libxl_capabilities.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 1953d7a87a..d98109ea86 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -45,11 +45,6 @@ VIR_LOG_INIT("libxl.libxl_capabilities"); #define LIBXL_X86_FEATURE_PAE_MASK (1 << 6) #define LIBXL_X86_FEATURE_LM_MASK (1 << 29) =20 -enum libxlHwcapVersion { - LIBXL_HWCAP_V0 =3D 0, /* for Xen 4.4 .. 4.6 */ - LIBXL_HWCAP_V1, /* for Xen 4.7 and up */ -}; - struct guest_arch { virArch arch; int hvm; @@ -106,8 +101,7 @@ libxlCapsAddCPUID(virCPUData *data, virCPUx86CPUID *cpu= id, ssize_t ncaps) * */ static virCPUData * -libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap, - enum libxlHwcapVersion version G_GNUC_UNUSED) +libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap) { ssize_t ncaps; virCPUData *cpudata =3D NULL; @@ -142,8 +136,7 @@ libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap, * the X'th 32-bit word of hw_cap. */ static int -libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_info, - enum libxlHwcapVersion version G_GNUC_UNUSED) +libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_info) { virCPUData *data =3D NULL; virCPUDef *cpu =3D NULL; @@ -177,7 +170,7 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_inf= o, =20 ret =3D 0; =20 - if (!(data =3D libxlCapsNodeData(cpu, phy_info->hw_cap, version)) || + if (!(data =3D libxlCapsNodeData(cpu, phy_info->hw_cap)) || cpuDecode(cpu, data, NULL) < 0) { VIR_WARN("Failed to initialize host cpu features"); goto error; @@ -196,8 +189,6 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_inf= o, static int libxlCapsInitHost(libxl_ctx *ctx, virCaps *caps) { - const libxl_version_info *ver_info; - enum libxlHwcapVersion version; libxl_physinfo phy_info; int ret =3D -1; =20 @@ -208,14 +199,7 @@ libxlCapsInitHost(libxl_ctx *ctx, virCaps *caps) goto cleanup; } =20 - if ((ver_info =3D libxl_get_version_info(ctx)) =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to get version info from libxenlight")); - goto cleanup; - } - - version =3D (ver_info->xen_version_minor >=3D 7); - if (libxlCapsInitCPU(caps, &phy_info, version) < 0) + if (libxlCapsInitCPU(caps, &phy_info) < 0) goto cleanup; =20 if (virCapabilitiesSetNetPrefix(caps, LIBXL_GENERATED_PREFIX_XEN) < 0) --=20 2.31.1 From nobody Fri Apr 26 04:13:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1630940350; cv=none; d=zohomail.com; s=zohoarc; b=NhPu7jxUaDIQ69McbAsVHX/edOAPCUk5YXT8rd80MONCANEQq2Bw23sEPY0TZlAd3D3YNzS+n32CGY9jdX3qWarbeLUUuTshJVcjz4lKvjpwv3I6FfPpkG8jUsC/Fp5odrh/WCCM/vpCQs9K4IAtQ8BvAJHFPa54wCByarivpuM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630940350; h=Content-Type:Content-Transfer-Encoding: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=kPvBe8Xo3J6db1fx3g3zPRVonQTAlKedB67W/Kvhmlo=; b=QhxJH4chEnxyOlEEO2lEp35FiT4yvWYn5usH//hY8IO4Qn/2IBpPqIO5WQI+GALj+AeTjHpjtqlvC8NQomEkPxxV3TJjbfqqeOjA/JZ3M+I+Jm1jg2QljhHhy0flFm/zuhUiZc3TWvt16KQ70LaLIhiozhirweRnUG8Zrp2SCZ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1630940350517965.808248909112; Mon, 6 Sep 2021 07:59:10 -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-413-TrUsW5MzPtCVdwpngNVeuw-1; Mon, 06 Sep 2021 10:59:08 -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 31C6A100E3FF; Mon, 6 Sep 2021 14:59:02 +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 1455360CA1; Mon, 6 Sep 2021 14:59:02 +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 DC6F51800FE4; Mon, 6 Sep 2021 14:59:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 186EwtBf004461 for ; Mon, 6 Sep 2021 10:58:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id BD15877716; Mon, 6 Sep 2021 14:58:55 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47A536608B for ; Mon, 6 Sep 2021 14:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630940349; 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=kPvBe8Xo3J6db1fx3g3zPRVonQTAlKedB67W/Kvhmlo=; b=A+2jnPJV53xQpeLDrv403iHbFidw24oig9nS1bg5ZQl7+z9gsp2+csoKNzDbE3+La+D5WH kHQUUii9OGnXvPHnvNswEtpZbb14Mpxu0PZdlCmuee9q/hFdUhxGkIdqMtigOvxEXkqWnY F3UG4h2ugadou4mLL8GtsNJVJ8cFSjk= X-MC-Unique: TrUsW5MzPtCVdwpngNVeuw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/6] libxl: capsInitCPU: fail if we can't initialize host features Date: Mon, 6 Sep 2021 16:58:46 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630940350844100003 Introduced by: commit 17322e551861a5bc4dd464a7c5399204dc8c7caa libxl: describe host cpu features based on hwcaps with the justification that libxl_hwcaps does not have a stable format across all version. Even though the code would return '0' in the case of such failure, it frees the 'cpu' pointer, while keeping it in caps->host. Based on that, assume it does not happen in current usage. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Jim Fehlig --- src/libxl/libxl_capabilities.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index d98109ea86..9d0ed921bd 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -166,16 +166,17 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_i= nfo) cpu->threads =3D phy_info->threads_per_core; cpu->dies =3D 1; cpu->sockets =3D phy_info->nr_cpus / (cpu->cores * cpu->threads); - caps->host.cpu =3D cpu; - - ret =3D 0; =20 if (!(data =3D libxlCapsNodeData(cpu, phy_info->hw_cap)) || cpuDecode(cpu, data, NULL) < 0) { - VIR_WARN("Failed to initialize host cpu features"); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to initialize host cpu features")); goto error; } =20 + caps->host.cpu =3D cpu; + ret =3D 0; + cleanup: virCPUDataFree(data); =20 --=20 2.31.1 From nobody Fri Apr 26 04:13:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1630940345; cv=none; d=zohomail.com; s=zohoarc; b=QdIZ+XthJvMatX02JWDTjRB+6LZ/uCCzopf0dKoEZ1tgr3xhVvHBtuxcq061DMKjktSXxGfcDeQZnkMFG3k5R407gZMD02RZhX6kmMrUqdK3XsVwy+E35uLLGxCy62eYWao+MrLkK56LDAlW83imiYm4vm/rCJgrt2Nwu4PH9QI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630940345; h=Content-Type:Content-Transfer-Encoding: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=AnZii8O2mdVTo47JXblbfnXCja/BquWaFxCe11X6BFU=; b=ZvolrH8VeNsQhaNbT+uDIvOqoPFcdzWKZi7oDyIw/PiDoGRasmSpL5q3ErWdu5Zhpzqin2dekIhHkY/d7FUiStGy31mF6tevypMZnyh+tMxmv/NbvCdEdBPOCq22ET0TYZ8mdE0sxpi1lmOZzVMFfbg9TrHxm/fTlrkHbZlY4mc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1630940345742166.8699326916519; Mon, 6 Sep 2021 07:59:05 -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-kKeUSPYaPjil5U3RK781Hg-1; Mon, 06 Sep 2021 10:59:02 -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 15E12824FA8; Mon, 6 Sep 2021 14:58:58 +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 C68931ABD8; Mon, 6 Sep 2021 14:58:57 +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 8F83744A5C; Mon, 6 Sep 2021 14:58:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 186EwuRI004476 for ; Mon, 6 Sep 2021 10:58:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A48E6608B; Mon, 6 Sep 2021 14:58:56 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15148779CE for ; Mon, 6 Sep 2021 14:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630940344; 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=AnZii8O2mdVTo47JXblbfnXCja/BquWaFxCe11X6BFU=; b=KlgWABNZ2T7K4/sS+Uop5V2b4dIMqbtTtx9Gi5J4SXfcjrrOBimeFpw5w1RZK4ZA03ScVk qKM5U89HhOyd1ibapr8l5iiE1/Et7ctDp9SGfZOJns/d6dzNNsELwcGijVH/2+EpM/KbY7 K8DrpmyztTZLMU25lW7TsXmQRbwM4YQ= X-MC-Unique: kKeUSPYaPjil5U3RK781Hg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/6] libxl: refactor libxlCapsInitCPU Date: Mon, 6 Sep 2021 16:58:47 +0200 Message-Id: <3056f3e6e37370984aad3e2dfccd4f3be57a6088.1630939770.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.15 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630940346245100005 Use g_auto, g_steal_pointer and remove unnecessary labels. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Jim Fehlig --- src/libxl/libxl_capabilities.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 9d0ed921bd..38a9b36d8b 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -138,9 +138,8 @@ libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap) static int libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_info) { - virCPUData *data =3D NULL; - virCPUDef *cpu =3D NULL; - int ret =3D -1; + g_autoptr(virCPUData) data =3D NULL; + g_autoptr(virCPUDef) cpu =3D NULL; int host_pae; int host_lm; =20 @@ -153,7 +152,7 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_inf= o) host_pae =3D phy_info->hw_cap[0] & LIBXL_X86_FEATURE_PAE_MASK; if (host_pae && virCapabilitiesAddHostFeature(caps, "pae") < 0) - goto error; + return -1; =20 host_lm =3D (phy_info->hw_cap[2] & LIBXL_X86_FEATURE_LM_MASK); if (host_lm) @@ -171,20 +170,11 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_i= nfo) cpuDecode(cpu, data, NULL) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to initialize host cpu features")); - goto error; + return -1; } =20 - caps->host.cpu =3D cpu; - ret =3D 0; - - cleanup: - virCPUDataFree(data); - - return ret; - - error: - virCPUDefFree(cpu); - goto cleanup; + caps->host.cpu =3D g_steal_pointer(&cpu); + return 0; } =20 static int --=20 2.31.1 From nobody Fri Apr 26 04:13:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1630940406; cv=none; d=zohomail.com; s=zohoarc; b=Pm6iU/SEZhHKiyxzV8zEuMAiqdCeGMSc/1fkog1876QBgxCwWN8xOtsjbwHuPhcuNHD+ubJ5goULUJ0xzcTEOQRGKLVf35j1rHZE3ruoeCvREenfo4rSVdadbmxyeS3W0ybh50lu+pK6wvRSolYpv8LwmKAlHxhyzo5kAiLWEtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630940406; h=Content-Type:Content-Transfer-Encoding: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=w/YSi/OYGs7GEwDvkh3E5poDrjRnkTJi7q+vhKu4L3U=; b=GLynPt0A0NoikK4WsN2JAtg7Dp+OjgmhQDTKDzhHobmRp9CIkrkaSFuxaQ+bwVTuErEELU/sbynbJLs5DD68n075nOFH8M9pML1FsZ+VMYiheJ1W5Z0CJvsvLmgvhBhJ+2QZpsC8lHryXeX3B6lO7T21rOu42sYUU/p/cg++TFc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1630940406473749.145645339621; Mon, 6 Sep 2021 08:00: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-73-vHTRpXwcNu-jj3ZwCkp6Dw-1; Mon, 06 Sep 2021 10:59:12 -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 BAD18802CB8; Mon, 6 Sep 2021 14:59:06 +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 8781469FAE; Mon, 6 Sep 2021 14:59:06 +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 59F7B44A61; Mon, 6 Sep 2021 14:59:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 186EwvHY004486 for ; Mon, 6 Sep 2021 10:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 575FD77716; Mon, 6 Sep 2021 14:58:57 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id D69986608B for ; Mon, 6 Sep 2021 14:58:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630940405; 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=w/YSi/OYGs7GEwDvkh3E5poDrjRnkTJi7q+vhKu4L3U=; b=Z5yGc379AtBqTe2VvRY8KPDyyhBlWht4Zgiv35l5epKkTXY/Yxryzz4PUNG6B9AbiVWis6 Yw185PJD929Ht3ZQ0ebFwRdK3EQUDRDetvvUe5LHSKbUr2VvQfByQVG0ECfdHhz2S0W7WY AZ8vtMaJm7jjZyIIaqWdL7zvLzQELXo= X-MC-Unique: vHTRpXwcNu-jj3ZwCkp6Dw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 5/6] libxl: use g_auto in libxlCapsNodeData Date: Mon, 6 Sep 2021 16:58:48 +0200 Message-Id: <22d5698c74831accf4c4f1a7aa2e0b919c331541.1630939770.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630940409064100001 Also remove pointless labels. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Jim Fehlig --- src/libxl/libxl_capabilities.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 38a9b36d8b..ef77bec7a0 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -104,7 +104,7 @@ static virCPUData * libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap) { ssize_t ncaps; - virCPUData *cpudata =3D NULL; + g_autoptr(virCPUData) cpudata =3D NULL; virCPUx86CPUID cpuid[] =3D { { .eax_in =3D 0x00000001, .edx =3D hwcap[0] }, { .eax_in =3D 0x00000001, .ecx =3D hwcap[1] }, @@ -117,17 +117,13 @@ libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap) }; =20 if (!(cpudata =3D virCPUDataNew(cpu->arch))) - goto error; + return NULL; =20 ncaps =3D G_N_ELEMENTS(cpuid); if (libxlCapsAddCPUID(cpudata, cpuid, ncaps) < 0) - goto error; + return NULL; =20 - return cpudata; - - error: - virCPUDataFree(cpudata); - return NULL; + return g_steal_pointer(&cpudata); } =20 /* hw_caps is an array of 32-bit words whose meaning is listed in --=20 2.31.1 From nobody Fri Apr 26 04:13:46 2024 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=1630940353; cv=none; d=zohomail.com; s=zohoarc; b=cPtp9eby3l3DhO9XeFXVJyhNwHfrQi+ctSnp29fiiCJItUGUqDuJEOwcAbvD/e0TP2hHLed2Mv9NI5wP4Xb7h5nmUfRbYDJohDqwkHv43ElPY7gyhndwI/0XJWz2ZAvCWicYtDXUHQoEaLQC4ooogySyszvKi4FqBIrflqa22JU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630940353; h=Content-Type:Content-Transfer-Encoding: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=fDH9ZDdmpsVrkPigrgJkLKd4pOrjyA9seT70m+t2QQQ=; b=b55uQd5Xzs+F/AUuSJFP2OQJKDhdcV5krGcclCvFli879j3OfaB1UsFyTxXW5cP0W1/fJ7/puctUUhpcr+VOLty2UbT7po4aNC3mfKASYa2P/IxS14q7tw+d+cG9c9d14Zna9wsNt4CkUSlX6pQWMibO4ulMvgBpG1qIuQaF/qs= 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 1630940353208138.91929234234215; Mon, 6 Sep 2021 07:59: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-5-xZuEnJvDNpKkHy-Q8xnqOw-1; Mon, 06 Sep 2021 10:59:10 -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 AB3FA18766D4; Mon, 6 Sep 2021 14:59: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 903B36A255; Mon, 6 Sep 2021 14:59: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 636B7180B44F; Mon, 6 Sep 2021 14:59:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 186EwwTf004497 for ; Mon, 6 Sep 2021 10:58:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 24D60779D2; Mon, 6 Sep 2021 14:58:58 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A39656608B for ; Mon, 6 Sep 2021 14:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630940352; 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=fDH9ZDdmpsVrkPigrgJkLKd4pOrjyA9seT70m+t2QQQ=; b=E5PHN7kEL362gbSafvJqCVLqmA2vneZh1VZrkMupGjrclKzsB1HGPNjj+Dm8RJ6vphVoqD u9ZH7aLY4z/1nAJoJI6Eu0frnIoFJDCGcMQXRHPxz9Oq2JY4fzCVm5P+GBeyL2cYPQ7lxu o0cnwYQHhn/SGujtwpuq1WP/5IKHh7U= X-MC-Unique: xZuEnJvDNpKkHy-Q8xnqOw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 6/6] libxl: use g_auto in libxlDomainGetEmulatorType Date: Mon, 6 Sep 2021 16:58:49 +0200 Message-Id: <7d71b1862b11f83985824afabdf05c44d63178ed.1630939770.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630940355365100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Jim Fehlig --- src/libxl/libxl_capabilities.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index ef77bec7a0..a516910215 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -715,13 +715,13 @@ int libxlDomainGetEmulatorType(const virDomainDef *def) { int ret =3D LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN; - virCommand *cmd =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; g_autofree char *output =3D NULL; =20 if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { if (def->emulator) { if (!virFileExists(def->emulator)) - goto cleanup; + return ret; =20 cmd =3D virCommandNew(def->emulator); =20 @@ -729,14 +729,12 @@ libxlDomainGetEmulatorType(const virDomainDef *def) virCommandSetOutputBuffer(cmd, &output); =20 if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return ret; =20 if (strstr(output, LIBXL_QEMU_DM_STR)) ret =3D LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL; } } =20 - cleanup: - virCommandFree(cmd); return ret; } --=20 2.31.1