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

Simon Arlott
2008-08-31T15:20:51Z

On 31/08/08 16:13, James Bottomley wrote:
> This patch adds the ability to print sizes in either units of 10^3 (SI)
> or 2^10 (Binary) units. It rounds up to three significant figures and
> can be used for either memory or storage capacities.

> + const char *units_2[] = {"B", "Kib", "MiB", "GiB", "TiB", "PiB",

I think this should have been "KiB".
I'd prefer an option to display these without the "i"...

Oh and you need to store the original capacity before it's re-scaled to
512 bytes. Outputting sdkp->capacity at that stage it'll be a count of
512-byte sectors.

--
Simon Arlott