lkml.org 
[lkml]   [1998]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: devlinks: an alternative to devfs
Michael Elizabeth Chastain writes:
> Hi Richard,
>
> > I see a problem with this: when you open /dev/block/fd:0,format=360
> > the kernel will have to parse "fd:0,format=360" in order to determine
> > which set of f_ops callbacks are required for that device.
>
> Nitpick: the user doesn't open /dev/block/fd:0,format=360. The user
> opens /dev/fd0D360, just like they do right now.
>
> Yes, the driver will have to parse. Right now, the kernel passes an
> opaque 8-bit minor number to the driver, and the driver interprets that.
> A driver could continue to use a very simple, very parseable coding
> scheme for its parameters, such as two hexadecimal digits. Or a driver
> that needs more complex options, such as a scsi disk driver, could have
> more advanced parsing.
>
> > And it looks like you would need to search all these entries too. This
> > is different than implementing a devfs, since it won't use the dcache. I
> > think this scheme will be rather slow.
>
> It would have the same cache properties as the existing /dev directory.

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?

You also need to support the readlink method, which will yield
"fd:0,format=360" or some such. This leads to the confusing situation
where:

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 "->". 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.

> > > Devlinks can be put anywhere the administrator wants, such as chroot
> > > jails, or devlinks in /tmp during a system installation.
> >
> > You can mount devfs N times.
>
> 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* ...

(gaol == jail:-).

Regards,

Richard....

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.266 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site