PROPOSAL: /proc/dev

Richard Gooch (rgooch@atnf.CSIRO.AU)
Thu, 1 Jan 1998 11:25:49 +1100


Hi, all. My recent work on the /proc/mtrr interface has gotten me
thinking about an old discussion: configuring /dev entries. Instead of
complicated schemes for determining what devices are available and
automagically creating /dev entries, how about creating entries in
/proc/dev instead?

Take for example a miscellaneous character device driver such as the
PC watchdog. Instead of calling <misc_register> it would call
<proc_register> instead, creating a /proc/dev/pcwd entry rather than
relying on /dev/pcwd to exist and have the correct major & minor
numbers. When writing a new driver you would no longer have to worry
about allocating major & minor numbers. Another benefit is that
/prov/dev device entries only exist when the device is available,
which is kind of neat. Done properly, this should take no more kernel
memory than the existing major&minor /dev entries.

All that would be needed is a few simple support functions to make it
easy to register and unregister /proc/dev entries (for example using a
common struct inode_operations to conserve kernel memory).

I know that some may think that this is a departure from the
"original" philosophy of /proc, but IMHO /proc is a really powerful
interface with plenty of untapped potential.

If I get general approval from the main kernel hackers, I can put out
a patch which adds the support functions and modifies some existing
drivers (pcwd for example). I think it would be good to add a config
option (CONFIG_PROC_DEV) which if disabled (the default) drivers would
call <misc_register> as they do now. Enabling CONFIG_PROC_DEV would
make those drivers which have been patched register a /proc/dev entry
instead. The documentation for CONFIG_PROC_DEV would tell the sysadmin
to create symlinks in /dev for compatibility, and should maintain a
list of which drivers have been converted.

So, kernel gurus, what do you think?

Regards,

Richard....