[libvirt] [PATCHv2 11/33] storage: Move virStorageFileGetMetadata to the storage driver

Peter Krempa pkrempa at redhat.com
Wed May 28 08:25:41 UTC 2014


On 05/28/14 03:53, Eric Blake wrote:
> On 05/26/2014 03:27 AM, Peter Krempa wrote:
>> On 05/23/14 18:38, Eric Blake wrote:
>>> On 05/22/2014 07:47 AM, Peter Krempa wrote:
>>>> My future work will modify the metadata crawler function to use the
>>>> storage driver file APIs to access the files instead of accessing them
>>>> directly so that we will be able to request the metadata for remote
>>>> files too. To avoid linking the storage driver to every helper file
>>>> using the utils code, the backing chain traversal function needs to be
>>>> moved to the storage driver source.
>>>>
> 
>>>>  src/storage/storage_driver.c  | 233 ++++++++++++++++++++++++++++++++++++++++++
>>>>  src/storage/storage_driver.h  |   5 +
>>>>  src/util/virstoragefile.c     | 233 +-----------------------------------------
> 
>>>>  virStorageFileGetMetadataFromFDInternal(virStorageSourcePtr meta,
>>>>                                          int fd,
>>>>                                          int *backingFormat)
>>>
>>> It's a bit confusing that we now have virStorageFile* functions spread
>>> across two different files; maybe a later patch should rename the
>>> storage_driver.h functions to have a different prefix?
>>>
>>
>> We definitely can address this later. Any suggestions on the name of the
>> moved code?
> 
> virStorageDriverFoo?  It's slightly longer, so might cause long lines,
> but seems reasonable for the file name.
> 

And what about the functions to access storage files via the storage
driver? they are called virStorageFileFoo but reside in the storage
driver too. Should I change those too?

Peter


src/storage/storage_driver.h:

int virStorageFileInit(virStorageSourcePtr src);
int virStorageFileInitAs(virStorageSourcePtr src,
                         uid_t uid, gid_t gid);
void virStorageFileDeinit(virStorageSourcePtr src);

int virStorageFileCreate(virStorageSourcePtr src);
int virStorageFileUnlink(virStorageSourcePtr src);
int virStorageFileStat(virStorageSourcePtr src,
                       struct stat *stat);
ssize_t virStorageFileReadHeader(virStorageSourcePtr src,
                                 ssize_t max_len,
                                 char **buf);
const char *virStorageFileGetUniqueIdentifier(virStorageSourcePtr src);
int virStorageFileAccess(virStorageSourcePtr src, int mode);

int virStorageFileGetMetadata(virStorageSourcePtr src,
                              uid_t uid, gid_t gid,
                              bool allow_probe)
    ATTRIBUTE_NONNULL(1);



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140528/5f03e420/attachment-0001.sig>


More information about the libvir-list mailing list