Re: [PATCH 1/2] lib: add generic helper to print sizes rounded to the correct SI range

Matthew Wilcox
2008-08-31T15:52:34Z

On Sun, Aug 31, 2008 at 10:13:54AM -0500, James Bottomley wrote:
> +int string_get_size(u64 size, const enum string_size_units units,
> + char *buf, int len)
> +{
> + const char *units_10[] = { "B", "KB", "MB", "GB", "TB", "PB",
> + "EB", "ZB", "YB", NULL};
> + const char *units_2[] = {"B", "Kib", "MiB", "GiB", "TiB", "PiB",

Typo for KiB?

Should this be another %p extension instead? %pB and %piB perhaps?
That would seem easier for the callers than futzing around with managing
their own string buffers.

--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."