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