All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com,
	lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH 02/16] cutils: Support 'P' and 'E' suffixes in strtosz()
Date: Tue, 28 May 2013 10:29:55 -0600	[thread overview]
Message-ID: <51A4DB83.4010400@redhat.com> (raw)
In-Reply-To: <1369754856-30036-3-git-send-email-kwolf@redhat.com>

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

On 05/28/2013 09:27 AM, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  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(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

> +++ 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 suffixes\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 unit)
>          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.

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

  reply	other threads:[~2013-05-28 16:30 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28 15:27 [Qemu-devel] [PATCH 00/16] Make qemu-io commands available in the monitor Kevin Wolf
2013-05-28 15:27 ` [Qemu-devel] [PATCH 01/16] qemu-io: Remove unused args_command Kevin Wolf
2013-05-28 16:18   ` Eric Blake
2013-05-28 15:27 ` [Qemu-devel] [PATCH 02/16] cutils: Support 'P' and 'E' suffixes in strtosz() Kevin Wolf
2013-05-28 16:29   ` Eric Blake [this message]
2013-05-28 15:27 ` [Qemu-devel] [PATCH 03/16] qemu-io: Make cvtnum() a wrapper around strtosz_suffix() Kevin Wolf
2013-05-28 16:42   ` Eric Blake
2013-05-28 15:27 ` [Qemu-devel] [PATCH 04/16] qemu-io: Handle cvtnum() errors in 'alloc' Kevin Wolf
2013-05-28 16:53   ` Eric Blake
2013-05-28 15:27 ` [Qemu-devel] [PATCH 05/16] qemu-io: Don't use global bs in command implementations Kevin Wolf
2013-05-28 15:37   ` Kevin Wolf
2013-05-28 17:02     ` Eric Blake
2013-06-05 12:28   ` Stefan Hajnoczi
2013-06-05 12:39     ` Kevin Wolf
2013-05-28 15:27 ` [Qemu-devel] [PATCH 06/16] qemu-io: Split off commands to qemu-io-cmds.c Kevin Wolf
2013-05-29 20:29   ` Eric Blake
2013-06-04 10:11     ` Kevin Wolf
2013-05-28 15:27 ` [Qemu-devel] [PATCH 07/16] qemu-io: Factor out qemuio_command Kevin Wolf
2013-05-29 21:11   ` Eric Blake
2013-06-05 12:33   ` Stefan Hajnoczi
2013-05-28 15:27 ` [Qemu-devel] [PATCH 08/16] qemu-io: Move 'help' function Kevin Wolf
2013-05-29 21:25   ` Eric Blake
2013-06-04 10:20     ` Kevin Wolf
2013-06-05 12:37   ` Stefan Hajnoczi
2013-05-28 15:27 ` [Qemu-devel] [PATCH 09/16] qemu-io: Move 'quit' function Kevin Wolf
2013-05-29 22:11   ` Eric Blake
2013-05-28 15:27 ` [Qemu-devel] [PATCH 10/16] qemu-io: Move qemu_strsep() to cutils.c Kevin Wolf
2013-05-29 22:12   ` Eric Blake
2013-05-28 15:27 ` [Qemu-devel] [PATCH 11/16] qemu-io: Move functions for registering and running commands Kevin Wolf
2013-05-30  2:27   ` Eric Blake
2013-06-05 12:42   ` Stefan Hajnoczi
2013-05-28 15:27 ` [Qemu-devel] [PATCH 12/16] qemu-io: Move command_loop() and friends Kevin Wolf
2013-05-28 15:27 ` [Qemu-devel] [PATCH 13/16] qemu-io: Move remaining helpers from cmd.c Kevin Wolf
2013-05-28 15:27 ` [Qemu-devel] [PATCH 14/16] qemu-io: Interface cleanup Kevin Wolf
2013-05-28 15:27 ` [Qemu-devel] [PATCH 15/16] qemu-io: Use the qemu version for -V Kevin Wolf
2013-05-28 15:27 ` [Qemu-devel] [PATCH 16/16] Make qemu-io commands available in the monitor Kevin Wolf
2013-05-28 16:07   ` Eric Blake
2013-05-29  8:13     ` Kevin Wolf
2013-05-29 12:05       ` Eric Blake
2013-05-29 17:51       ` Luiz Capitulino
2013-06-04 10:08         ` Kevin Wolf
2013-06-04 12:40           ` Luiz Capitulino
2013-06-04 12:49             ` Kevin Wolf
2013-06-04 13:09               ` Luiz Capitulino
2013-06-05 13:02 ` [Qemu-devel] [PATCH 00/16] " Stefan Hajnoczi

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=51A4DB83.4010400@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.