Re: [libvirt] [PATCH v6 01/13] virstoragefile: Add virStorageSourceGetBackingStore

2015-11-01 Thread Peter Krempa
On Thu, Oct 29, 2015 at 14:43:08 +0100, Matthias Gatto wrote:
> Create virStorageSourceGetBackingStore function in
> preparation for quorum:
> Actually, if we want to get a backing store inside a virStorageSource
> we have to do it manually(src->backingStore = backingStore).
> The problem is that with a quorum, a virStorageSource
> can contain multiple backing stores, and src->backingStore can
> be treated as a virStorageSourcePtr or a virStorageSourcePtrPtr.
> 
> Due to these reason, we need to simplify the manipulation of
> virStorageSource, and create a function to get the asked
> backingStore in a virStorageSource
> 
> For now, this function only return the backingStore field
> 
> Signed-off-by: Matthias Gatto 
> ---
>  src/libvirt_private.syms  | 1 +
>  src/util/virstoragefile.c | 8 
>  src/util/virstoragefile.h | 3 +++
>  3 files changed, 12 insertions(+)
> 

...

> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
> index 2aa1d90..3fad323 100644
> --- a/src/util/virstoragefile.c
> +++ b/src/util/virstoragefile.c
> @@ -1809,6 +1809,14 @@ virStorageSourcePoolDefCopy(const 
> virStorageSourcePoolDef *src)
>  }
>  
>  
> +virStorageSourcePtr
> +virStorageSourceGetBackingStore(const virStorageSource *src,
> +size_t pos ATTRIBUTE_UNUSED)
> +{

This should return NULL in cases when 'pos' is out of range.

> +return src->backingStore;
> +}

Peter


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v6 01/13] virstoragefile: Add virStorageSourceGetBackingStore

2015-10-29 Thread Matthias Gatto
Create virStorageSourceGetBackingStore function in
preparation for quorum:
Actually, if we want to get a backing store inside a virStorageSource
we have to do it manually(src->backingStore = backingStore).
The problem is that with a quorum, a virStorageSource
can contain multiple backing stores, and src->backingStore can
be treated as a virStorageSourcePtr or a virStorageSourcePtrPtr.

Due to these reason, we need to simplify the manipulation of
virStorageSource, and create a function to get the asked
backingStore in a virStorageSource

For now, this function only return the backingStore field

Signed-off-by: Matthias Gatto 
---
 src/libvirt_private.syms  | 1 +
 src/util/virstoragefile.c | 8 
 src/util/virstoragefile.h | 3 +++
 3 files changed, 12 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4b7e165..8854b26 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2163,6 +2163,7 @@ virStorageSourceClear;
 virStorageSourceCopy;
 virStorageSourceFree;
 virStorageSourceGetActualType;
+virStorageSourceGetBackingStore;
 virStorageSourceGetSecurityLabelDef;
 virStorageSourceInitChainElement;
 virStorageSourceIsEmpty;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 2aa1d90..3fad323 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1809,6 +1809,14 @@ virStorageSourcePoolDefCopy(const 
virStorageSourcePoolDef *src)
 }
 
 
+virStorageSourcePtr
+virStorageSourceGetBackingStore(const virStorageSource *src,
+size_t pos ATTRIBUTE_UNUSED)
+{
+return src->backingStore;
+}
+
+
 /**
  * virStorageSourcePtr:
  *
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.6.1

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