From nobody Fri May 16 10:56:15 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 149614879017733.17231722989959; Tue, 30 May 2017 05:53:10 -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 3025EC0467DD; Tue, 30 May 2017 12:53:06 +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 E9D2574AB7; Tue, 30 May 2017 12:53:05 +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 9F3F6180BAF8; Tue, 30 May 2017 12:53:05 +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 v4UCqvd1013128 for ; Tue, 30 May 2017 08:52:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id BC4BA19C98; Tue, 30 May 2017 12:52:57 +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 1D6FC19E97; Tue, 30 May 2017 12:52:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3025EC0467DD Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.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 3025EC0467DD From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 30 May 2017 14:50:24 +0200 Message-Id: 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 01/18] conf: introduce virDomainControllerDriverFormat 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.31]); Tue, 30 May 2017 12:53:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Split out formatting the subelement of to make adding new options easier. --- src/conf/domain_conf.c | 55 +++++++++++++++++++++++++++++-----------------= ---- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c7e20b8..318e254 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21357,6 +21357,37 @@ virDomainDiskDefFormat(virBufferPtr buf, #undef FORMAT_IOTUNE =20 =20 +static void +virDomainControllerDriverFormat(virBufferPtr buf, + virDomainControllerDefPtr def) +{ + virBuffer driverBuf =3D VIR_BUFFER_INITIALIZER; + + if (def->queues) + virBufferAsprintf(&driverBuf, " queues=3D'%u'", def->queues); + + if (def->cmd_per_lun) + virBufferAsprintf(&driverBuf, " cmd_per_lun=3D'%u'", def->cmd_per_= lun); + + if (def->max_sectors) + virBufferAsprintf(&driverBuf, " max_sectors=3D'%u'", def->max_sect= ors); + + if (def->ioeventfd) { + virBufferAsprintf(&driverBuf, " ioeventfd=3D'%s'", + virTristateSwitchTypeToString(def->ioeventfd)); + } + + if (def->iothread) + virBufferAsprintf(&driverBuf, " iothread=3D'%u'", def->iothread); + + if (virBufferUse(&driverBuf)) { + virBufferAddLit(buf, "\n"); + } +} + + static int virDomainControllerDefFormat(virBufferPtr buf, virDomainControllerDefPtr def, @@ -21366,7 +21397,6 @@ virDomainControllerDefFormat(virBufferPtr buf, const char *model =3D NULL; const char *modelName =3D NULL; bool pcihole64 =3D false, pciModel =3D false, pciTarget =3D false; - virBuffer driverBuf =3D VIR_BUFFER_INITIALIZER; =20 if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -21471,28 +21501,7 @@ virDomainControllerDefFormat(virBufferPtr buf, } } =20 - if (def->queues) - virBufferAsprintf(&driverBuf, " queues=3D'%u'", def->queues); - - if (def->cmd_per_lun) - virBufferAsprintf(&driverBuf, " cmd_per_lun=3D'%u'", def->cmd_= per_lun); - - if (def->max_sectors) - virBufferAsprintf(&driverBuf, " max_sectors=3D'%u'", def->max_= sectors); - - if (def->ioeventfd) { - virBufferAsprintf(&driverBuf, " ioeventfd=3D'%s'", - virTristateSwitchTypeToString(def->ioeventfd= )); - } - - if (def->iothread) - virBufferAsprintf(&driverBuf, " iothread=3D'%u'", def->iothrea= d); - - if (virBufferUse(&driverBuf)) { - virBufferAddLit(buf, "\n"); - } + virDomainControllerDriverFormat(buf, def); =20 if (virDomainDeviceInfoNeedsFormat(&def->info, flags) && virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list