[PATCH v8 1/5] virstoragefile: Add helper to get storage source backingStore

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

 



From: Matthias Gatto <matthias.gatto@xxxxxxxxxxxx>

Add a new helper - virStorageSourceGetBackingStore - to fetch the storage
source backingStore pointer in order to make it easier to change the
future format of the data.

A future patch will adjust the backingStore pointer to become a table or
array of backingStorePtr's accessible by the argument 'pos'.

For now, if 'pos' > 0, the code will return NULL as if the backingStore
pointer didn't exist. All callers in subsequent patches will start by
passing a 0 as the parameter.

Signed-off-by: Matthias Gatto <matthias.gatto@xxxxxxxxxxxx>
Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/libvirt_private.syms  |  1 +
 src/util/virstoragefile.c | 23 +++++++++++++++++++++++
 src/util/virstoragefile.h |  3 +++
 3 files changed, 27 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 55822ae..1c55370 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2196,6 +2196,7 @@ virStorageSourceClear;
 virStorageSourceCopy;
 virStorageSourceFree;
 virStorageSourceGetActualType;
+virStorageSourceGetBackingStore;
 virStorageSourceGetSecurityLabelDef;
 virStorageSourceInitChainElement;
 virStorageSourceIsEmpty;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 2aa1d90..2771c95 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1810,6 +1810,29 @@ virStorageSourcePoolDefCopy(const virStorageSourcePoolDef *src)
 
 
 /**
+ * virStorageSourceGetBackingStore:
+ * @src: virStorageSourcePtr containing the backing stores
+ * @pos: presently unused
+ *
+ * Return the @src backingStore pointer at @pos. For now, @pos is
+ * expected to be 0. A future patch will use @pos index into an array
+ * of storage backingStore pointers
+ *
+ * Returns:
+ * A pointer to the storage source backingStore @pos or
+ * NULL if the backingStore pointer cannot be found
+ */
+virStorageSourcePtr
+virStorageSourceGetBackingStore(const virStorageSource *src,
+                                size_t pos)
+{
+    if (!src || pos > 0)
+        return NULL;
+    return src->backingStore;
+}
+
+
+/**
  * virStorageSourcePtr:
  *
  * Deep-copies a virStorageSource structure. If @backing chain is true
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index b98fe25..8cd4854 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -289,6 +289,9 @@ struct _virStorageSource {
 #  define DEV_BSIZE 512
 # endif
 
+virStorageSourcePtr virStorageSourceGetBackingStore(const virStorageSource *src,
+                                                    size_t pos);
+
 int virStorageFileProbeFormat(const char *path, uid_t uid, gid_t gid);
 int virStorageFileProbeFormatFromBuf(const char *path,
                                      char *buf,
-- 
2.5.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]