[PATCH 1/3] storage: Return backing format from virStorageFileGetMetadataFromFD

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

 



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

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