On Thu, Oct 29, 2015 at 14:43:10 +0100, Matthias Gatto wrote:
As explained for virStorageSourceGetBackingStore, quorum allows
multiple backing store, this make the operation to set bs complex
because we have to check if the backingStore is used as an array
or a pointer, and set it differently in both case.
In order to help the manipulation of backing store, I've added a
function virStorageSourceSetBackingStore.
For now virStorageSourceSetBackingStore don't handle the case where
we have more than one backing store in virStorageSource.
Signed-off-by: Matthias Gatto <matthias.gatto(a)outscale.com>
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/virstoragefile.c | 10 ++++++++++
src/util/virstoragefile.h | 4 ++++
3 files changed, 15 insertions(+)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index cb8e248..731e0c3 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1817,6 +1817,16 @@ virStorageSourceGetBackingStore(const virStorageSource *src,
}
+bool
+virStorageSourceSetBackingStore(virStorageSourcePtr src,
+ virStorageSourcePtr backingStore,
+ size_t pos ATTRIBUTE_UNUSED)
+{
Again, this needs to do bounds checking once you are passing the size
in.
+ src->backingStore = backingStore;
+ return !!src->backingStore;
This return value is rather unhelpful. If this function is going to
reallocate the array, please use the -1/0 return values as usual.
Otherwise this function might as well be declared as void, since the
caller knows whether 'backingStore' was passed in or not.
Peter