From 5d2a98490e87872214e6acdeac1031c0eb8cfc92 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Thu, 26 May 2011 15:17:25 +0200 Subject: This adds a second parameter to size_to_human_string() to return a string with a different format based on the following flags: SIZE_SUFFIX_1LETTER = "1K" SIZE_SUFFIX_3LETTER = "1KiB", SIZE_SUFFIX_SPACE = "1 KiB" or "1 K" [kzak@redhat.com: - rename flags to SIZE_SUFFIX_* format, - fix suffix[] buffer size - add 3 letter version to the test] Signed-off-by: Francesco Cosoleto Signed-off-by: Karel Zak --- misc-utils/lsblk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'misc-utils/lsblk.c') diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 271999fa4..b6bc28b7d 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -517,7 +517,7 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line if (asprintf(&p, "%jd", cxt->size) < 0) p = NULL; } else - p = size_to_human_string(cxt->size); + p = size_to_human_string(SIZE_SUFFIX_1LETTER, cxt->size); if (p) tt_line_set_data(ln, col, p); } @@ -572,7 +572,7 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line if (sysfs_read_u64(&cxt->sysfs, "queue/discard_granularity", &x) == 0) - p = size_to_human_string(x); + p = size_to_human_string(SIZE_SUFFIX_1LETTER, x); } if (p) tt_line_set_data(ln, col, p); @@ -585,7 +585,7 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line if (sysfs_read_u64(&cxt->sysfs, "queue/discard_max_bytes", &x) == 0) - p = size_to_human_string(x); + p = size_to_human_string(SIZE_SUFFIX_1LETTER, x); } if (p) tt_line_set_data(ln, col, p); -- cgit v1.2.3-55-g7522