Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Feb 2007 09:24:21 +0100
From:      Jeremie Le Hen <jeremie@le-hen.org>
To:        Yar Tikhiy <yar@comp.chem.msu.su>
Cc:        freebsd-rc@freebsd.org, Jeremie Le Hen <jeremie@le-hen.org>
Subject:   Re: Using /etc/rc.d/devfs from command-line
Message-ID:  <20070222082421.GG2479@obiwan.tataz.chchile.org>
In-Reply-To: <20070222020250.GM54441@comp.chem.msu.su>
References:  <20070221231108.GC2479@obiwan.tataz.chchile.org> <20070222020250.GM54441@comp.chem.msu.su>

next in thread | previous in thread | raw e-mail | index | archive | help
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 >



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