Date: Fri, 6 Aug 2010 23:48:19 -0700 From: Garrett Cooper <gcooper@FreeBSD.org> To: hackers@freebsd.org Cc: des@freebsd.org Subject: Why is TUNABLE_INT discouraged? Message-ID: <AANLkTinKaiGFhKRgqQ%2BFjm=02VfWCxULe0a68y-PkJx6@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi Hackers,
Poking around the sound(4) drivers, I looked into converting one
of the TUNABLE_INTs to an unsigned tunable for testing purposes. I
looked in kernel.h and I saw the following comment:
/*
* int
* please avoid using for new tunables!
*/
I found the commit where it was made (by des@ -- cvs revision
1.120), but unfortunately I lack the context as to why that suggestion
is made; the commit isn't very explicit as to why integers tunables
should be discouraged -- and in the case of
hw.sound.feeder_rate_round, it makes just as much sense to use an
integer type or a long integer type, as accepted input values are
small enough to fit in an integer value with a _lot_ of headroom:
hw.snd.feeder_rate_round
Sample rate rounding threshold, to avoid large prime division at
the cost of accuracy. All requested sample rates will be rounded
to the nearest threshold value. Possible values range between 0
(disabled) and 500. Default is 25.
It would be nice to know why TUNABLE_INT is discouraged :).
Thanks!
-Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinKaiGFhKRgqQ%2BFjm=02VfWCxULe0a68y-PkJx6>
