human-readable swap partition sizes with pstat -sh

Brooks Davis brooks at one-eyed-alien.net
Thu Jan 6 11:55:33 PST 2005


On Thu, Jan 06, 2005 at 09:12:01PM +0200, Giorgos Keramidas wrote:
> The following patch adds support for human-readable partition sizes in
> pstat -s and swapinfo output, when the -h option is used:
> 
> 	gothmog:/d/src/usr.sbin/pstat$ ./pstat -s
> 	Device          1K-blocks     Used    Avail Capacity
> 	/dev/ad1s1b       5120000       12  5120000     0%
> 
> 	gothmog:/d/src/usr.sbin/pstat$ ./pstat -sh
> 	Device          1K-blocks     Used    Avail Capacity
> 	/dev/ad1s1b       5120000      12K     4.9G     0%
> 
> Does anyone have comments or suggestions for further improvement?

Look good in general.  Does -kh make sense?  I think so since it would
force the blocks line, but I'm not 100% sure.  On minor, mostly style
nit is that while intmax_t is 64-bits, nothing requires that so you
should probably have conver return an int64_t.

I'd argue that we might want to replace the int64_t in humanize_number
with intmax_t since that wouldn't change the ABI (or API due to implicit
casts), but would mean we wouldn't have to add a humanize_number128
later if some architecture grows 128-bit ints for some reason or
another.

-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20050106/73cd5d49/attachment.bin


More information about the freebsd-current mailing list