storage: Return backing format from virStorageFileGetMetadataFromFD

Add argument to return backing file format of a file probed by
virStorageFileGetMetadataFromFD so that it can be used in place of
virStorageFileGetMetadataFromBuf.
This commit is contained in:
Peter Krempa 2014-05-28 14:41:24 +02:00
parent e6bcbcd32c
commit 5a1cf6bd16
3 changed files with 7 additions and 4 deletions

View File

@ -10364,7 +10364,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
}
}
if (!(meta = virStorageFileGetMetadataFromFD(path, fd, format)))
if (!(meta = virStorageFileGetMetadataFromFD(path, fd, format, NULL)))
goto cleanup;
/* Get info for normal formats */

View File

@ -1091,14 +1091,16 @@ virStorageFileGetMetadataFromFDInternal(virStorageSourcePtr meta,
virStorageSourcePtr
virStorageFileGetMetadataFromFD(const char *path,
int fd,
int format)
int format,
int *backingFormat)
{
virStorageSourcePtr ret = NULL;
if (!(ret = virStorageFileMetadataNew(path, format)))
goto cleanup;
if (virStorageFileGetMetadataFromFDInternal(ret, fd, NULL) < 0) {
if (virStorageFileGetMetadataFromFDInternal(ret, fd, backingFormat) < 0) {
virStorageSourceFree(ret);
ret = NULL;
}

View File

@ -271,7 +271,8 @@ int virStorageFileGetMetadata(virStorageSourcePtr src,
ATTRIBUTE_NONNULL(1);
virStorageSourcePtr virStorageFileGetMetadataFromFD(const char *path,
int fd,
int format);
int format,
int *backingFormat);
virStorageSourcePtr virStorageFileGetMetadataFromBuf(const char *path,
char *buf,
size_t len,