Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 1998 23:22:29 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        gibbs@plutotech.com (Justin T. Gibbs)
Cc:        tlambert@primenet.com, gibbs@plutotech.com, current@FreeBSD.ORG
Subject:   Re: devfs persistence
Message-ID:  <199802212322.QAA07185@usr04.primenet.com>
In-Reply-To: <199802212302.QAA28366@pluto.plutotech.com> from "Justin T. Gibbs" at Feb 21, 98 03:59:53 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> >You must have missed the part about "rc.local".  8-) 8-).
> 
> No I didn't miss it.  rc.local only works if you want to differentiate
> "units" of a device among permission schemes where the class you define in
> the kernel is the one that applies to "new units", and the all other
> classes apply to units that are assured to exist at boot time.  Any
> situation that falls outside of this scope will fail.

Well, then let me ask a question:

	How do I know what permissions to assign a PCMCIA or a
	PCI-hot-pluggable card device that has never been plugged
	into the machine before?

Perhaps you have an argument for:

	If this device shows up, chmod and chown it thusly.

This is the daemon soloution.  You should feel free to start such
a deamon.  In your rc.local.

Devfs should probably provide an arrival interface for such a daemon,
in case one is registered, to allow it to vet/change defaults before
the device actually gets exported.

But should there be a requirement that such a daemon be written?  Or
that the interface be in the code before it becomes the default way
of accessing a device?

I say "no".  Just as someone wanting a GUI install, a feature
which does not currently exist, must write it, so must someone
wanting a vetting daemon write the code.


Notice that devices which have not arrived before rc.local can be
run are a new feature.  Therefore, there is no valid argument for
any "historical procedent" for imminenet (about to arrive but not
yet arrived) devices.

For historically extant devices, the devices will be there before
rc.local runs, and rc.local will suffice.

The one really missing feature here is a "-f" argument to chown/chmod
for use in rc.local.  But this can be simulated (better, even) with a
shell function:

#
# chcred: change credentials
#
# chmod and chown something only if it exists
#
# usage: chcred owner:group mode file ...
#
chcred()
{
	coarg=$1
	shift
	cmarg=$1
	shift

	for i in $*
	do
		if [ -e $i ]
		then
			chown ${coarg} ${i}
			chmod ${cmarg} ${i}
		fi
	done
}


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



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