On 12/03/2015 09:35 AM, 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@xxxxxxxxxxxx> > Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> > --- > src/libvirt_private.syms | 1 + > src/util/virstoragefile.c | 10 ++++++++++ > src/util/virstoragefile.h | 4 ++++ > 3 files changed, 15 insertions(+) > > diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms > index 5354a4a..d3baee8 100644 > --- a/src/libvirt_private.syms > +++ b/src/libvirt_private.syms > @@ -2200,6 +2200,7 @@ virStorageSourceParseRBDColonString; > virStorageSourcePoolDefFree; > virStorageSourcePoolModeTypeFromString; > virStorageSourcePoolModeTypeToString; > +virStorageSourceSetBackingStore; > virStorageSourceUpdateBlockPhysicalSize; > virStorageTypeFromString; > virStorageTypeToString; > diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c > index af17d82..a8a2134 100644 > --- a/src/util/virstoragefile.c > +++ b/src/util/virstoragefile.c > @@ -1819,6 +1819,16 @@ virStorageSourceGetBackingStore(const virStorageSource *src, > } > > > +int > +virStorageSourceSetBackingStore(virStorageSourcePtr src, > + virStorageSourcePtr backingStore, > + size_t pos ATTRIBUTE_UNUSED) > +{ As Peter points out in v6 - there's no range checking here. John > + src->backingStore = backingStore; > + return 0; > +} > + > + > /** > * virStorageSourcePtr: > * > diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h > index 8cd4854..ce1cb5d 100644 > --- a/src/util/virstoragefile.h > +++ b/src/util/virstoragefile.h > @@ -289,6 +289,10 @@ struct _virStorageSource { > # define DEV_BSIZE 512 > # endif > > +int virStorageSourceSetBackingStore(virStorageSourcePtr src, > + virStorageSourcePtr backingStore, > + size_t pos); > + > virStorageSourcePtr virStorageSourceGetBackingStore(const virStorageSource *src, > size_t pos); > > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list