diff options
author | Karel Zak | 2013-01-28 09:25:08 +0100 |
---|---|---|
committer | Karel Zak | 2013-01-28 09:25:08 +0100 |
commit | fe98b1805fef4f95b99d244fb5567c24de8f0b33 (patch) | |
tree | 72aa1693aca46c80d4fe1232af050a16f186b0c7 /sys-utils/fstrim.c | |
parent | column: make usage() translator friendly (diff) | |
download | kernel-qcow2-util-linux-fe98b1805fef4f95b99d244fb5567c24de8f0b33.tar.gz kernel-qcow2-util-linux-fe98b1805fef4f95b99d244fb5567c24de8f0b33.tar.xz kernel-qcow2-util-linux-fe98b1805fef4f95b99d244fb5567c24de8f0b33.zip |
fstrim: use human readable sizes in verbose output
# fstrim -v /home
/home: 513.9 MiB (538828800 bytes) were trimmed
Reported-by: member graysky <graysky@archlinux.us>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/fstrim.c')
-rw-r--r-- | sys-utils/fstrim.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c index d3e446bd8..3fe52fc62 100644 --- a/sys-utils/fstrim.c +++ b/sys-utils/fstrim.c @@ -144,10 +144,16 @@ int main(int argc, char **argv) if (ioctl(fd, FITRIM, &range)) err(EXIT_FAILURE, _("%s: FITRIM ioctl failed"), path); - if (verbose) + if (verbose) { + char *str = size_to_human_string(SIZE_SUFFIX_3LETTER | + SIZE_SUFFIX_SPACE, + (uint64_t) range.len); /* TRANSLATORS: The standard value here is a very large number. */ - printf(_("%s: %" PRIu64 " bytes were trimmed\n"), - path, (uint64_t) range.len); + printf(_("%s: %s (%" PRIu64 " bytes) were trimmed\n"), + path, str, + (uint64_t) range.len); + free(str); + } close(fd); return EXIT_SUCCESS; } |