From owner-freebsd-arch@FreeBSD.ORG Fri Aug 22 16:20:25 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 2E8B91065672; Fri, 22 Aug 2008 16:20:25 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.9.129]) by mx1.freebsd.org (Postfix) with ESMTP id DF3AC8FC23; Fri, 22 Aug 2008 16:20:24 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id EEB3C73098; Fri, 22 Aug 2008 18:22:59 +0200 (CEST) Date: Fri, 22 Aug 2008 18:22:59 +0200 From: Luigi Rizzo To: Brooks Davis Message-ID: <20080822162259.GA61694@onelab2.iet.unipi.it> References: <20080822090448.GB57441@onelab2.iet.unipi.it> <48AE89DC.9080408@yandex.ru> <20080822120525.GA1366@haakonia.hitnet.RWTH-Aachen.DE> <20080822145616.GA61094@onelab2.iet.unipi.it> <20080822150728.GB57443@lor.one-eyed-alien.net> <20080822154631.GA61495@onelab2.iet.unipi.it> <20080822155126.GD57443@lor.one-eyed-alien.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080822155126.GD57443@lor.one-eyed-alien.net> User-Agent: Mutt/1.4.2.3i Cc: Ivan Voras , Christian Brueffer , freebsd-arch@freebsd.org Subject: Re: Magic symlinks redux 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, 22 Aug 2008 16:20:25 -0000 On Fri, Aug 22, 2008 at 10:51:27AM -0500, Brooks Davis wrote: > On Fri, Aug 22, 2008 at 05:46:31PM +0200, Luigi Rizzo wrote: ... > > Do you know how much of it is used to implement the "varsym" > > subsystem (user- or system-wide variables) and how much is the > > core name translation ? > > Most of it is maintaining the lists of variables, handling the system > calls to read and write them, and doing the lookup with the correct > locking context. The basic match routine is about the same size, though > if you get a hit it's somewhat more expensive since you have to walk up > to three lists (two in what's in p4 at the moment, but I'm currently > splitting the per-proc code into privileged and un-privileged sets to > the administrator can add values to processes that later owners can't > modify) to resolve the variable name. so if i understand it well it could be committed as two separate pieces: one for the lookup and translation itself, and one for the variable management. The split would be very interesting for at least two reasons: 1. ease of porting/backporting/modularization e.g. think of the embedded case where one might want a limited or even no form of symlinks to save memory 2. maybe the code in charge of variable management can be replaced with some simpler instances (again for the embedded case, or e.g. to implement the NetBSD version of variant symlinks), reused for other purposes, or perhaps also integrated with other existing implementations. In fact i wonder about the following: we already have code to deal with kenv and sysctl, this would be a third mechanism that does a very similar thing, isn't there anything we can recycle from the existing ones ? Also, we do have a need to push tables of info in the kernel (e.g. list of PCI/USB ids, quirks tables and the like), maybe we can take this chance to make the varsym subsystem useful also within device drivers ? cheers luigi