From owner-freebsd-arch@FreeBSD.ORG Fri Jan 4 17:09:15 2008 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6779116A468 for ; Fri, 4 Jan 2008 17:09:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id 12BD513C4E1 for ; Fri, 4 Jan 2008 17:09:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8q) with ESMTP id 227283412-1834499 for multiple; Fri, 04 Jan 2008 12:07:00 -0500 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id m04H8dCN040565; Fri, 4 Jan 2008 12:08:41 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: "Poul-Henning Kamp" Date: Fri, 4 Jan 2008 11:50:49 -0500 User-Agent: KMail/1.9.6 References: <6599.1199463509@critter.freebsd.dk> In-Reply-To: <6599.1199463509@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200801041150.49541.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Fri, 04 Jan 2008 12:08:41 -0500 (EST) X-Virus-Scanned: ClamAV 0.91.2/5363/Fri Jan 4 08:37:27 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Julian Elischer , freebsd-arch@freebsd.org Subject: Re: RFC: sysctl additional functions/macros X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2008 17:09:15 -0000 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