Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2008 11:50:49 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        "Poul-Henning Kamp" <phk@phk.freebsd.dk>
Cc:        Julian Elischer <julian@elischer.org>, freebsd-arch@freebsd.org
Subject:   Re: RFC: sysctl additional functions/macros
Message-ID:  <200801041150.49541.jhb@freebsd.org>
In-Reply-To: <6599.1199463509@critter.freebsd.dk>
References:  <6599.1199463509@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 04 January 2008 11:18:29 am Poul-Henning Kamp wrote:
> In message <477E592B.9040106@elischer.org>, Julian Elischer writes:
> >John Baldwin wrote:
> 
> >right, so you've solved that one.. 
> 
> Please no!
> 
> This is far more complicated and wasteful than it needs to be.
> 
> Please just include the code in the macro call and instantiate
> a function with that code inlined.

Your code body in the example though is the just the validation step, it 
doesn't have all the copyin/copyout goop (nor should it).  Are you really 
worried about the overhead of having a worker function call a function 
containing the validation code?  Provided enough validated sysctls you'd 
actually result in less actual kernel text (1 copy of the copyin/copyout vs 
N, same reason we don't inline sysctl_handle_int() everywhere).

I would probably just start with the FOO_VALIDATED at first and maybe 
FOO_VALIDATOR (that takes the code inline) if cpp(1) is happy with it and not 
worry about _CLAMPED and _BOUNDED.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801041150.49541.jhb>