From owner-freebsd-current@FreeBSD.ORG Thu Jan 6 19:59:58 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 168DF16A4CE for ; Thu, 6 Jan 2005 19:59:58 +0000 (GMT) Received: from kane.otenet.gr (kane.otenet.gr [195.170.0.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 52A3643D2F for ; Thu, 6 Jan 2005 19:59:57 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from gothmog.gr (patr530-a239.otenet.gr [212.205.215.239]) j06JxqTR017088; Thu, 6 Jan 2005 21:59:55 +0200 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.1/8.13.1) with ESMTP id j06JxoLa034984; Thu, 6 Jan 2005 21:59:50 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from giorgos@localhost) by gothmog.gr (8.13.1/8.13.1/Submit) id j06JxoAl034983; Thu, 6 Jan 2005 21:59:50 +0200 (EET) (envelope-from keramida@freebsd.org) Date: Thu, 6 Jan 2005 21:59:50 +0200 From: Giorgos Keramidas To: Brooks Davis Message-ID: <20050106195950.GA34916@gothmog.gr> References: <20050106191201.GA30826@gothmog.gr> <20050106195719.GB24896@odin.ac.hmc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050106195719.GB24896@odin.ac.hmc.edu> cc: freebsd-current@freebsd.org Subject: Re: human-readable swap partition sizes with pstat -sh X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jan 2005 19:59:58 -0000 On 2005-01-06 11:57, Brooks Davis wrote: > 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. It does. -k only affects the way 'number of blocks' is printed. The sizes of 'used' and 'avail' are calculated differently -- in bytes, otherwise humanize_number() would return bogus strings. > 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 lost you a bit here. > 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. Indeed, that would be nice :-)