Add argument to return backing file format of a file probed by
virStorageFileGetMetadataFromFD so that it can be used in place of
virStorageFileGetMetadataFromBuf.
---
src/qemu/qemu_driver.c | 2 +-
src/util/virstoragefile.c | 6 ++++--
src/util/virstoragefile.h | 3 ++-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2b852eb..2680399 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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 */
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index b90cdc9..4329395 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -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;
}
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 082ff5b..158806b 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -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,
--
1.9.3