summary refs log tree commit diff stats
path: root/qemu-io.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-06-05 14:19:28 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-06-06 11:27:03 +0200
commitb6e356aa25c81d928e1c463292048d29cf25f04e (patch)
tree1fcb52cdfa72cac2c0730ac7dba6cc555abc29bc /qemu-io.c
parent5e00984aef7c1c317e27c0e8acf66526513c770f (diff)
downloadfocaccia-qemu-b6e356aa25c81d928e1c463292048d29cf25f04e.tar.gz
focaccia-qemu-b6e356aa25c81d928e1c463292048d29cf25f04e.zip
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 <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c6
1 files changed, 6 insertions, 0 deletions
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.
  *