devfs
[Top] [All Lists]

RE: module loading

To: "'Russell Coker'" <russell@xxxxxxxxxxxx>, devfs@xxxxxxxxxxx
Subject: RE: module loading
From: Borzenkov Andrey <Andrey.Borzenkov@xxxxxxxxxxx>
Date: Fri, 28 Mar 2003 09:50:05 +0300
Importance: Normal
In-reply-to: <200303271219.34936.russell@coker.com.au>
Sender: devfs-bounce@xxxxxxxxxxx
> On Thu, 27 Mar 2003 07:07, Borzenkov Andrey wrote:
> > > Would it be possible to have the kernel execute modprobe when a non-
> > > existant
> > > device node is accessed?
> > >
> > > IE If an application attempts to access /dev/ppp could the kernel run
> > > "modprobe /dev/ppp" directly (not through devfsd)?
> >
> > Theoretically, yes. Doing this means that either every file system must
> > support it in its ->lookup method or you need special file system type
> for
> > /dev. The latter exists and is called devfs :) The former may be
> 
> I only want to use devfs.
> 
> The problem is that currently modprobe is only run by devfsd in the case
> of a
> lookup of a non-existant device, while the kernel runs modprobe in the
> case
> of a device node existing but there being no driver to match.
> 
> I would like to have the kernel run modprobe in both instances to remove
> the
> need for devfsd on small systems.
> 

Yes, I understand.

O.K. look in fs/devfs/base.c:try_modload(). This is the function that is
called when lookup fails. Now you could instead of calling devsd_notify_de()
generate (relative) path using devfs_generate_path() and directly call
modprobe.

Bear in mind that devfs_generate_path() won't return absolute pathname (i.e.
/dev/ppp) - only relative to mount point (i.e. ppp). The reason is, file
system itself has no idea where it has been mounted on. It is possible to
add full path name resolution based on getcwd but I guess relative pathname
serves probably even better.

I have not checked for possible races.

OTOH is overhead of running devfsd really significant? Program itself is
pretty small and mostly sleeps.

-andrey


<Prev in Thread] Current Thread [Next in Thread>