libvirt/SOURCES/libvirt-virStorageFileGetMe...

112 lines
4.9 KiB
Diff

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