From owner-freebsd-current@FreeBSD.ORG Sun Oct 7 14:08:55 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C00B6106566B; Sun, 7 Oct 2012 14:08:55 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 12DBE8FC08; Sun, 7 Oct 2012 14:08:55 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id rp8so3657479pbb.13 for ; Sun, 07 Oct 2012 07:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=od0kDHiL/JBN+Q84ZTFV1NMf/feeWLJfv2ozoyvp/RU=; b=mO2hn/kUIFxB7Xjih4TQhFdIfG1t+3ZTTb7v0Z59t0wJXETW6c3OStCwadZbPxC78X 0taO4U2dYQbsyn1ySet2IBLkhMPodNP6stzG/+kRaPnMEwFzc7SRSubhqKv0sKYXfgAE sOyIaiO8irq35tZwAeVxIl9bIbxFfSMoLzlfstIbP3et7WsWWY+wix4Z2mWXMv38vQy1 JJu3mI+GndXzeCvvOx1K69RLcIF0IV7D3uRiWDzzYKh9/uHMxkzscFeg8pz4Jo5qFG/+ Pfx8Hq+SsVYU4P0+FUN3piMC1QmQ0zDip5IfHnINa8fWbkCnhpSXdYKZjITWIuo1TL/o Bivg== MIME-Version: 1.0 Received: by 10.68.222.37 with SMTP id qj5mr45196125pbc.132.1349618934499; Sun, 07 Oct 2012 07:08:54 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.223.136 with HTTP; Sun, 7 Oct 2012 07:08:54 -0700 (PDT) In-Reply-To: <20121007104330.GA75115@onelab2.iet.unipi.it> References: <20121006172834.GB63649@onelab2.iet.unipi.it> <20121007104330.GA75115@onelab2.iet.unipi.it> Date: Sun, 7 Oct 2012 07:08:54 -0700 X-Google-Sender-Auth: K8rtCc4DGZycHaqUln26joWVyyo Message-ID: From: Adrian Chadd To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 Cc: current@freebsd.org Subject: Re: sysctl-controlled key-value store ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 14:08:55 -0000 On 7 October 2012 03:43, Luigi Rizzo wrote: > > Good point, thanks for mentioning this: ew. ifconfig :-) > > Could be done, but I consider the ifconfig one of the ugliest > configuration mechanisms we have in FreeBSD so I'd rather not > contribute to that. Seconded; but compare to Linux which has mutiple different commands to do networking, as well as 'net'. :-) > src/sbin/ifconfig/ has over 11K of C source, most of it just in > charge of filling some obscure ioctl argument with limited error > checking. > > For instance, ifbridge.c has 700 lines of code defines 38 commands > or variants. All the code does is convert command line into one of [snip] > (and the like) with no complications on the kernel side and > huge simplifications on the userland side and kernel-user ABI. > Replace sysctl with sysfs or other mechanism of choice. > > > ifieee80211 is even worse -- over 5000 lines of code, > 153 between commands and arguments, and 31 different parameters: I'd personally like to break these kinds of things out into libraries so other C code can use them. I'm eventually going to do it to the net80211 code in ifconfig; maybe it's also worth doing to if_bridge for example. Doing configuration via sysctl can be hokey, especially when you use sysctl and sysfs to do things which change the sysctl/sysfs layout (by creating/destroying nodes as you change the configuration.) It's .. ew. Maybe for your bridge stuff its easy enough, but for something like net80211 where there's a lot of things to configure, doing it via sysctl would involve lots of parsing in the kernel.. and I like my kernels smaller. :-) Adrian