From nobody Wed Jul 9 23:09:37 2025 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 1496148793270729.9111293561384; Tue, 30 May 2017 05:53:13 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 63D532D9FFE; Tue, 30 May 2017 12:53:10 +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 386967E3A2; Tue, 30 May 2017 12:53:10 +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 D402D4A492; Tue, 30 May 2017 12:53:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4UCr4vM013172 for ; Tue, 30 May 2017 08:53:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id F287D19F00; Tue, 30 May 2017 12:53:03 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 404C65B81A; Tue, 30 May 2017 12:53:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 63D532D9FFE Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.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 63D532D9FFE From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 30 May 2017 14:50:28 +0200 Message-Id: <02f08e6de6f94e8bf23898ccf0864cb57bfbc68b.1496148357.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jasowang@redhat.com Subject: [libvirt] [PATCH 05/18] virDomainControllerDefFormat: move PCI model and target formatting 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 30 May 2017 12:53:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" These can be formatted right when we know we will need them. No need for separate bool variables. --- src/conf/domain_conf.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 81385d6..b47a376 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21396,7 +21396,7 @@ virDomainControllerDefFormat(virBufferPtr buf, const char *type =3D virDomainControllerTypeToString(def->type); const char *model =3D NULL; const char *modelName =3D NULL; - bool pcihole64 =3D false, pciModel =3D false, pciTarget =3D false; + bool pcihole64 =3D false; virBuffer childBuf =3D VIR_BUFFER_INITIALIZER; =20 virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2); @@ -21446,22 +21446,7 @@ virDomainControllerDefFormat(virBufferPtr buf, case VIR_DOMAIN_CONTROLLER_TYPE_PCI: if (def->opts.pciopts.pcihole64) pcihole64 =3D true; - if (def->opts.pciopts.modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MOD= EL_NAME_NONE) - pciModel =3D true; - if (def->opts.pciopts.chassisNr !=3D -1 || - def->opts.pciopts.chassis !=3D -1 || - def->opts.pciopts.port !=3D -1 || - def->opts.pciopts.busNr !=3D -1 || - def->opts.pciopts.numaNode !=3D -1) - pciTarget =3D true; - break; - - default: - break; - } - - if (pciModel || pciTarget) { - if (pciModel) { + if (def->opts.pciopts.modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MOD= EL_NAME_NONE) { modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -21471,8 +21456,11 @@ virDomainControllerDefFormat(virBufferPtr buf, } virBufferAsprintf(&childBuf, "\n", modelNa= me); } - - if (pciTarget) { + if (def->opts.pciopts.chassisNr !=3D -1 || + def->opts.pciopts.chassis !=3D -1 || + def->opts.pciopts.port !=3D -1 || + def->opts.pciopts.busNr !=3D -1 || + def->opts.pciopts.numaNode !=3D -1) { virBufferAddLit(&childBuf, "opts.pciopts.chassisNr !=3D -1) virBufferAsprintf(&childBuf, " chassisNr=3D'%d'", @@ -21497,6 +21485,10 @@ virDomainControllerDefFormat(virBufferPtr buf, virBufferAddLit(&childBuf, "\n"); } } + break; + + default: + break; } =20 virDomainControllerDriverFormat(&childBuf, def); --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list