Re: devlinks: an alternative to devfs

Richard Gooch (rgooch@atnf.CSIRO.AU)
Thu, 8 Jan 1998 16:09:56 +1100


Michael Elizabeth Chastain writes:
> Hi Richard,
>
> > So for every filesystem type that /dev could be mounted on, you need
> > to fiddle the handling of symlinks. Some people may still use minix,
> > and there's also isofs...
>
> That is true. I assume the people who put symlinks into the
> individual filesystems and not in the VFS had good reason to do so.
> So just as there is symlink code in lots of file systems, there
> would need to be devlink code in lots of file systems.
>
> I'm not worried about that.

Hm. Ext2 forever? ;-)

> > It also doesn't address the problem of booting off an NTFS root
> > filesystem: character and block devices aren't supported, nor are
> > symlinks (I think).
>
> Right, none of those things are supported right on NTFS right now.
> So devfs would have an advantage here over both the existing system
> and devlinks.

Yup.

> > So? The unlink() will cause a delete entry to be maintained in the
> > internal database.
>
> Oh, really?! So if I go into /dev and unlink a *nonexistent* name,
> and then an hour later I insmod a driver, that driver is *not* going to
> appear? That is a nasty bit of state. Also it means the people in
> /dev can't use it either, so it doesn't even work.
>
> I think you are missing the point. I am talking about insmod'ing
> drivers after the system is running and after the chroot jail is
> set up and in use, not insmod'ing at boot time.

I mean that if you do:
# rm /gaol/dev/lp0
# insmod lp
# ls -lF /dev/lp0
crw-rw-rw- 1 root root 6, 0 Aug 30 1992 /dev/lp0
# ls -lF /gaol/dev/lp0
/bin/ls: /gaol/dev/lp0: No such file or directory

That's what you want, isn't it? This assumes that you know which
devices you want to disable in your gaol.

And, we can be even more clever than that. By using:
# mount -t devfs -o explicit none /gaol/dev
# mknod /gaol/dev/null c 0 0
# mknod /gaol/dev/zero c 0 0

we can ensure that *only* dev/null and dev/zero will exist in the
chroot environment. In other words, you don't need to know which
devices *may* be possible. This is even better than pre-emptively
removing entries.

Regards,

Richard....