From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, den@virtuozzo.com,
armbru@redhat.com, qemu-devel@nongnu.org,
dplotnikov@virtuozzo.com, mreitz@redhat.com
Subject: [PATCH v7 1/2] docs: improve qcow2 spec about extending image header
Date: Mon, 7 Oct 2019 19:04:50 +0300 [thread overview]
Message-ID: <20191007160451.27334-2-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20191007160451.27334-1-vsementsov@virtuozzo.com>
Make it more obvious how to add new fields to the version 3 header and
how to interpret them.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
docs/interop/qcow2.txt | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt
index af5711e533..3f2855593f 100644
--- a/docs/interop/qcow2.txt
+++ b/docs/interop/qcow2.txt
@@ -79,9 +79,9 @@ The first cluster of a qcow2 image contains the file header:
Offset into the image file at which the snapshot table
starts. Must be aligned to a cluster boundary.
-If the version is 3 or higher, the header has the following additional fields.
-For version 2, the values are assumed to be zero, unless specified otherwise
-in the description of a field.
+For version 2, header is always 72 bytes length and finishes here.
+For version 3 or higher the header length is at least 104 bytes and has at
+least next five fields, up to the @header_length field.
72 - 79: incompatible_features
Bitmask of incompatible features. An implementation must
@@ -165,6 +165,26 @@ in the description of a field.
Length of the header structure in bytes. For version 2
images, the length is always assumed to be 72 bytes.
+Additional fields (version 3 and higher)
+
+The following fields of the header are optional: if software don't know how to
+interpret the field, it may safely ignore it. Still the field must be kept as is
+when rewriting the image. @header_length must be bound to the end of one of
+these fields (or to @header_length field end itself, to be 104 bytes).
+This definition implies the following:
+1. Software may support some of these optional fields and ignore the others,
+ which means that features may be backported to downstream Qemu independently.
+2. Software may check @header_length, if it knows optional fields specification
+ enough (knows about the field which exceeds @header_length).
+3. If @header_length is higher than the highest field end that software knows,
+ it should assume that additional fields are correct, @header_length is
+ correct and keep @header_length and additional unknown fields as is on
+ rewriting the image.
+3. If we want to add incompatible field (or a field, for which some its values
+ would be incompatible), it must be accompanied by incompatible feature bit.
+
+ < ... No additional fields in the header currently ... >
+
Directly after the image header, optional sections called header extensions can
be stored. Each extension has a structure like the following:
--
2.21.0
next prev parent reply other threads:[~2019-10-07 16:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-07 16:04 [PATCH v7 0/2] qcow2: add zstd cluster compression Vladimir Sementsov-Ogievskiy
2019-10-07 16:04 ` Vladimir Sementsov-Ogievskiy [this message]
2019-10-07 20:21 ` [PATCH v7 1/2] docs: improve qcow2 spec about extending image header Eric Blake
2019-10-08 9:05 ` Vladimir Sementsov-Ogievskiy
2019-10-18 8:29 ` Vladimir Sementsov-Ogievskiy
2019-10-18 9:27 ` Vladimir Sementsov-Ogievskiy
2019-10-18 13:39 ` Eric Blake
2019-10-18 13:54 ` Vladimir Sementsov-Ogievskiy
2019-10-07 16:04 ` [PATCH v7 2/2] docs: qcow2: introduce compression type feature Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191007160451.27334-2-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=den@virtuozzo.com \
--cc=dplotnikov@virtuozzo.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).