From: Jes Sorensen <jes.soren...@redhat.com> This patch introduces cutils.c: strtosz() and gets rid of the multiple custom hacks for parsing byte sizes. In addition it adds supports for specifying human style sizes such as 1.5G. Last it eliminates the horrible abuse of a float to store the byte size for migrate_set_speed in the monitor.
New in v5 I merged patches 1-3 as suggested by Markus. I believe that pretty much takes care of the overflow issues that could happen if only patches 1-2 were applied. In addition I fixed the documentation for the monitor code as pointed out by Paolo, as well as folded the documentation change in with the code it was documenting. The new code does indeed reject invalid suffixes, whereas the old code silently ignored those. IMHO that was a bug and rejecting them is correct behavior. Cheers, Jes Jes Sorensen (4): Introduce strtosz() library function to convert a string to a byte count. Add support for 'o' octet (bytes) format as monitor parameter. Switch migrate_set_speed() to take an 'o' argument rather than a float. Clarify default value of MB in migration speed argument in monitor, if no suffix is specified. This differ from previous default of bytes, but is consistent with the rest of the places where we accept a size argument. Remove obsolete 'f' double parameter type cutils.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ hmp-commands.hx | 5 ++- migration.c | 4 +- monitor.c | 46 ++++++++++++++++++++++++++--------------- qemu-common.h | 1 + vl.c | 31 +++++++++------------------- 6 files changed, 106 insertions(+), 42 deletions(-) -- 1.7.2.3