Re: PROPOSAL: /proc/dev

linux kernel account (linker@nightshade.z.ml.org)
Sun, 4 Jan 1998 12:13:53 -0500 (EST)


On Sun, 4 Jan 1998, Andrea Arcangeli wrote:

> On Sat, 3 Jan 1998, Richard Gooch wrote:
>
[snip]
>
> - I think this is totally wrong for programs or people that check in /dev
> for a device before try to open it, or at least is a mess.

That can be true..

> - If you want to make something useful, your devfs must be populated from
> _all_ kernel devices at boot with 600 permission and it must not remove
> device entry for some reason. It can add/remove devices from the
> filesystem only when you load/unload a kernel module.

Root should be allowed to add things.. Like symlinks with alternate
names..

> - Since devfs should be a virtual device that forget permission and
> ownership at reboot (or after module unload) it will make the life hard
> and less efficient in the rcS.d scripts. I' d like to chown directly
> /dev/devname on ext2, instead of change a bootup script or adding the
> line "option modname chmod 644 /dev/modname; chown ..." in /etc/conf.modules.
> I don' t like something of only virtual.

Your startup scripts could just:
#set modes in devfs
/sbin/dev_modeset -c /etc/rc.d/$runlevel/devfs.permisions
#

and devfs.permissions could be something like:
##Devfs setup file, beware this is dynamicly modified at
#system shutdown.
#
#Setup Basic Permissions and Symlinks
#lower setting override above settings.
#
node:dev/audio:0770:root.users
node:dev/scsi/h0*:0770:root.disk
node:dev/scsi/h0b0t2l0:0770:root.backup
syml:dev/dat_tape:dev/scsi/h0b0t2l0
##Setup for fstab to find the usr partition at /dev/usr.
#Make sure there is a fall back.
syml:dev/sda2:dev/usr
if -e dev/volname/user
syml:dev/volname/user:dev/usr
fi
#
...

In the system shutdown (or a cron tab) there would be a program to tack
changes onto the end of the file.. The fs might want to keep track of
whats changed sync the last 'permission snapshot'.. So if you modify the
permissions on a file or make a symlike the fs will store it in a list..

Then at shutdown, or by a crontab, a program will run that will ask the
kernel for device changes, and the kernel will spit out a list of 'whats
been changed' and clear it's list. Then the program will go through devfs
and produce lines like the ones above and tack them onto the end config
file. (there would have to be some magic to filter out tty ownership).

Personaly, I would rather maintain the config file then the directory
structure..

This is really all not much of a kernel issue.. The kernel implmentation
should be clean and sane.. The distribution will have to decide how to
handle the config (the kernel just needs to provide a sane interface)

> Andrea[s] Arcangeli
>

Gregory Maxwell