From nobody Fri Nov 14 06:40:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585233234; cv=none; d=zohomail.com; s=zohoarc; b=Rl4b8ggRJc7kLso8xUDYU9pTEXkuLjXCpQ8FgeFzaPmxMopSX3rMvN+0/rRQcMzXdXwdehQimcljZazenhb9g4JGSiDthY93kt6fKKFofKYqC+ZAhGm7TgK9cBCobuUjf+E4Ts24UjXQbntWI4fFPtMUy1Qp4bxaMQGOed7Kk5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585233234; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eiyTEq4pGvTXw9LT3G3qPdgGYom2OUAmGl4ySF4SH0o=; b=T8D6I9qUSkTvd0cYJ8fM2KclliGZmlZ7uqcrb3VEQ/LduXR/XA++mq7bk85M08v2+MS9k7wIc39ZCzuFHaP0cj2Gx0r3ACFLHZf6Za3lPufQgPDs4U2UDIrOCMZM9XmCiybLoy7StVo5D+nvsfuc0Wstth5y4xFhQPOqpc9e6ZY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15852332343708.438117013697479; Thu, 26 Mar 2020 07:33:54 -0700 (PDT) Received: from localhost ([::1]:53880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHTZw-000094-SH for importer@patchew.org; Thu, 26 Mar 2020 10:33:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41354) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHTWB-0003go-Gh for qemu-devel@nongnu.org; Thu, 26 Mar 2020 10:30:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHTW9-0002rI-Cw for qemu-devel@nongnu.org; Thu, 26 Mar 2020 10:29:59 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:42529) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHTW9-0002r3-7e for qemu-devel@nongnu.org; Thu, 26 Mar 2020 10:29:57 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-72-5NK-qfOjP9yaq4CPcrQi0A-1; Thu, 26 Mar 2020 10:29:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D04B78018A2; Thu, 26 Mar 2020 14:29:53 +0000 (UTC) Received: from localhost (ovpn-112-132.ams2.redhat.com [10.36.112.132]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8854D5E00C; Thu, 26 Mar 2020 14:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585232996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eiyTEq4pGvTXw9LT3G3qPdgGYom2OUAmGl4ySF4SH0o=; b=DxtGofen1kW4nbj/P6CnUlyTYQjPw//7PJ+HuoB2ppCWGb5Qtvy+dD8REKdovhDsDx2XcW NMgH3T3ZjLqTjq2i3MGr6SWtqDxjTmUhZf61/uSvnpZEpU2FghdpxvtrwjHStUs1sg+ku7 HK3bGzKTFm6wFnlNcA7kD7d0YehgTFg= X-MC-Unique: 5NK-qfOjP9yaq4CPcrQi0A-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 05/10] qcow2: List autoclear bit names in header Date: Thu, 26 Mar 2020 15:29:28 +0100 Message-Id: <20200326142933.625037-6-mreitz@redhat.com> In-Reply-To: <20200326142933.625037-1-mreitz@redhat.com> References: <20200326142933.625037-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eric Blake The feature table is supposed to advertise the name of all feature bits that we support; however, we forgot to update the table for autoclear bits. While at it, move the table to read-only memory in code, and tweak the qcow2 spec to name the second autoclear bit. Update iotests that are affected by the longer header length. Fixes: 88ddffae Fixes: 93c24936 Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Message-Id: <20200324174233.1622067-3-eblake@redhat.com> Signed-off-by: Max Reitz --- docs/interop/qcow2.txt | 3 ++- block/qcow2.c | 12 +++++++++++- tests/qemu-iotests/031.out | 8 ++++---- tests/qemu-iotests/036.out | 4 ++-- tests/qemu-iotests/061.out | 14 +++++++------- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt index 5597e24474..640e0eca40 100644 --- a/docs/interop/qcow2.txt +++ b/docs/interop/qcow2.txt @@ -143,7 +143,8 @@ the next fields through header_length. bit is unset, the bitmaps extension data m= ust be considered inconsistent. =20 - Bit 1: If this bit is set, the external data file= can + Bit 1: Raw external data bit + If this bit is set, the external data file= can be read as a consistent standalone raw ima= ge without looking at the qcow2 metadata. =20 diff --git a/block/qcow2.c b/block/qcow2.c index b565cf912e..b74cbeb047 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2825,7 +2825,7 @@ int qcow2_update_header(BlockDriverState *bs) =20 /* Feature table */ if (s->qcow_version >=3D 3) { - Qcow2Feature features[] =3D { + static const Qcow2Feature features[] =3D { { .type =3D QCOW2_FEAT_TYPE_INCOMPATIBLE, .bit =3D QCOW2_INCOMPAT_DIRTY_BITNR, @@ -2846,6 +2846,16 @@ int qcow2_update_header(BlockDriverState *bs) .bit =3D QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR, .name =3D "lazy refcounts", }, + { + .type =3D QCOW2_FEAT_TYPE_AUTOCLEAR, + .bit =3D QCOW2_AUTOCLEAR_BITMAPS_BITNR, + .name =3D "bitmaps", + }, + { + .type =3D QCOW2_FEAT_TYPE_AUTOCLEAR, + .bit =3D QCOW2_AUTOCLEAR_DATA_FILE_RAW_BITNR, + .name =3D "raw external data", + }, }; =20 ret =3D header_ext_add(buf, QCOW2_EXT_MAGIC_FEATURE_TABLE, diff --git a/tests/qemu-iotests/031.out b/tests/qemu-iotests/031.out index d535e407bc..46f97c5a4e 100644 --- a/tests/qemu-iotests/031.out +++ b/tests/qemu-iotests/031.out @@ -117,7 +117,7 @@ header_length 104 =20 Header extension: magic 0x6803f857 -length 192 +length 288 data =20 Header extension: @@ -150,7 +150,7 @@ header_length 104 =20 Header extension: magic 0x6803f857 -length 192 +length 288 data =20 Header extension: @@ -164,7 +164,7 @@ No errors were found on the image. =20 magic 0x514649fb version 3 -backing_file_offset 0x178 +backing_file_offset 0x1d8 backing_file_size 0x17 cluster_bits 16 size 67108864 @@ -188,7 +188,7 @@ data 'host_device' =20 Header extension: magic 0x6803f857 -length 192 +length 288 data =20 Header extension: diff --git a/tests/qemu-iotests/036.out b/tests/qemu-iotests/036.out index 0b52b934e1..23b699ce06 100644 --- a/tests/qemu-iotests/036.out +++ b/tests/qemu-iotests/036.out @@ -26,7 +26,7 @@ compatible_features [] autoclear_features [63] Header extension: magic 0x6803f857 -length 192 +length 288 data =20 =20 @@ -38,7 +38,7 @@ compatible_features [] autoclear_features [] Header extension: magic 0x6803f857 -length 192 +length 288 data =20 *** done diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out index 8b3091a412..413cc4e0f4 100644 --- a/tests/qemu-iotests/061.out +++ b/tests/qemu-iotests/061.out @@ -26,7 +26,7 @@ header_length 104 =20 Header extension: magic 0x6803f857 -length 192 +length 288 data =20 magic 0x514649fb @@ -84,7 +84,7 @@ header_length 104 =20 Header extension: magic 0x6803f857 -length 192 +length 288 data =20 magic 0x514649fb @@ -140,7 +140,7 @@ header_length 104 =20 Header extension: magic 0x6803f857 -length 192 +length 288 data =20 ERROR cluster 5 refcount=3D0 reference=3D1 @@ -195,7 +195,7 @@ header_length 104 =20 Header extension: magic 0x6803f857 -length 192 +length 288 data =20 magic 0x514649fb @@ -264,7 +264,7 @@ header_length 104 =20 Header extension: magic 0x6803f857 -length 192 +length 288 data =20 read 65536/65536 bytes at offset 44040192 @@ -298,7 +298,7 @@ header_length 104 =20 Header extension: magic 0x6803f857 -length 192 +length 288 data =20 ERROR cluster 5 refcount=3D0 reference=3D1 @@ -327,7 +327,7 @@ header_length 104 =20 Header extension: magic 0x6803f857 -length 192 +length 288 data =20 read 131072/131072 bytes at offset 0 --=20 2.25.1