[PATCH 2/3] util: storage: Add helpers to parse and format relPath into privateData

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

 



This will be the first private piece of data that will need to be stored
in the XML for some drivers. Add helpers which will do it.
---
 src/libvirt_private.syms  |  2 ++
 src/util/virstoragefile.c | 20 ++++++++++++++++++++
 src/util/virstoragefile.h |  8 ++++++++
 3 files changed, 30 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b4b72c0734..d5c3b9abb5 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2734,6 +2734,8 @@ virStorageSourceParseRBDColonString;
 virStorageSourcePoolDefFree;
 virStorageSourcePoolModeTypeFromString;
 virStorageSourcePoolModeTypeToString;
+virStorageSourcePrivateDataFormatRelPath;
+virStorageSourcePrivateDataParseRelPath;
 virStorageSourceUpdateBackingSizes;
 virStorageSourceUpdateCapacity;
 virStorageSourceUpdatePhysicalSize;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 6594715e5e..5780180a94 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -4086,3 +4086,23 @@ virStorageSourceNetworkAssignDefaultPorts(virStorageSourcePtr src)
             src->hosts[i].port = virStorageSourceNetworkDefaultPort(src->protocol);
     }
 }
+
+
+int
+virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
+                                        virStorageSourcePtr src)
+{
+    src->relPath = virXPathString("string(./relPath)", ctxt);
+    return 0;
+}
+
+
+int
+virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src,
+                                         virBufferPtr buf)
+{
+    if (src->relPath)
+        virBufferEscapeString(buf, "<relPath>%s</relPath>\n", src->relPath);
+
+    return 0;
+}
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 24382a0a6b..ecd806c93f 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -441,4 +441,12 @@ bool
 virStorageSourceHasBacking(const virStorageSource *src);


+int
+virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
+                                        virStorageSourcePtr src);
+int
+virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src,
+                                         virBufferPtr buf);
+
+
 #endif /* __VIR_STORAGE_FILE_H__ */
-- 
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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