render / rpms / libvirt

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