From nobody Sun Feb 8 11:17:03 2026 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.zohomail.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 1501075943579462.6328275865785; Wed, 26 Jul 2017 06:32:23 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 795A0272B2; Wed, 26 Jul 2017 13:32:19 +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 13D556A766; Wed, 26 Jul 2017 13:32:19 +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 6B731180B467; Wed, 26 Jul 2017 13:32:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6QDUPSd012149 for ; Wed, 26 Jul 2017 09:30:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 979C578157; Wed, 26 Jul 2017 13:30:25 +0000 (UTC) Received: from dnr.brq.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F1A278121 for ; Wed, 26 Jul 2017 13:30:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 795A0272B2 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Wed, 26 Jul 2017 15:29:36 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 8/8] Turn virDomainDeviceInfoFormat into void 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 26 Jul 2017 13:32:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The rombar attribute was already validated at the time of parsing the XML. Reviewed-by: John Ferlan --- src/conf/domain_conf.c | 94 ++++++++++++++++------------------------------= ---- 1 file changed, 30 insertions(+), 64 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4dc49fdb0..460776ec6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5332,7 +5332,7 @@ virDomainVirtioOptionsFormat(virBufferPtr buf, } =20 =20 -static int ATTRIBUTE_NONNULL(2) +static void ATTRIBUTE_NONNULL(2) virDomainDeviceInfoFormat(virBufferPtr buf, virDomainDeviceInfoPtr info, unsigned int flags) @@ -5360,16 +5360,10 @@ virDomainDeviceInfoFormat(virBufferPtr buf, =20 virBufferAddLit(buf, "rombar) { - const char *rombar =3D virTristateSwitchTypeToString(info->rom= bar); =20 - if (!rombar) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected rom bar value %d"), - info->rombar); - return -1; - } - virBufferAsprintf(buf, " bar=3D'%s'", rombar); + if (rombar) + virBufferAsprintf(buf, " bar=3D'%s'", rombar); } if (info->romfile) virBufferEscapeString(buf, " file=3D'%s'", info->romfile); @@ -5378,7 +5372,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf, =20 if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE || info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) - return 0; + return; =20 virBufferAsprintf(buf, "
type)); @@ -5465,7 +5459,6 @@ virDomainDeviceInfoFormat(virBufferPtr buf, } =20 virBufferAddLit(buf, "/>\n"); - return 0; } =20 static int @@ -21711,9 +21704,8 @@ virDomainDiskDefFormat(virBufferPtr buf, if (def->src->encryption && virStorageEncryptionFormat(buf, def->src->encryption) < 0) return -1; - if (virDomainDeviceInfoFormat(buf, &def->info, - flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT= ) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, + flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -21885,8 +21877,7 @@ virDomainControllerDefFormat(virBufferPtr buf, =20 virDomainControllerDriverFormat(&childBuf, def); =20 - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); =20 if (def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && def->opts.pciopts.pcihole64) { @@ -22018,9 +22009,7 @@ virDomainFSDefFormat(virBufferPtr buf, if (def->readonly) virBufferAddLit(buf, "\n"); =20 - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; - + virDomainDeviceInfoFormat(buf, &def->info, flags); =20 if (def->space_hard_limit) virBufferAsprintf(buf, "" @@ -22786,10 +22775,9 @@ virDomainNetDefFormat(virBufferPtr buf, =20 virDomainNetDefCoalesceFormatXML(buf, def->coalesce); =20 - if (virDomainDeviceInfoFormat(buf, &def->info, - flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT - | VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, + flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT + | VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -23024,8 +23012,7 @@ virDomainChrDefFormat(virBufferPtr buf, break; } =20 - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); =20 virBufferAdjustIndent(buf, -2); virBufferAsprintf(buf, "\n", elementName); @@ -23074,10 +23061,7 @@ virDomainSmartcardDefFormat(virBufferPtr buf, _("unexpected smartcard type %d"), def->type); return -1; } - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) { - virBufferFreeAndReset(&childBuf); - return -1; - } + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); =20 if (virBufferCheckError(&childBuf) < 0) return -1; @@ -23134,8 +23118,7 @@ virDomainTPMDefFormat(virBufferPtr buf, virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); =20 - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -23164,10 +23147,7 @@ virDomainSoundDefFormat(virBufferPtr buf, for (i =3D 0; i < def->ncodecs; i++) virDomainSoundCodecDefFormat(&childBuf, def->codecs[i]); =20 - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) { - virBufferFreeAndReset(&childBuf); - return -1; - } + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); =20 if (virBufferCheckError(&childBuf) < 0) return -1; @@ -23211,10 +23191,7 @@ virDomainMemballoonDefFormat(virBufferPtr buf, if (def->period) virBufferAsprintf(&childrenBuf, "\n", def->p= eriod); =20 - if (virDomainDeviceInfoFormat(&childrenBuf, &def->info, flags) < 0) { - virBufferFreeAndReset(&childrenBuf); - return -1; - } + virDomainDeviceInfoFormat(&childrenBuf, &def->info, flags); =20 if (def->virtio) { virBuffer driverBuf =3D VIR_BUFFER_INITIALIZER; @@ -23253,8 +23230,7 @@ virDomainNVRAMDefFormat(virBufferPtr buf, { virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -23286,8 +23262,7 @@ virDomainWatchdogDefFormat(virBufferPtr buf, return -1; } =20 - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); =20 if (virBufferCheckError(&childBuf) < 0) return -1; @@ -23319,8 +23294,7 @@ static int virDomainPanicDefFormat(virBufferPtr buf, virDomainPanicModelTypeToString(def->model)); =20 virBufferAdjustIndent(&childrenBuf, indent + 2); - if (virDomainDeviceInfoFormat(&childrenBuf, &def->info, 0) < 0) - return -1; + virDomainDeviceInfoFormat(&childrenBuf, &def->info, 0); =20 if (virBufferCheckError(&childrenBuf) < 0) return -1; @@ -23367,8 +23341,7 @@ virDomainShmemDefFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } =20 - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -23422,8 +23395,7 @@ virDomainRNGDefFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } =20 - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -23541,8 +23513,7 @@ virDomainMemoryDefFormat(virBufferPtr buf, =20 virDomainMemoryTargetDefFormat(buf, def); =20 - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -23618,8 +23589,7 @@ virDomainVideoDefFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } =20 - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -23668,8 +23638,7 @@ virDomainInputDefFormat(virBufferPtr buf, virBufferAddLit(&childbuf, "/>\n"); } virBufferEscapeString(&childbuf, "\n", def->sour= ce.evdev); - if (virDomainDeviceInfoFormat(&childbuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childbuf, &def->info, flags); =20 if (virBufferCheckError(&childbuf) < 0) return -1; @@ -24229,10 +24198,9 @@ virDomainHostdevDefFormat(virBufferPtr buf, if (def->shareable) virBufferAddLit(buf, "\n"); =20 - if (virDomainDeviceInfoFormat(buf, def->info, - flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT - | VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM) < 0) - return -1; + virDomainDeviceInfoFormat(buf, def->info, + flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT + | VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -24253,9 +24221,8 @@ virDomainRedirdevDefFormat(virBufferPtr buf, virBufferAdjustIndent(buf, 2); if (virDomainChrSourceDefFormat(buf, def->source, false, flags) < 0) return -1; - if (virDomainDeviceInfoFormat(buf, &def->info, - flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT= ) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, + flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); return 0; @@ -24316,8 +24283,7 @@ virDomainHubDefFormat(virBufferPtr buf, return -1; } =20 - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); =20 if (virBufferCheckError(&childBuf) < 0) return -1; --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list