Re: [PATCH v7 01/13] virstoragefile: Add virStorageSourceGetBackingStore

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

 



On Mon, Dec 14, 2015 at 10:57 PM, John Ferlan <jferlan@xxxxxxxxxx> wrote:
>
>
> On 12/03/2015 09:35 AM, 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
>
> More simply said -
>
> Create helper virStorageSourceGetBackingStore in order to make it easier
> to access the storage backingStore pointer. Future patches will adjust
> the backingStore pointer to become a table or list of backingStorePtr's
>
>
> [Sure you're doing it because of the quorum changes, but it's
> essentially creating an accessor function]
>>
>> Signed-off-by: Matthias Gatto <matthias.gatto@xxxxxxxxxxxx>
>> ---
>>  src/libvirt_private.syms  |  1 +
>>  src/util/virstoragefile.c | 10 ++++++++++
>>  src/util/virstoragefile.h |  3 +++
>>  3 files changed, 14 insertions(+)
>>
>> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
>> index dd085c3..5354a4a 100644
>> --- a/src/libvirt_private.syms
>> +++ b/src/libvirt_private.syms
>> @@ -2190,6 +2190,7 @@ virStorageSourceClear;
>>  virStorageSourceCopy;
>>  virStorageSourceFree;
>>  virStorageSourceGetActualType;
>> +virStorageSourceGetBackingStore;
>>  virStorageSourceGetSecurityLabelDef;
>>  virStorageSourceInitChainElement;
>>  virStorageSourceIsEmpty;
>> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
>> index 2aa1d90..016beaa 100644
>> --- a/src/util/virstoragefile.c
>> +++ b/src/util/virstoragefile.c
>> @@ -1809,6 +1809,16 @@ virStorageSourcePoolDefCopy(const virStorageSourcePoolDef *src)
>>  }
>>
>>
>> +virStorageSourcePtr
>> +virStorageSourceGetBackingStore(const virStorageSource *src,
>> +                                size_t pos ATTRIBUTE_UNUSED)
>> +{
>> +    if (!src)
>
> I think perhaps Peter's point from his review is
>
>     if (!src || pos > 0)
>
> IOW: range checking for pos
>
> Eventually patch 5 will make a real check...
>
> In order to make some progress on this series - at least the first 5 or
> 6 patches - I can make the change if that is what Peter had in mind...
>
> John
>> +        return NULL;
>> +    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,
>>

Thank you for the review, and your changes on v8.
Sorry for the check, I was thinking it unnecessary because we do it on patch 5.

--
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]