[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 20/24] qemu-img: Wrap cvtnum() arou

From: Markus Armbruster
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 20/24] qemu-img: Wrap cvtnum() around qemu_strtosz()
Date: Sat, 18 Feb 2017 11:13:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Eric Blake <address@hidden> writes:

> On 02/14/2017 04:26 AM, Markus Armbruster wrote:
>> Cc: Kevin Wolf <address@hidden>
>> Cc: Max Reitz <address@hidden>
>> Cc: address@hidden
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>>  qemu-img.c | 58 +++++++++++++++++++++++++++++++---------------------------
>>  1 file changed, 31 insertions(+), 27 deletions(-)
>> @@ -3858,11 +3866,9 @@ static int img_dd_count(const char *arg,
>>                          struct DdIo *in, struct DdIo *out,
>>                          struct DdInfo *dd)
>>  {
>> -    char *end;
>> +    dd->count = cvtnum(arg);
> Hmm. cvtnum() accepts "1.5G", GNU dd does not. POSIX requires dd to
> accept '1kx10k' to mean 10 mebibytes, and GNU dd accepts '10xM' as a
> synonym, but cvtnum() does not accept all those corner cases.  POSIX
> requires dd to treat '1b' as '512', while cvdnum() treats it as '1'.  I
> sometimes wonder if our 'qemu-img dd' subcommand should be reusing the
> numeric parsing that we use everywhere else, in spite of it meaning that
> we are different than the POSIX quirks on what numbers are required to
> be supported by dd.

qemu-img dd falls short of its stated goal to be like /usr/bin/dd.
Whether that's good or bad I decline to judge ;)

>                      But that's not the concern of this patch.


> Reviewed-by: Eric Blake <address@hidden>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]