render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
d76c62
From dfcebf2ac266805c4e144091c04b27155972222f Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <dfcebf2ac266805c4e144091c04b27155972222f@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Fri, 28 Feb 2020 10:24:40 +0100
d76c62
Subject: [PATCH] virStorageFileGetMetadataFromBuf: Remove 'backingFormat'
d76c62
 argument
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
None of the callers actually use it.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
(cherry picked from commit 57df35aeadd2107a3c728fe0939e0779121168c0)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1798148
d76c62
Message-Id: <67e0987c502a062fc17ee1d2701501bfdcd0cc92.1582881363.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/storage/storage_backend_gluster.c |  3 +--
d76c62
 src/util/virstoragefile.c             | 16 ++++++----------
d76c62
 src/util/virstoragefile.h             |  3 +--
d76c62
 3 files changed, 8 insertions(+), 14 deletions(-)
d76c62
d76c62
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
d76c62
index e92e9612bd..db3df82aad 100644
d76c62
--- a/src/storage/storage_backend_gluster.c
d76c62
+++ b/src/storage/storage_backend_gluster.c
d76c62
@@ -275,8 +275,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
d76c62
         goto cleanup;
d76c62
 
d76c62
     if (!(meta = virStorageFileGetMetadataFromBuf(name, header, len,
d76c62
-                                                  VIR_STORAGE_FILE_AUTO,
d76c62
-                                                  NULL)))
d76c62
+                                                  VIR_STORAGE_FILE_AUTO)))
d76c62
         goto cleanup;
d76c62
 
d76c62
     if (meta->backingStoreRaw) {
d76c62
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
d76c62
index d80780e291..1b9bd12284 100644
d76c62
--- a/src/util/virstoragefile.c
d76c62
+++ b/src/util/virstoragefile.c
d76c62
@@ -1109,7 +1109,6 @@ virStorageFileMetadataNew(const char *path,
d76c62
  * @buf: header bytes from @path
d76c62
  * @len: length of @buf
d76c62
  * @format: format of the storage file
d76c62
- * @backingFormat: format of @backing
d76c62
  *
d76c62
  * Extract metadata about the storage volume with the specified image format.
d76c62
  * If image format is VIR_STORAGE_FILE_AUTO, it will probe to automatically
d76c62
@@ -1119,9 +1118,10 @@ virStorageFileMetadataNew(const char *path,
d76c62
  * that might be raw if that file will then be passed to a guest, since a
d76c62
  * malicious guest can turn a raw file into any other non-raw format at will.
d76c62
  *
d76c62
- * If the returned @backingFormat is VIR_STORAGE_FILE_AUTO it indicates the
d76c62
- * image didn't specify an explicit format for its backing store. Callers are
d76c62
- * advised against probing for the backing store format in this case.
d76c62
+ * If the 'backingStoreRawFormat' field of the returned structure is
d76c62
+ * VIR_STORAGE_FILE_AUTO it indicates the image didn't specify an explicit
d76c62
+ * format for its backing store. Callers are advised against probing for the
d76c62
+ * backing store format in this case.
d76c62
  *
d76c62
  * Caller MUST free the result after use via virObjectUnref.
d76c62
  */
d76c62
@@ -1129,8 +1129,7 @@ virStorageSourcePtr
d76c62
 virStorageFileGetMetadataFromBuf(const char *path,
d76c62
                                  char *buf,
d76c62
                                  size_t len,
d76c62
-                                 int format,
d76c62
-                                 int *backingFormat)
d76c62
+                                 int format)
d76c62
 {
d76c62
     virStorageSourcePtr ret = NULL;
d76c62
 
d76c62
@@ -1142,9 +1141,6 @@ virStorageFileGetMetadataFromBuf(const char *path,
d76c62
         return NULL;
d76c62
     }
d76c62
 
d76c62
-    if (backingFormat)
d76c62
-        *backingFormat = ret->backingStoreRawFormat;
d76c62
-
d76c62
     return ret;
d76c62
 }
d76c62
 
d76c62
@@ -3991,7 +3987,7 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr src,
d76c62
     if (format == VIR_STORAGE_FILE_RAW && !src->encryption) {
d76c62
         src->capacity = src->physical;
d76c62
     } else if ((meta = virStorageFileGetMetadataFromBuf(src->path, buf,
d76c62
-                                                        len, format, NULL))) {
d76c62
+                                                        len, format))) {
d76c62
         src->capacity = meta->capacity ? meta->capacity : src->physical;
d76c62
         if (src->encryption && meta->encryption)
d76c62
             src->encryption->payload_offset = meta->encryption->payload_offset;
d76c62
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
d76c62
index ecba418bb3..32f2c82147 100644
d76c62
--- a/src/util/virstoragefile.h
d76c62
+++ b/src/util/virstoragefile.h
d76c62
@@ -386,8 +386,7 @@ virStorageSourcePtr virStorageFileGetMetadataFromFD(const char *path,
d76c62
 virStorageSourcePtr virStorageFileGetMetadataFromBuf(const char *path,
d76c62
                                                      char *buf,
d76c62
                                                      size_t len,
d76c62
-                                                     int format,
d76c62
-                                                     int *backingFormat)
d76c62
+                                                     int format)
d76c62
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
d76c62
 int virStorageFileChainGetBroken(virStorageSourcePtr chain,
d76c62
                                  char **broken_file);
d76c62
-- 
d76c62
2.25.1
d76c62