From b6e356aa25c81d928e1c463292048d29cf25f04e Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 5 Jun 2013 14:19:28 +0200 Subject: qemu-io: Make cvtnum() a wrapper around strtosz_suffix() No reason to implement the same thing multiple times. A nice side effect is that fractional numbers like 0.5M can be used in qemu-io now. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi --- qemu-io.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'qemu-io.c') diff --git a/qemu-io.c b/qemu-io.c index 4288b8cc0f..8a719a881c 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -29,6 +29,12 @@ static BlockDriverState *bs; static int misalign; +static int64_t cvtnum(const char *s) +{ + char *end; + return strtosz_suffix(s, &end, STRTOSZ_DEFSUFFIX_B); +} + /* * Parse the pattern argument to various sub-commands. * -- cgit v1.2.1