Subject: Re: packet capturing
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Andrew Brown <atatat@atatdot.net>
List: tech-kern
Date: 01/21/2004 22:13:31
On Wed, Jan 21, 2004 at 03:01:48PM -0800, Jonathan Stone wrote:
>...
>Here's mine, in turn. Look at a a FreeBSD (4.x) usr/src/sys/* tree.
>See at all the usages of SYSCTL_NODE(), SYSCTL_INT(), SYSCTL_STRUCT()
>macros.  Those guys put _themselves_ on a linker-set, they don't need
>to call a function which does the variadic dance. 

...whereas my SYSCTL_SETUP() macro only puts a function pointer into
the link set so that it can be called at boot time and do whatever it
needs to to decide what nodes to stuff in.

>I'd much prefer that NetBSD have a _single_, non-variadic SYSTL_INT(),
>SYSCTL_STRUCT(), SYSCTL_NODE() (ignoring the function-wrapper versus
>file-scope issue for now).
>
>The variadic constructors make that unreasonably hard to
>do in Andrew's scheme.

lest you think i was ignoring you, i haven't been.  i'm fixing all the
lkms right now (wrt sysctl *and* other issues that i uncovered), and
while doing that, i've realized some other deficiencies in the api i
invented.

at this point i think it fair to say that i'd like to:

a) churn the sysctl_createv() interface a bit to add room for making
something like the creation macros you want and some other stuff (eg,
cleaning up a subset of nodes when a module or device is unloaded).

b) rearrange the sysctlnode itself a bit to avoid current and future
32/64 bit issues.  duplicating the requisite interface pieces to
provide proper netbsd32 emulation is silly -- i can just make the node
itself immune to that problem.

c) rename the flags to make them look like they're in their own
"namespace".  this is more for aesthetics than anything else.

coincidentally, i *specifically* left a space in the api for
"versioning" the interface, so absent the change to sysctl_createv()
itself, this should be totally transparent to everyone.

>I've dealt with both for awile fast-ipsec, opencrypto).  My own
>experience is that the FreeBSD scheme is much easier to read, to
>write, to maintain; and to extend for ad-hoc usage.
>
>And lest I seem curmudgeonly: as I said at the time to Andrew in
>private email, what he did is a big, big improvement on what NetBSD
>had before, and he deserves real credit for it. Sincerely.

it's true.  he did.  :)

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
werdna@squooshy.com       * "information is power -- share the wealth."