Re: Modules and DevFS

Peter Samuelson (peter@cadcamlab.org)
Thu, 1 Feb 2001 04:23:20 -0600


[William Knop]
> How can DevFS know which devices to add to /dev/scsi/... without
> loading the module and scanning the bus first? Or do you manually
> insert the scsi module when you need it?

If you do 'cd /dev/scsi', the kernel looks it up and finds it missing,
which generates a "lookup" event from the kernel to your 'devfsd'
process. (You *do* run devfsd, right?) devfsd then calls 'modprobe
/dev/scsi' (I think that's the default action, you can change it in
/etc/devfsd.conf if you wish). /sbin/modprobe reads /etc/modules.conf
which has an entry like 'alias /dev/scsi sym53c8xx', so when it is
asked to load /dev/scsi it actually loads sym53c8xx. sym53c8xx in turn
triggers the creation of /dev/scsi as it initializes.

So modprobe, having loaded the module, exits. devfsd then replies to
the kernel 'ok, try again, will you please' and the kernel does so, and
this time /dev/scsi/ exists and is accessible.

...And the chdir("/dev/scsi") system call, having waited this whole
time, finally returns successfully. And now you know ... the rest of
the story.

Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/