From 5a1cf6bd16954a4d8ecc30f134f1bb7d23bc69c9 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 28 May 2014 14:41:24 +0200 Subject: [PATCH] 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. --- 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 dbd1369577..a76309990d 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 b90cdc9fb5..4329395984 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 082ff5b7e5..158806b581 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,