From nobody Sun Feb 8 07:14:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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 ARC-Seal: i=1; a=rsa-sha256; t=1572960512; cv=none; d=zoho.com; s=zohoarc; b=D4LXL7vDF147NXZpbyDq4XZphcESz03g+QGIb3bCCMrQi5bEXRC/y8FbAoqWt6eHCutP99ECD+KJuOUBef+luLiUwxLySgsBSumiQXfvpLHyyJ7XoZNhk8DJ+h/zEi7M38hFEwuqEkcsKez+famFPDEXFOnuJR8Ds5ZOUbWQXKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572960512; 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=yBYu7y+E+g31stYTUC/Vko7rfirnphNdOJJR3zwNwdI=; b=KW+QMNZyvuwWW/r9NmQmt9St6sk2ITdESZt+2JB7t0CYzvlYPnnT0ZYEKX+saTpZnhQwMgcaBBsFnXK/vz8dirHSY0C0hZZUipigHA1uydhgBDbYxpc/z7y2rNxw2/i//1PHLnciIgOujL7p/CfDAyPGrJ1fCPgi2I5e9ugIjNA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1572960512526735.5481875492216; Tue, 5 Nov 2019 05:28:32 -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-419-5Iw63wvkNOKxqba0K7OgGw-1; Tue, 05 Nov 2019 08:28:29 -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 AA56885B6EF; Tue, 5 Nov 2019 13:28:23 +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 7A2D6608B4; Tue, 5 Nov 2019 13:28:23 +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 333251803C43; Tue, 5 Nov 2019 13:28:23 +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 xA5DRx2p003930 for ; Tue, 5 Nov 2019 08:27:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 538AF608B6; Tue, 5 Nov 2019 13:27:59 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 28FDD608B9 for ; Tue, 5 Nov 2019 13:27:59 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 98D0A105B2E; Tue, 5 Nov 2019 14:27:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572960511; 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=yBYu7y+E+g31stYTUC/Vko7rfirnphNdOJJR3zwNwdI=; b=Ck1caF5zwna8WcaZdqrUzCvzoT7qtyikxd9kuhWA+99/y5wsb6oboihdWuK8/niBh9wB86 EJ+tgYnRa7kDb8Xtm6tLA85y5uLfVRFknBvH341Em/eQUunbAMkiZktKbWTPLNfsQ5Ce14 sPbBo/OISzOkb9VqYtm67RPV/wrn8tA= From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 5 Nov 2019 14:27:15 +0100 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 Subject: [libvirt] [PATCH v3 17/52] qemu: Split virQEMUCapsFetchCPUModels 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 X-MC-Unique: 5Iw63wvkNOKxqba0K7OgGw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Most of the code moved to a new virQEMUCapsFetchCPUDefinitions function and the existing virQEMUCapsFetchCPUModels just becomes a small wrapper around virQEMUCapsFetchCPUDefinitions and virQEMUCapsCPUDefsToModels. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - new patch =20 Version 3: - g_autoptr, g_steal_pointer src/qemu/qemu_capabilities.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index dfffc45d1d..431841e61e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2471,15 +2471,15 @@ virQEMUCapsProbeQMPMachineProps(virQEMUCapsPtr qemu= Caps, } =20 =20 -int -virQEMUCapsFetchCPUModels(qemuMonitorPtr mon, - virArch arch, - virDomainCapsCPUModelsPtr *cpuModels) +static int +virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon, + virArch arch, + qemuMonitorCPUDefsPtr *cpuDefs) { g_autoptr(qemuMonitorCPUDefs) defs =3D NULL; size_t i; =20 - *cpuModels =3D NULL; + *cpuDefs =3D NULL; =20 if (qemuMonitorGetCPUDefinitions(mon, &defs) < 0) return -1; @@ -2507,7 +2507,24 @@ virQEMUCapsFetchCPUModels(qemuMonitorPtr mon, } } =20 - if (!(*cpuModels =3D virQEMUCapsCPUDefsToModels(defs, NULL, NULL))) + *cpuDefs =3D g_steal_pointer(&defs); + return 0; +} + + +int +virQEMUCapsFetchCPUModels(qemuMonitorPtr mon, + virArch arch, + virDomainCapsCPUModelsPtr *cpuModels) +{ + g_autoptr(qemuMonitorCPUDefs) defs =3D NULL; + + *cpuModels =3D NULL; + + if (virQEMUCapsFetchCPUDefinitions(mon, arch, &defs) < 0) + return -1; + + if (defs && !(*cpuModels =3D virQEMUCapsCPUDefsToModels(defs, NULL, NU= LL))) return -1; =20 return 0; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list