virStorageFileGetMetadataFromBuf: Remove 'backingFormat' argument

None of the callers actually use it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-02-21 12:41:11 +01:00
parent fee56942e2
commit 57df35aead
3 changed files with 8 additions and 14 deletions

View File

@ -275,8 +275,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
goto cleanup; goto cleanup;
if (!(meta = virStorageFileGetMetadataFromBuf(name, header, len, if (!(meta = virStorageFileGetMetadataFromBuf(name, header, len,
VIR_STORAGE_FILE_AUTO, VIR_STORAGE_FILE_AUTO)))
NULL)))
goto cleanup; goto cleanup;
if (meta->backingStoreRaw) { if (meta->backingStoreRaw) {

View File

@ -1109,7 +1109,6 @@ virStorageFileMetadataNew(const char *path,
* @buf: header bytes from @path * @buf: header bytes from @path
* @len: length of @buf * @len: length of @buf
* @format: format of the storage file * @format: format of the storage file
* @backingFormat: format of @backing
* *
* Extract metadata about the storage volume with the specified image format. * Extract metadata about the storage volume with the specified image format.
* If image format is VIR_STORAGE_FILE_AUTO, it will probe to automatically * 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 * 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. * 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 * If the 'backingStoreRawFormat' field of the returned structure is
* image didn't specify an explicit format for its backing store. Callers are * VIR_STORAGE_FILE_AUTO it indicates the image didn't specify an explicit
* advised against probing for the backing store format in this case. * 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. * Caller MUST free the result after use via virObjectUnref.
*/ */
@ -1129,8 +1129,7 @@ virStorageSourcePtr
virStorageFileGetMetadataFromBuf(const char *path, virStorageFileGetMetadataFromBuf(const char *path,
char *buf, char *buf,
size_t len, size_t len,
int format, int format)
int *backingFormat)
{ {
virStorageSourcePtr ret = NULL; virStorageSourcePtr ret = NULL;
@ -1142,9 +1141,6 @@ virStorageFileGetMetadataFromBuf(const char *path,
return NULL; return NULL;
} }
if (backingFormat)
*backingFormat = ret->backingStoreRawFormat;
return ret; return ret;
} }
@ -3991,7 +3987,7 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr src,
if (format == VIR_STORAGE_FILE_RAW && !src->encryption) { if (format == VIR_STORAGE_FILE_RAW && !src->encryption) {
src->capacity = src->physical; src->capacity = src->physical;
} else if ((meta = virStorageFileGetMetadataFromBuf(src->path, buf, } else if ((meta = virStorageFileGetMetadataFromBuf(src->path, buf,
len, format, NULL))) { len, format))) {
src->capacity = meta->capacity ? meta->capacity : src->physical; src->capacity = meta->capacity ? meta->capacity : src->physical;
if (src->encryption && meta->encryption) if (src->encryption && meta->encryption)
src->encryption->payload_offset = meta->encryption->payload_offset; src->encryption->payload_offset = meta->encryption->payload_offset;

View File

@ -386,8 +386,7 @@ virStorageSourcePtr virStorageFileGetMetadataFromFD(const char *path,
virStorageSourcePtr virStorageFileGetMetadataFromBuf(const char *path, virStorageSourcePtr virStorageFileGetMetadataFromBuf(const char *path,
char *buf, char *buf,
size_t len, size_t len,
int format, int format)
int *backingFormat)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int virStorageFileChainGetBroken(virStorageSourcePtr chain, int virStorageFileChainGetBroken(virStorageSourcePtr chain,
char **broken_file); char **broken_file);