From owner-freebsd-rc@FreeBSD.ORG Thu Feb 22 08:45:07 2007 Return-Path: X-Original-To: freebsd-rc@freebsd.org Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B816516A404 for ; Thu, 22 Feb 2007 08:45:07 +0000 (UTC) (envelope-from tataz@tataz.chchile.org) Received: from postfix1-g20.free.fr (postfix1-g20.free.fr [212.27.60.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3FDD213C428 for ; Thu, 22 Feb 2007 08:45:07 +0000 (UTC) (envelope-from tataz@tataz.chchile.org) Received: from smtp5-g19.free.fr (smtp5-g19.free.fr [212.27.42.35]) by postfix1-g20.free.fr (Postfix) with ESMTP id 54EBCA66A29 for ; Thu, 22 Feb 2007 09:22:29 +0100 (CET) Received: from tatooine.tataz.chchile.org (tataz.chchile.org [82.233.239.98]) by smtp5-g19.free.fr (Postfix) with ESMTP id C582B279D0; Thu, 22 Feb 2007 09:22:27 +0100 (CET) Received: from obiwan.tataz.chchile.org (unknown [192.168.1.25]) by tatooine.tataz.chchile.org (Postfix) with ESMTP id 464509BE05; Thu, 22 Feb 2007 08:24:22 +0000 (UTC) Received: by obiwan.tataz.chchile.org (Postfix, from userid 1000) id 11FA6405B; Thu, 22 Feb 2007 09:24:22 +0100 (CET) Date: Thu, 22 Feb 2007 09:24:21 +0100 From: Jeremie Le Hen To: Yar Tikhiy Message-ID: <20070222082421.GG2479@obiwan.tataz.chchile.org> References: <20070221231108.GC2479@obiwan.tataz.chchile.org> <20070222020250.GM54441@comp.chem.msu.su> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070222020250.GM54441@comp.chem.msu.su> User-Agent: Mutt/1.5.13 (2006-08-11) Cc: freebsd-rc@freebsd.org, Jeremie Le Hen Subject: Re: Using /etc/rc.d/devfs from command-line X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2007 08:45:07 -0000 Yar, all, Thank you for your feedback. Please Cc: me in reply. On Thu, Feb 22, 2007 at 05:02:51AM +0300, Yar Tikhiy wrote: > On Thu, Feb 22, 2007 at 12:11:08AM +0100, Jeremie Le Hen wrote: > > Hi, > > > > The attached patch allows to provide arguments to rc.d/devfs with > > the same syntax as $devfs_set_rulesets. This is then easier to mount > > manually devfs inside a directory and apply some predefined rulesets > > on it. Before this patch you had to manually apply rules to the > > devfs mount point, provided pre-configured rulesets had been loaded > > into the kernel (with rc.subr's devfs_init_rulesets()). > > This topic could be more appropriate on freebsd-rc. Granted. Sorry I haven't thought of it before my first post. > > [...previous patch snipped...] > > Excuse me, but the last part of your patch looks like an unjustified > hack. The proper way is to pass additional arguments to run_rc_command > so that it passes them on to the respective method. If you just > change > > run_rc_command "$1" > > to > > run_rc_command "$@" > > devfs_start() will get the additional arguments as its positional > parameters $1, $2, ... Then you will be able to detect that > there are such arguments and act correspondingly from devfs_start(). > > There are other examples in /etc/rc.d. Note that for some reason > they use $*, not "$@": > > run_rc_command $* > > I cannot think of a good reason to do so. Actually I only knew one rc.d script accepting command-line arguments (rc.d/jail) and wanted to stay as close to it as possible. Unfortunately this involved hijacking $start_cmd here. I've rewritten the script in a less hackish way following your advices. I have one concern though, I wonder whether devfs_init_rulesets() could be called unconditionally at the beginning of devfs_start() or not. The result would be to load pre-defined rulesets from devfs.rules(5) at boot time regardless $devfs_system_ruleset or $devfs_set_rulesets are defined. This surely should not be MFC'd though. Best regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org >