Switching to [KMGTPE]i prefixes?

Warner Losh imp at bsdimp.com
Fri Mar 25 23:17:58 UTC 2011


On Mar 25, 2011, at 3:33 PM, Xin LI wrote:

> FYI I have a patch and I have incorporated some of Alexander's idea.
> 
> Difference:
> 
> - Use of both HN_DIVISOR_1000 and HN_IEC_PREFIXES triggers an
> assertion.  I think it doesn't make sense to return since this is an
> API violation and we should just tell the caller explicitly;
> - DIVISOR_1000 and !1000 cases use just same prefixes, so merge them
> while keeping divisor intact;
> - Make prefixes table consistently long.  I have no strong opinion on
> this one, though, it's just what my original version used and I can
> change it to the way Alexander did if there is an advantage of doing
> that way.

I did this in my first iteration, but switched to the array version after.  Either is good, honestly.

> (Note, it seems that we use HN_ prefix for both 'scale' and 'flags', I
> have sorted them by value but HN_IEC_PREFIXES should really belong to
> the flags group).


How did you guys deal with programs like df that now need to do special buffer size hacks to get consistent results?

Warner



More information about the freebsd-hackers mailing list