From nobody Thu Dec 18 09:19:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1487154048549561.3144967248923; Wed, 15 Feb 2017 02:20:48 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1FAGhkD009792; Wed, 15 Feb 2017 05:16:45 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1FAFWgD003139 for ; Wed, 15 Feb 2017 05:15:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id C65372D5A1; Wed, 15 Feb 2017 10:15:32 +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 98CEA2D5E1 for ; Wed, 15 Feb 2017 10:15:32 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 6E9671020D1; Wed, 15 Feb 2017 11:15:29 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 15 Feb 2017 11:15:03 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/33] qemu: Introduce virQEMUCapsFormatHostCPUModelInfo 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The CPU model info formating code in virQEMUCapsFormatCache will get more complicated soon. Separating the code in virQEMUCapsFormatHostCPUModelInfo will make the result easier to read. Signed-off-by: Jiri Denemark --- src/qemu/qemu_capabilities.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c511248bd..688d19504 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3542,6 +3542,27 @@ virQEMUCapsLoadCache(virCapsPtr caps, =20 =20 static void +virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsPtr qemuCaps, + virBufferPtr buf) +{ + qemuMonitorCPUModelInfoPtr model =3D qemuCaps->hostCPUModelInfo; + size_t i; + + virBufferAsprintf(buf, "\n", model->name); + virBufferAdjustIndent(buf, 2); + + for (i =3D 0; i < model->nprops; i++) { + virBufferAsprintf(buf, "\n", + model->props[i].name, + model->props[i].supported ? "yes" : "no"); + } + + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); +} + + +static void virQEMUCapsFormatCPUModels(virQEMUCapsPtr qemuCaps, virBufferPtr buf, virDomainVirtType type) @@ -3617,19 +3638,8 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps, virBufferAsprintf(&buf, "%s\n", virArchToString(qemuCaps->arch)); =20 - if (qemuCaps->hostCPUModelInfo) { - virBufferAsprintf(&buf, "\n", - qemuCaps->hostCPUModelInfo->name); - virBufferAdjustIndent(&buf, 2); - for (i =3D 0; i < qemuCaps->hostCPUModelInfo->nprops; i++) { - virBufferAsprintf(&buf, "\n", - qemuCaps->hostCPUModelInfo->props[i].name, - qemuCaps->hostCPUModelInfo->props[i].support= ed ? - "yes" : "no"); - } - virBufferAdjustIndent(&buf, -2); - virBufferAddLit(&buf, "\n"); - } + if (qemuCaps->hostCPUModelInfo) + virQEMUCapsFormatHostCPUModelInfo(qemuCaps, &buf); =20 virQEMUCapsFormatCPUModels(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM); virQEMUCapsFormatCPUModels(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU); --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list