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

From: Matthew Wilcox
Date: Sun Aug 31 2008 - 11:52:35 EST


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."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/