From nobody Sun Feb 8 19:49:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1579801603; cv=none; d=zohomail.com; s=zohoarc; b=XJWq7NcLlrjWzDe1L1TOsx+DMXO0lIJ9WqW646GdYg76brJE0Y0I1Fio7EP0kjyRVE3qpXMQoQBZDetSZVBUjE5lNrdJczhSC88cLnXIxDSLO9JHEeNQu5Yb46DRWHPLd7ogoMI4JECihEge3QsARSphaKG2YFlAlsOojjQEVLU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579801603; 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=AjovZydJx+MxDrObSThqXD6CRaNTq3uH6EWtsJQ26V4=; b=CVaymdkQak92Fj7yuDrpFKiAOwX8YuLWiO6BLk1vuGkh+PSjzFSwCjJf3xD03DQzFaA6D3oQT5iAj1cc9zQhvtV03J6MgVs7Y0Ln3uCtEgibUjV3WqvgBW4TrDBvOXZQjg0uNkuaLvdZBTPV9DxhSe6BLK73TJrbq3Q6QPxXaZA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1579801603312112.41315651836476; Thu, 23 Jan 2020 09:46:43 -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-245-CmEwPC_AO_uN0nWfodkFzw-1; Thu, 23 Jan 2020 12:46:29 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BC841800D78; Thu, 23 Jan 2020 17:46:21 +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 815F73B0; Thu, 23 Jan 2020 17:46:20 +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 4E4A48594E; Thu, 23 Jan 2020 17:46: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 00NHkHi6020876 for ; Thu, 23 Jan 2020 12:46:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1FEC05D9E2; Thu, 23 Jan 2020 17:46:17 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E34E5DA87 for ; Thu, 23 Jan 2020 17:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579801602; 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=AjovZydJx+MxDrObSThqXD6CRaNTq3uH6EWtsJQ26V4=; b=io1NmUGQMaaAVG/C6tkjF1dzGwipTczM1OWRYRAOebg+A4w8cXOkiJ1h7YvqZGenAllUlt OlzbnQfSuJDObTRyH00khmFUuOnv2etNstq3gIFluQKXP8r+AMN+Jy2wSooa3RAI8B87tn k07lx94sles1O1h03e2yxAoFVUe1LUo= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 01/10] conf: use virXMLFormatElement in virDomainFSDefFormat Date: Thu, 23 Jan 2020 18:46:02 +0100 Message-Id: <13043555377a88e4199cd7fc046a825e3e2346b8.1579801508.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.84 on 10.5.11.23 X-MC-Unique: CmEwPC_AO_uN0nWfodkFzw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use the virXMLFormatElement helper to format the driver element to simplify adding further sub-elements. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 707d58e1a4..6deb8e5434 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -24996,7 +24996,7 @@ virDomainFSDefFormat(virBufferPtr buf, const char *fsdriver =3D virDomainFSDriverTypeToString(def->fsdriver); const char *wrpolicy =3D virDomainFSWrpolicyTypeToString(def->wrpolicy= ); const char *src =3D def->src->path; - g_auto(virBuffer) driverBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) driverAttrBuf =3D VIR_BUFFER_INITIALIZER; =20 if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -25021,25 +25021,21 @@ virDomainFSDefFormat(virBufferPtr buf, =20 virBufferAdjustIndent(buf, 2); if (def->fsdriver) { - virBufferAsprintf(&driverBuf, " type=3D'%s'", fsdriver); + virBufferAsprintf(&driverAttrBuf, " type=3D'%s'", fsdriver); =20 if (def->format) - virBufferAsprintf(&driverBuf, " format=3D'%s'", + virBufferAsprintf(&driverAttrBuf, " format=3D'%s'", virStorageFileFormatTypeToString(def->format= )); =20 /* Don't generate anything if wrpolicy is set to default */ if (def->wrpolicy) - virBufferAsprintf(&driverBuf, " wrpolicy=3D'%s'", wrpolicy); + virBufferAsprintf(&driverAttrBuf, " wrpolicy=3D'%s'", wrpolicy= ); =20 } =20 - virDomainVirtioOptionsFormat(&driverBuf, def->virtio); + virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio); =20 - if (virBufferUse(&driverBuf)) { - virBufferAddLit(buf, "\n"); - } + virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL); =20 switch (def->type) { case VIR_DOMAIN_FS_TYPE_MOUNT: --=20 2.21.0