From nobody Thu Apr 25 21:37:36 2024 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=1585071856; cv=none; d=zohomail.com; s=zohoarc; b=O1MgFSmCLd5bkH0dIw07HBaLlN+M0OztTYBGcxW/a4MLztMH2Ewe+HAY+QNKd3lG0VY/9t9d9zsSLeZovV1U/5ZaajHWLYGu0ton6xOsmCQEPXc1x8u/lsH6tyz2qwLAG3UIaZi5cEGifvSzs1466jA7ePYoQo61deL0Ue5N4us= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585071856; 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=U6wtncJP3zO6sGz8kGxr5WteIftJyjdZ7Vd49Bzf7j0=; b=YKwQT7Zjvj30uwoktp1JMpZgtKRymhHy1Tk6L0z7SFZRGe20ZEqpBl8a3YUpn1rdQZ8yw7A7RhNYlezR+RlyPb+d/itjFSIQqFB7YMk0ArQO2sU7srYXd2WWYKXDhrcDIWyhApL31KCQGNGZ5gh/bYbEpOOkfvUZkiIfFwqUQa8= 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 1585071856082663.849061485016; Tue, 24 Mar 2020 10:44:16 -0700 (PDT) Received: from localhost ([::1]:52906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGnb3-0006E8-3o for importer@patchew.org; Tue, 24 Mar 2020 13:44:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58734) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGnZa-0004cq-T0 for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGnZZ-0007US-Iz for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:42 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:21710) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jGnZZ-0007UF-Du for qemu-devel@nongnu.org; Tue, 24 Mar 2020 13:42:41 -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-16-cYBQkxDENz6vbF9BbQgegA-1; Tue, 24 Mar 2020 13:42:39 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6B7F800D53; Tue, 24 Mar 2020 17:42:37 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-103.phx2.redhat.com [10.3.113.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 529FD1000322; Tue, 24 Mar 2020 17:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585071761; 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=U6wtncJP3zO6sGz8kGxr5WteIftJyjdZ7Vd49Bzf7j0=; b=AcoquW/16y2ELatYbbTU+Y/YuRkpU9oJUyJNb7w/NF4xc3obU8AHh436VuMEFiSHYyhHQ7 3Zk3334auvW/um6tLqlj63MZTXLblMduDf3ZGGFiUKkHb+GRTPH3j7kGryHa/RHaCA8PwH 36K2sbA0Rk/8umZHHSDdWuv1xneDR1I= X-MC-Unique: cYBQkxDENz6vbF9BbQgegA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH v2 2/4] qcow2: List autoclear bit names in header Date: Tue, 24 Mar 2020 12:42:31 -0500 Message-Id: <20200324174233.1622067-3-eblake@redhat.com> In-Reply-To: <20200324174233.1622067-1-eblake@redhat.com> References: <20200324174233.1622067-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: kwolf@redhat.com, Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, mreitz@redhat.com 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" 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 --- [v2] tweak name of "bitmaps" autoclear bit [Vladimir] --- 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 5597e244746e..640e0eca4000 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. - 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. diff --git a/block/qcow2.c b/block/qcow2.c index 5a7f30e692a2..67b0c214fba4 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2825,7 +2825,7 @@ int qcow2_update_header(BlockDriverState *bs) /* 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", + }, }; 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 d535e407bc30..46f97c5a4ea4 100644 --- a/tests/qemu-iotests/031.out +++ b/tests/qemu-iotests/031.out @@ -117,7 +117,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data Header extension: @@ -150,7 +150,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data Header extension: @@ -164,7 +164,7 @@ No errors were found on the image. 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' Header extension: magic 0x6803f857 -length 192 +length 288 data Header extension: diff --git a/tests/qemu-iotests/036.out b/tests/qemu-iotests/036.out index 0b52b934e115..23b699ce0622 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 @@ -38,7 +38,7 @@ compatible_features [] autoclear_features [] Header extension: magic 0x6803f857 -length 192 +length 288 data *** done diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out index 8b3091a412bc..413cc4e0f4ab 100644 --- a/tests/qemu-iotests/061.out +++ b/tests/qemu-iotests/061.out @@ -26,7 +26,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data magic 0x514649fb @@ -84,7 +84,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data magic 0x514649fb @@ -140,7 +140,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data ERROR cluster 5 refcount=3D0 reference=3D1 @@ -195,7 +195,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data magic 0x514649fb @@ -264,7 +264,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data read 65536/65536 bytes at offset 44040192 @@ -298,7 +298,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data ERROR cluster 5 refcount=3D0 reference=3D1 @@ -327,7 +327,7 @@ header_length 104 Header extension: magic 0x6803f857 -length 192 +length 288 data read 131072/131072 bytes at offset 0 --=20 2.26.0.rc2