TUNABLE_INT vs TUNABLE_INT_FETCH

Attilio Rao attilio at freebsd.org
Thu Aug 23 15:55:17 UTC 2012


On Thu, Aug 23, 2012 at 5:05 PM, Luigi Rizzo <rizzo at iet.unipi.it> wrote:
> On Thu, Aug 23, 2012 at 03:52:56PM +0100, Attilio Rao wrote:
>> On 8/23/12, Luigi Rizzo <rizzo at iet.unipi.it> wrote:
>> > Hi,
>> > I am a bit unclear on what are the pros and cons of using
>> > TUNABLE_INT vs TUNABLE_INT_FETCH within a device driver.
>>
>> TUNABLE_INT is basically the "statically initializer" version of
>> TUNABLE_INT_FETCH.
>> In short terms, you will use TUNABLE_INT_FETCH() in normal functions,
>> while TUNABLE_INT() in data declaration.
>
> The thing is, do we need the data declaration at all ?

What do you mean with "data declaration"?
We need to mimic a "static initialization" usage, so what we do is to
use the first SYSINIT() family available (SI_SUB_TUNABLES). You also
need the env to look for and the static variable to initialize, so for
SYSINIT's sake you need to pack them up in a single argument.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein


More information about the freebsd-current mailing list