Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Nov 2005 11:06:55 -0800
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Maksim Yevmenkin <maksim.yevmenkin@savvis.net>
Cc:        Brooks Davis <brooks@one-eyed-alien.net>, Yar Tikhiy <yar@comp.chem.msu.su>, freebsd-rc@freebsd.org, freebsd-bluetooth@freebsd.org
Subject:   Re: [RFC] rc.d integration for the bluetooth subsystem
Message-ID:  <20051102190655.GA3961@odin.ac.hmc.edu>
In-Reply-To: <43690365.60909@savvis.net>
References:  <43554BCE.7090309@savvis.net> <4355FD0C.2090702@ebs.gr> <4356D12F.7000006@savvis.net> <43576A9D.1050209@ebs.gr> <4357CEA5.1000308@savvis.net> <4357D9E2.6010701@ebs.gr> <4367E346.4080106@savvis.net> <20051102111709.GD2465@comp.chem.msu.su> <20051102161311.GA8499@odin.ac.hmc.edu> <43690365.60909@savvis.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Nov 02, 2005 at 10:20:21AM -0800, Maksim Yevmenkin wrote:
> Brooks Davis wrote:
> >On Wed, Nov 02, 2005 at 02:17:09PM +0300, Yar Tikhiy wrote:
> >
> >>On Tue, Nov 01, 2005 at 01:51:02PM -0800, Maksim Yevmenkin wrote:
> >>
> >>>please find the first draft of bluetooth rc.d scripts located at
> >>>
> >>>http://people.freebsd.org/~emax/bluetooth-rc.diff.txt
> >>>
> >>>this patch adds
> >>>
> >>>1) /etc/rc.d/bluetooth script that will be used to start and stop=20
> >>>bluetooth devices. it will be called by devd(8) in response to device=
=20
> >>>arrival and departure events. the script also supports _optional_ per=
=20
> >>>device configuration. per device configuration is stored in=20
> >>>/etc/rc.conf.d/bluetooth.$dev file, where $dev is the driver name of t=
he=20
> >>>device, i.e. ubt0, sio4, btccc1
> >>>
> >>>2) /etc/rc.conf.d/bluetooth.device.sample script. this is just an=20
> >>>example. it should be copied to /etc/rc.conf.d/bluetooth.$dev and then=
=20
> >>>defaults can be adjusted. once again if there is no=20
> >>>/etc/rc.conf.d/bluetooth.$dev script then reasonable defaults will be=
=20
> >>>used.
> >>
> >>My concern is about putting things not related directly to system
> >>startup driven by rc(8) in /etc/rc.d and /etc/rc.conf.d directories.
> >>Perhaps it would be better to still use rc.subr as a source of great
> >>subroutines, but place the bluetooth scripts and configs in their
> >>own directories -- rc.subr should support this.
> >
> >I don't disagree, but we've already got three scripts like this in
> >/etc/rc.d (dhclient, power_profile, and wpa_supplicant) so I don't think
> >it's a big deal.  IMO, the conf files are find (though I don't like the
>=20
> this was another thing that i was worried about too :) however, as you=20
> pointed out, rc.d already has few 'nostart' scripts. keep in mind that=20
> even though /etc/rc.d/bluetooth has 'nostart' keyword it is still=20
> possible to execute it by hand, i.e. '/etc/rc.d/bluetooth restart ubt0'=
=20
> and it will work. this way you could restart bluetooth stack without=20
> unplugging the device. i imagine one might want to tweak config and the=
=20
> restart the stack. imo, /etc/rc.d is a good place for bluetooth script.
>
> >idea of a .sample in /etc/rc.conf.d).  There is some argument for moving
> >the scripts to another directory though.   I'm not sure what we'd call
> >it though.
>=20
> ok, let me re-phrase the question then
>=20
> do you think that having multiple config files under /etc/rc.conf.d is a=
=20
> good idea?

The one problem with this is that it breaks the model that rc.conf.d
contains files with contents that could live in in /etc/rc.conf.  That
may not be a sufficiently large problem to worry about though.  If it is
an issue an /etc/bluetooth.d could be a solution.

> do you think that other subsystem might benefit from similar (to=20
> bluetooth) config style or bluetooth will be the only subsystem that=20
> uses it?

I've been thinking a little bit about hostapd and it needs multiple
config files.  For it I was thinking of of creating an
/etc/hostapd.conf.d directory.

> i'd really hate to introduce somewhat new config style just for=20
> bluetooth. i really do not want people whine about it and ask why they=20
> cant put things into /etc/rc.conf (where the rest of config is). freebsd=
=20
> is not linux. adding or changing things should produce benefits that=20
> would overweight potential complains from users, imo.

If the concern is about people complaining about /etc/rc.conf not
working, then you have no choice but to use variables with the device
name in them.  There's no other way to do it and keep those semantics.
As I say above, I'm not sure how important it is, but from this
perspective it's pretty critical.

One interesting option might be to (ab)use the fact that config files
are scripts and modify the sample file slightly to call a function
(probably defined in an /etc/bluetooth.subr) that converts from the set
of variables you are using now to a set of ugly, but per device named
variables. i.e. you'd add something like the following to the end of the
config file:

=2E /etc/bluetooth.subr
convert_bluetooth_vars $dev

convert_bluetooth vars would then set the device variables and undefine
the non-specific ones.  That would preserve the clean file-per-device
syntax and the ability to set everything in /etc/rc.conf.

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--4Ckj6UjgE2iN1+kY
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFDaQ5OXY6L6fI4GtQRAtgqAJ9+tGZMmzUdJSuVRpjJi4ksYaY8aQCgvY4y
VhyLINo14LlHBV3YF8z0obY=
=qD3i
-----END PGP SIGNATURE-----

--4Ckj6UjgE2iN1+kY--



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