From nobody Mon Feb 9 17:08:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1614259678; cv=none; d=zohomail.com; s=zohoarc; b=BbYrO+Evyp1neGvibwTx8EI6eEV7v36iOXqUvHaFe5ECxGrgvuIMba/0e3DMycThxQ5ff7eAY23fA8fVN+r1tzip6hahs5OorwG878obaRv6OvE3p1y4PoV8IoVtgeOgRDZfn/FJ1dqlwNuSoERM6qaXZxJugOg5ae8XmwtpF/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614259678; 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=KsxHJbCv6a6gTHJ7xOOEa/JblUhk/HgOgygNIRiDm9I=; b=bEY5hmbkBkHW7hTiNeeCwdfjfACX1JS+7fScmkMPAWj74tucd1v6KfYmAWrqzb7dIGztbfCuKYrU6s0y6V7GE5ytJ1zT5cWaEPD7LAfTjbw5osRR3HDpA91A661941ZXMN4mvbLM8F5HzDN0D4MbC4pIFWwMR4tWer2eCJdYqag= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614259678335638.5525006937862; Thu, 25 Feb 2021 05:27:58 -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-482-IF70Ase4M1qS5NuYOGWBmw-1; Thu, 25 Feb 2021 08:27:54 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8AA22107ACE6; Thu, 25 Feb 2021 13:27:47 +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 5AFAE60CEB; Thu, 25 Feb 2021 13:27:47 +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 226A858078; Thu, 25 Feb 2021 13:27:47 +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 11PDQPS0012187 for ; Thu, 25 Feb 2021 08:26:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 693E55D9DC; Thu, 25 Feb 2021 13:26:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD9D25D9D7 for ; Thu, 25 Feb 2021 13:26:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614259677; 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=KsxHJbCv6a6gTHJ7xOOEa/JblUhk/HgOgygNIRiDm9I=; b=H2XqUTrhhhrVUoyKbV4nfWp4q34Ef2brBEAHdV3sT2PY9x0i6ObQR3BbXDyr8Nt9FwnjMC Z/hehcO/zbh16GqO8wpk6rDSyjV27D88XaxqQqpugIhMeV6wxNN+LW5wfvNU1VA7dTUeLr fIfJnk/0qQuo3kcllN9oR7kXOYCvSmo= X-MC-Unique: IF70Ase4M1qS5NuYOGWBmw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/4] virStorageVolDefFormat: Extract formatting of source extents Date: Thu, 25 Feb 2021 14:26:16 +0100 Message-Id: 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.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" Move the extent formatting code into virStorageVolDefFormatSourceExtents. Signed-off-by: Peter Krempa --- src/conf/storage_conf.c | 53 +++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 0f515c7cbb..1bc27ff194 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1643,6 +1643,34 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr= options, } +static void +virStorageVolDefFormatSourceExtents(virBufferPtr buf, + virStorageVolDefPtr def) +{ + size_t i; + const char *thispath =3D NULL; + for (i =3D 0; i < def->source.nextent; i++) { + if (thispath =3D=3D NULL || + STRNEQ(thispath, def->source.extents[i].path)) { + if (thispath !=3D NULL) + virBufferAddLit(buf, "\n"); + + virBufferEscapeString(buf, "\n", + def->source.extents[i].path); + } + + virBufferAdjustIndent(buf, 2); + virBufferAsprintf(buf, "\n", + def->source.extents[i].start, + def->source.extents[i].end); + virBufferAdjustIndent(buf, -2); + thispath =3D def->source.extents[i].path; + } + if (thispath !=3D NULL) + virBufferAddLit(buf, "\n"); +} + + char * virStorageVolDefFormat(virStoragePoolDefPtr pool, virStorageVolDefPtr def) @@ -1663,29 +1691,8 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2); - if (def->source.nextent) { - size_t i; - const char *thispath =3D NULL; - for (i =3D 0; i < def->source.nextent; i++) { - if (thispath =3D=3D NULL || - STRNEQ(thispath, def->source.extents[i].path)) { - if (thispath !=3D NULL) - virBufferAddLit(&buf, "\n"); - - virBufferEscapeString(&buf, "\n", - def->source.extents[i].path); - } - - virBufferAdjustIndent(&buf, 2); - virBufferAsprintf(&buf, "= \n", - def->source.extents[i].start, - def->source.extents[i].end); - virBufferAdjustIndent(&buf, -2); - thispath =3D def->source.extents[i].path; - } - if (thispath !=3D NULL) - virBufferAddLit(&buf, "\n"); - } + if (def->source.nextent) + virStorageVolDefFormatSourceExtents(&buf, def); virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); --=20 2.29.2