Toward a larger dev_t
Toward a larger dev_t
Posted Mar 27, 2003 12:19 UTC (Thu) by rwmj (subscriber, #5474)Parent article: Toward a larger dev_t
Device major and minor numbers (and indeed block/char special inodes) are one of those early Unix things which have now really outlived their usefulness. The current problems and debates around them are symptomatic of the fact that the whole concept is flawed.
They were originally necessary as a hack so that one could create files which looked like devices on an ordinary filesystem.
There are two better approaches now.
One is a kind of enhanced 'devfs'. It would look a lot like /proc (the clue here is that /proc has files with magical properties, yet it doesn't need block or char special inodes). The newer devfs would be mounted under /dev. When a device is registered, a /proc-like file is created which just intercepts the open/read/write/etc. system calls and calls device-supplied functions to provide the magic properties of the file. No major or minor numbers required.
This would work for /dev but wouldn't allow you to create block and char special files on any ordinary filesystem. I'm proposing that we extend ext3 to add special "object" inodes. An object inode has some metadata - probably just the name of the kernel module which handles that inode. When an object inode is opened, it causes the module to be loaded and the open function in this module to be called. Read/write/etc. operations can be modified by the module to provide whatever kind of magic is required.
One interesting possibility is to replace some configuration files with object inodes. /etc/passwd, for example, could be a special type of file which, when read, looks like an ordinary password file, but the data is actually pulled from NIS or LDAP.
Just my £0.02 anyway.
Rich.
