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: signature.asc
Description: OpenPGP digital signature

Reply via email to