From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOPHH-0003Gj-H2 for qemu-devel@nongnu.org; Mon, 01 Sep 2014 06:56:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOPH8-0008SB-3c for qemu-devel@nongnu.org; Mon, 01 Sep 2014 06:56:03 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:41322 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOPH7-0008S5-T0 for qemu-devel@nongnu.org; Mon, 01 Sep 2014 06:55:54 -0400 Date: Mon, 1 Sep 2014 12:55:07 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140901105507.GN15537@irqsave.net> References: <1409348727-17183-1-git-send-email-mreitz@redhat.com> <1409348727-17183-3-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1409348727-17183-3-git-send-email-mreitz@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2] docs/qcow2: Correct refcount_block_entries List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi The Friday 29 Aug 2014 =E0 23:45:27 (+0200), Max Reitz wrote : > A refblock entry may have a different size than 16 bits, it may even be > smaller than a byte. Correct the refcount_block_entries calculation Now if the refblock entry size is smaller than a byte > accordingly. >=20 > Signed-off-by: Max Reitz > --- > docs/specs/qcow2.txt | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/docs/specs/qcow2.txt b/docs/specs/qcow2.txt > index cfbc8b0..531c478 100644 > --- a/docs/specs/qcow2.txt > +++ b/docs/specs/qcow2.txt > @@ -183,7 +183,7 @@ blocks and are exactly one cluster in size. > Given a offset into the image file, the refcount of its cluster can be= obtained > as follows: > =20 > - refcount_block_entries =3D (cluster_size / sizeof(uint16_t)) > + refcount_block_entries =3D (cluster_size / (refcount_bits / 8)) This give a divide by zero error. ^ > =20 > refcount_block_index =3D (offset / cluster_size) % refcount_block_= entries > refcount_table_index =3D (offset / cluster_size) / refcount_block_= entries > --=20 > 2.1.0 >=20 >=20