Re: [PATCH 3/4] virStorageVolDefFormat: Extract formatting of source extents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/25/21 2:26 PM, Peter Krempa wrote:
Move the extent formatting code into
virStorageVolDefFormatSourceExtents.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
  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 = NULL;

Insert an empty line here, please.

+    for (i = 0; i < def->source.nextent; i++) {
+        if (thispath == NULL ||
+            STRNEQ(thispath, def->source.extents[i].path)) {
+            if (thispath != NULL)
+                virBufferAddLit(buf, "</device>\n");
+
+            virBufferEscapeString(buf, "<device path='%s'>\n",
+                                  def->source.extents[i].path);
+        }
+
+        virBufferAdjustIndent(buf, 2);
+        virBufferAsprintf(buf, "<extent start='%llu' end='%llu'/>\n",
+                          def->source.extents[i].start,
+                          def->source.extents[i].end);
+        virBufferAdjustIndent(buf, -2);
+        thispath = def->source.extents[i].path;
+    }
+    if (thispath != NULL)
+        virBufferAddLit(buf, "</device>\n");
+}
+

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux