[Qemu-devel] [PATCH 4/7] common: make get_human_readable_size public

Vladimir Sementsov-Ogievskiy posted 7 patches 8 years, 8 months ago
[Qemu-devel] [PATCH 4/7] common: make get_human_readable_size public
Posted by Vladimir Sementsov-Ogievskiy 8 years, 8 months ago
To be reused from qemu-img check.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 block/qapi.c          | 2 +-
 include/qemu-common.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/qapi.c b/block/qapi.c
index a40922ea26..d249d97142 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -524,7 +524,7 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
 
 #define NB_SUFFIXES 4
 
-static char *get_human_readable_size(char *buf, int buf_size, int64_t size)
+char *get_human_readable_size(char *buf, int buf_size, int64_t size)
 {
     static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'};
     int64_t base;
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 387ef520bf..7102ad8dbd 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -152,4 +152,6 @@ void page_size_init(void);
  * returned. */
 bool dump_in_progress(void);
 
+char *get_human_readable_size(char *buf, int buf_size, int64_t size);
+
 #endif
-- 
2.11.1


Re: [Qemu-devel] [PATCH 4/7] common: make get_human_readable_size public
Posted by Eric Blake 8 years, 8 months ago
On 05/25/2017 10:26 AM, Vladimir Sementsov-Ogievskiy wrote:
> To be reused from qemu-img check.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  block/qapi.c          | 2 +-
>  include/qemu-common.h | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)

Would it be better to use size_to_str() added in commit 22951aa?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org