From: Peter Krempa Date: Wed, 28 May 2025 16:13:39 +0000 (+0200) Subject: storage_file_probe: Move setting of 'compat' attribute to qcow2GetFeatures X-Git-Tag: v11.5.0-rc1~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9008a6ea8d5dbf69cab9f7fdf58c665120b723c;p=thirdparty%2Flibvirt.git storage_file_probe: Move setting of 'compat' attribute to qcow2GetFeatures Since the 'compat' field is set based on qcow2 features it belongs to the qcow2 code rather than to the main metadata probing function. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/storage_file_probe.c index 73751c7a2f..9fcc052ea3 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -579,6 +579,7 @@ qcow2GetFeatures(virStorageSource *meta, int version = virReadBufInt32BE(buf + QCOWX_HDR_VERSION); g_clear_pointer(&meta->features, virBitmapFree); + g_clear_pointer(&meta->compat, g_free); if (version == 2) return 0; @@ -587,6 +588,7 @@ qcow2GetFeatures(virStorageSource *meta, return -1; meta->features = virBitmapNew(VIR_STORAGE_FILE_FEATURE_LAST); + meta->compat = g_strdup("1.1"); qcow2GetFeaturesProcessGroup(virReadBufInt64BE(buf + QCOW2v3_HDR_FEATURES_COMPATIBLE), qcow2CompatibleFeatureArray, @@ -997,10 +999,6 @@ virStorageFileProbeGetMetadata(virStorageSource *meta, buf, len); } - VIR_FREE(meta->compat); - if (meta->format == VIR_STORAGE_FILE_QCOW2 && meta->features) - meta->compat = g_strdup("1.1"); - return 0; }