diff options
author | Francesco Cosoleto | 2011-05-26 15:17:25 +0200 |
---|---|---|
committer | Karel Zak | 2011-05-26 15:32:33 +0200 |
commit | 5d2a98490e87872214e6acdeac1031c0eb8cfc92 (patch) | |
tree | d2eaea544a6d8b662612e71395196c92bb6b5833 /misc-utils/lsblk.c | |
parent | build-sys: use AUTOMAKE_OPTIONS = gnu (diff) | |
download | kernel-qcow2-util-linux-5d2a98490e87872214e6acdeac1031c0eb8cfc92.tar.gz kernel-qcow2-util-linux-5d2a98490e87872214e6acdeac1031c0eb8cfc92.tar.xz kernel-qcow2-util-linux-5d2a98490e87872214e6acdeac1031c0eb8cfc92.zip |
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 <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r-- | misc-utils/lsblk.c | 6 |
1 files changed, 3 insertions, 3 deletions
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); |