qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: stefanha@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH 01/16] Specification for qcow2 version 3
Date: Tue, 27 Mar 2012 10:25:14 -0600	[thread overview]
Message-ID: <4F71E9EA.1070306@redhat.com> (raw)
In-Reply-To: <1332860615-3047-2-git-send-email-kwolf@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 4231 bytes --]

On 03/27/2012 09:03 AM, Kevin Wolf wrote:
> This is the second draft for what I think could be added when we increase qcow2's
> version number to 3. This includes points that have been made by several people
> over the past few months. We're probably not going to implement this next week,
> but I think it's important to get discussions started early, so here it is.
> 

> +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.
> +
> +         72 -  79:  incompatible_features
> +                    Bitmask of incompatible features. An implementation must
> +                    fail to open an image if an unknown bit is set.
> +
> +                    Bit 0:      The reference counts in the image file may be
> +                                inaccurate. Implementations must check/rebuild
> +                                them if they rely on them.
> +
> +                    Bit 1:      Enable subclusters. This affects the L2 table
> +                                format.
> +
> +                    Bits 2-31:  Reserved (set to 0)

Offsets 72-79 forms 8 bytes, so this should be bits 2-63 are reserved.

> +
> +         80 -  87:  compatible_features
> +                    Bitmask of compatible features. An implementation can
> +                    safely ignore any unknown bits that are set.
> +
> +                    Bits 0-31:  Reserved (set to 0)

Again, bits 0-63, based on offsets.

> +
> +         88 -  95:  autoclear_features
> +                    Bitmask of auto-clear features. An implementation may only
> +                    write to an image with unknown auto-clear features if it
> +                    clears the respective bits from this field first.
> +
> +                    Bits 0-31:  Reserved (set to 0)

And again.

> +
> +         96 -  99:  refcount_bits
> +                    Size of a reference count block entry in bits. For version 2
> +                    images, the size is always assumed to be 16 bits. The size
> +                    must be a power of two.
> +                    [ TODO: Define order in sub-byte sizes ]
> +
> +        100 - 103:  header_length
> +                    Length of the header structure in bytes. For version 2
> +                    images, the length is always assumed to be 72 bytes.

Might be a good idea to require this to be a multiple of 8, since both
72 and 104 qualify, and since header extensions are also required to be
padded out to multiples of 8.

> +== Feature name table ==
> +
> +A feature name table is an optional header extension that contains the name for
> +features used by the image. It can be used by applications that don't know
> +the respective feature (e.g. because the feature was introduced only later) to
> +display a useful error message.
> +
> +The number of entries in the feature name table is determined by the length of
> +the header extension data. Its entries look like this:
> +
> +    Byte       0:   Type of feature (select feature bitmap)
> +                        0: Incompatible feature
> +                        1: Compatible feature
> +                        2: Autoclear feature
> +
> +               1:   Bit number within the selected feature bitmap
> +
> +          2 - 47:   Feature name (padded with zeros, but not necessarily null
> +                    terminated if it has full length)

Semantic nit: The NUL character is all zeros; it is one byte in all
unibyte and multi-byte encodings, and the NUL wide character is the
all-zero wchar_t value; while 'null' refers to a pointer to nowhere.
Saying a string is null terminated is wrong, because you don't have a 4-
or 8-byte NULL pointer at the end of the string, just a one-byte NUL
character.  Therefore, strings are nul-terminated, not null-terminated.

Is this extension capped at 48 bytes, or it is a repeating table of as
many 48-byte multiples as necessary to represent each feature name?

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

  reply	other threads:[~2012-03-27 16:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 15:03 [Qemu-devel] [RFC PATCH 00/16] qcow2: Basic version 3 support Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 01/16] Specification for qcow2 version 3 Kevin Wolf
2012-03-27 16:25   ` Eric Blake [this message]
2012-04-02 10:00     ` Kevin Wolf
2012-04-02 16:14       ` Eric Blake
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 02/16] qcow2: Ignore reserved bits in get_cluster_offset Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 03/16] qcow2: Ignore reserved bits in count_contiguous_clusters() Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 04/16] qcow2: Fail write_compressed when overwriting data Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 05/16] qcow2: Ignore reserved bits in L1/L2 entries Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 06/16] qcow2: Refactor qcow2_free_any_clusters Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 07/16] qcow2: Simplify count_cow_clusters Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 08/16] qcow2: Ignore reserved bits in refcount table entries Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 09/16] qcow2: Ignore reserved bits in check_refcounts Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 10/16] qcow2: Version 3 images Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 11/16] qcow2: Support reading zero clusters Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 12/16] qcow2: Support for feature table header extension Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 13/16] qemu-iotests: add a simple test for write_zeroes Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 14/16] qemu-iotests: Test COW with zero clusters Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 15/16] qcow2: Zero write support Kevin Wolf
2012-03-27 15:03 ` [Qemu-devel] [RFC PATCH 16/16] qemu-iotests: use qcow3 Kevin Wolf

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=4F71E9EA.1070306@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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).