From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhMml-0003hT-9i for qemu-devel@nongnu.org; Tue, 28 May 2013 12:30:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhMmb-0004Fh-ED for qemu-devel@nongnu.org; Tue, 28 May 2013 12:30:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhMmb-0004FY-7G for qemu-devel@nongnu.org; Tue, 28 May 2013 12:29:57 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4SGTunA012104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 28 May 2013 12:29:56 -0400 Message-ID: <51A4DB83.4010400@redhat.com> Date: Tue, 28 May 2013 10:29:55 -0600 From: Eric Blake MIME-Version: 1.0 References: <1369754856-30036-1-git-send-email-kwolf@redhat.com> <1369754856-30036-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1369754856-30036-3-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2SFSBXCCGJRRDUOCHIEPJ" Subject: Re: [Qemu-devel] [PATCH 02/16] cutils: Support 'P' and 'E' suffixes in strtosz() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2SFSBXCCGJRRDUOCHIEPJ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/28/2013 09:27 AM, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf > --- > include/qemu-common.h | 2 ++ > monitor.c | 8 ++++---- > qemu-img.c | 10 ++++++---- > tests/qemu-iotests/049.out | 8 ++++---- > util/cutils.c | 4 ++++ > 5 files changed, 20 insertions(+), 12 deletions(-) >=20 Reviewed-by: Eric Blake > +++ b/qemu-img.c > @@ -84,8 +84,9 @@ static void help(void) > " options are: 'none', 'writeback' (default, except for = convert), 'writethrough',\n" > " 'directsync' and 'unsafe' (default for convert)\n" > " 'size' is the disk image size in bytes. Optional suffixe= s\n" > - " 'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G= ' (gigabyte, 1024M)\n" > - " and T (terabyte, 1024G) are supported. 'b' is ignored.= \n" > + " 'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G= ' (gigabyte, 1024M),\n" > + " 'T' (terabyte, 1024G), 'P' (petabyte, 1024T) and 'E' (= exabyte, 1024P) are\n" Pre-existing, but should we be favoring the technically correct kibibyte, mebibyte, gibibyte, ... terms, since we are treating it as powers of 1024, rather than the potentially confusing kilobyte term (since disk vendors favor powers of 1000)? > +++ b/util/cutils.c > @@ -267,6 +267,10 @@ static int64_t suffix_mul(char suffix, int64_t uni= t) > return unit * unit * unit; > case STRTOSZ_DEFSUFFIX_TB: > return unit * unit * unit * unit; > + case STRTOSZ_DEFSUFFIX_PB: > + return unit * unit * unit * unit * unit; > + case STRTOSZ_DEFSUFFIX_EB: > + return unit * unit * unit * unit * unit * unit; Pre-existing, but this code is not robust against overflow. And now that you are adding E, it's 6 fewer decimal characters that I have to type to pass in a value that will exceed even int64_t. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2SFSBXCCGJRRDUOCHIEPJ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRpNuDAAoJEKeha0olJ0NqLqIH/iLZ40I4MUn1XuUOXP3cY0ut 1TNJW1h7j43duxj/Taul9+/9lwD4ZxcvZOCRFI77pkEoyIy6wwyGWo68gEjSEsxC yEAgSX2Rs21gOe33mg1BooeixPnOZJ98q4t6pKobEmMM4cXowdNUSv9ou85nHm4P 5DpEB7fcv+V6L0F/yv436gNnz0of/UXvex4wJ+fKSCE7dXmcQeaiHMXpUh91DRVu 29IilNZeMKbYLUEIiQUcb5i1sktUNgYp//R6T92WjLWy+TF74qvc0Yy1boog4qSZ 0MVxqiU99q/APnn3JHdBcp4Ss+dGUzdqODCgWWSlavyqS11b1OFsn0VZxhMxGpY= =15Ly -----END PGP SIGNATURE----- ------enig2SFSBXCCGJRRDUOCHIEPJ--