New libutil function: parse_capacity(3).

Pawel Jakub Dawidek pjd at FreeBSD.org
Thu Sep 16 16:03:28 PDT 2004


On Fri, Sep 17, 2004 at 01:49:29AM +0300, Giorgos Keramidas wrote:
+> On 2004-09-16 20:42, Pawel Jakub Dawidek <pjd at freebsd.org> wrote:
+> > http://people.freebsd.org/~pjd/patches/parse_capacity.patch
+> > Any comments before committing?
+> 
+> Is it intentional that it works even for "negative" capacities?

Actually I wasn't sure if I should permit for this or deny it.
I decided to allow for negative values, because application still have
to check the return value, so instead of '== 0', '<= 0' can be used to
detect an error.

Simlar problem was for humanize_number(3) - it should support negative
values, because avaliable size on file system could be less than 0.
With parse_capacity(3) it is a big harder to imagine, but we can add
support in the future to growfs(8) to shrink file system when negative
value is given or something like this... :)

-- 
Pawel Jakub Dawidek                       http://www.FreeBSD.org
pjd at FreeBSD.org                           http://garage.freebsd.pl
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20040917/9f2caad1/attachment.bin


More information about the freebsd-arch mailing list