qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: mgreger@cinci.rr.com, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] qcow2: Clarify that compressed cluster offset requires shift
Date: Mon, 29 Feb 2016 09:06:41 -0700	[thread overview]
Message-ID: <56D46C91.6070207@redhat.com> (raw)
In-Reply-To: <56D467C5.9030402@redhat.com>

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

On 02/29/2016 08:46 AM, Max Reitz wrote:

>>>  Compressed Clusters Descriptor (x = 62 - (cluster_bits - 8)):
>>>
>>> -    Bit  0 -  x:    Host cluster offset. This is usually _not_ aligned to a
>>> -                    cluster boundary!
>>> +    Bit  0 -  x:    Bits 9-(x+9) of host cluster offset. This is
>>
>> I'd rather use one of "9..(x+9)", "[9, x+9]", "9 - (x+9)", "9—(x+9)" in
>> order to clarify that this is not a minus but a range.
> 
> ...unless, of course, this is actually a byte offset, which it seems to
> be, judging from qcow2_get_cluster_offset() (and
> qcow2_decompress_cluster(), as Kevin said on IRC).

Hmm, then I may be totally wrong. (Serves me right for trying to write a
spec patch without testing actual behavior).

At the least, we may want to say that things are usually not aligned to
even a _sector_ boundary (not just cluster boundary), and also clarify
whether the sector length is truncated or rounded up (zlib doesn't care
about trailing garbage during decompression, but you DO need to know how
many sectors to read to ensure that you are supplying zlib with trailing
garbage, rather than a truncated stream).

-- 
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: 604 bytes --]

  reply	other threads:[~2016-02-29 16:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 15:11 [Qemu-devel] [PATCH] qcow2: Clarify that compressed cluster offset requires shift Eric Blake
2016-02-29 15:42 ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-02-29 15:46   ` Max Reitz
2016-02-29 16:06     ` Eric Blake [this message]
2016-02-29 16:07       ` Max Reitz

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=56D46C91.6070207@redhat.com \
    --to=eblake@redhat.com \
    --cc=mgreger@cinci.rr.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).