Messages in this thread | | | Date | Thu, 8 Jan 1998 12:08:09 +1100 | From | Richard Gooch <> | Subject | Re: devlinks: an alternative to devfs |
| |
Michael Elizabeth Chastain writes: > Hi Richard,
Hi:-)
> > As I understand it your devlinks won't point to an inode, correct? > > That means when you access /dev/fd0 the follow_link method for the > > inode_operations needs to be called. It is this follow_link method > > which is then doing the parsing. Then presumably you fiddle > > base->d_inode->i_op->default_file_ops, correct? > > I don't know the file system internals well enough to comment on this. > :-/ > > > open ("/dev/fd0", ...) works but > > open ("/dev/fd:0,format=360") does not, even though > > % ls -l /dev/fd0 > > lrwxrwxrwx 1 root root <date> /dev/fd0 => fd:0,format=360 > > > > "=>" is used by ls to show a devlink, rather than "->". > > Good point. That is a confusing situation. > > > It also requires a modified ls. You may also need to modify other > > programmes which have directory browsers. I guess GNU tar would also > > need changes. > > I was trying to avoid that by implementing devlink as 'symlink + > magic bit', so that these programs would work without changes.
Er, but then GNU tar can't back up /dev properly, because it doesn't know about the magic bit. When you restore your FS those entries become ordinary symlinks.
> I suggest again using a sysctl or devctl to mark "/dev" as > "a place where drivers create entries when they initialize".
Yes, I can see why you came up with that. It's hard because /dev is not a whole filesystem: you are trying to apply a dirrerent behaviour to a portion of a filesystem. You can't solve it either by making /dev a different filesystem, since you need /dev to mount a disc-based FS. Devfs doesn't have that problem, though :-)
I think such a sysctl() would be *very* hard to implement and would be a lot more complicated than devfs.
> > > That's true. Devfs still needs more control mechanisms. If I set up a > > > chroot jail, I want to have /dev/null in it, but I don't want to have > > > my insmod'd printer driver popping up in there. > > > > # mount -t devfs none /gaol/dev > > # cd /gaol/dev > > # rm -f lp* sd* hd* tty* pty* ... > > The problem happens when an hour later, root issues the fourth command: > > # insmod lp > > I want this to create /dev/lp0, but not create /gaol/dev/lp0.
OK, then: # mount -t devfs none /gaol/dev # cd /gaol/dev # rm -f lp{0,1,2} sd{a,b,c,d,e} hd{a,b,c,d} ...
because the readdir won't show lp{0,1,2} if the module has never been loaded. Alternatively: # echo "null" > /tmp/exclude # mount -t devfs none /gaol/dev # cd /gaol/dev # rm -f `(cd /dev; tar cvXf /tmp/exclude .)`
Removing the entry if it doesn't exist is fine: the internal table will just mark the entries for /gaol/dev as verboten for that superblock.
Regards,
Richard....
| |