From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrTl5-0002qf-Sv for qemu-devel@nongnu.org; Mon, 02 Jun 2014 11:02:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrTkz-00022D-VS for qemu-devel@nongnu.org; Mon, 02 Jun 2014 11:02:43 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:38634 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrTkz-000222-Px for qemu-devel@nongnu.org; Mon, 02 Jun 2014 11:02:37 -0400 Date: Mon, 2 Jun 2014 17:02:37 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140602150236.GF8181@irqsave.net> References: <1401473631-10724-1-git-send-email-armbru@redhat.com> <1401473631-10724-7-git-send-email-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1401473631-10724-7-git-send-email-armbru@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 06/10] block: Use bdrv_nb_sectors() in img_convert() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com The Friday 30 May 2014 =E0 20:13:47 (+0200), Markus Armbruster wrote : > Instead of bdrv_getlength(). Replace variable output_length by > output_sectors. >=20 > Signed-off-by: Markus Armbruster > Reviewed-by: Eric Blake > --- > qemu-img.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/qemu-img.c b/qemu-img.c > index 1ad899e..8d996ba 100644 > --- a/qemu-img.c > +++ b/qemu-img.c > @@ -1478,13 +1478,13 @@ static int img_convert(int argc, char **argv) > buf =3D qemu_blockalign(out_bs, bufsectors * BDRV_SECTOR_SIZE); > =20 > if (skip_create) { > - int64_t output_length =3D bdrv_getlength(out_bs); > - if (output_length < 0) { > + int64_t output_sectors =3D bdrv_nb_sectors(out_bs); > + if (output_sectors < 0) { > error_report("unable to get output image length: %s\n", > - strerror(-output_length)); > + strerror(-output_sectors)); > ret =3D -1; > goto out; > - } else if (output_length < total_sectors << BDRV_SECTOR_BITS) = { > + } else if (output_sectors < total_sectors) { > error_report("output file is smaller than input file"); > ret =3D -1; > goto out; > --=20 > 1.9.3 >=20 >=20 Reviewed-by: Benoit Canet