Yeah, sure no rush. Another interesting mode of failure to check in
howmany(X, S) is KASSERT((X % S) == 0). There might be few cases when it's
intended behaviour, but for majority of them it should be indication of
some kind of programmatic error (i.e. missing a cast in sizeof and getting
void * size instead of the structure size). Those which rely on rounding
could then be separated into howmany_rup() and howmany_rdown() or something.

On Tue, Apr 26, 2016 at 12:04 PM, Pedro Giffuni <p...@freebsd.org> wrote:

> Hello
>
> On 04/26/16 13:42, Maxim Sobolev wrote:
>
>> Given the widespread use of those two macros, maybe we need  howmany.9
>> and roundup.9 manual pages with detailed formal description?
>> Particularly interested in how "return" supposed to be typed. Another
>> thing is that would be nice is some kind of automatic
>> #error/#warning/printf/KASSERT/panic when (X < Y || Y <= 0) &
>> defined(INVARIANTS).
>>
>> -Max
>>
>>
> I agree, we need those documented. There's also rounddown, roundup2 and
> rounddown2.
>
> FWIW, I am tired of these massive replacements, and will likely take
> a break before trying rounddown.
>
> Pedro.
>
> On Tue, Apr 26, 2016 at 10:39 AM, Pedro F. Giffuni <p...@freebsd.org
>> <mailto:p...@freebsd.org>> wrote:
>>
>>     Author: pfg
>>     Date: Tue Apr 26 17:39:54 2016
>>     New Revision: 298653
>>     URL: https://svnweb.freebsd.org/changeset/base/298653
>>
>>     Log:
>>       MFC r298482:
>>       Cleanup redundant parenthesis from existing howmany()/roundup()
>>     macro uses.
>>
>>       Requested by: dchagin
>>
>>     Modified:
>>       stable/10/sys/amd64/amd64/pmap.c
>>       stable/10/sys/amd64/linux/linux_sysvec.c
>>       stable/10/sys/amd64/linux32/linux32_sysvec.c
>>       stable/10/sys/compat/linux/linux_file.c
>>       stable/10/sys/dev/cxgbe/tom/t4_tom.c
>>       stable/10/sys/i386/linux/linux_sysvec.c
>>       stable/10/sys/vm/vm_radix.c
>>     Directory Properties:
>>       stable/10/   (props changed)
>>
>>
>
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to