Sergei Ivanov writes:
[Sorry for the delay in responding. I'm on holidays. Still.]
> I just tried devfs for the first time. After fixing a number of
> configuration issues, I found one that looks like a design problem
> in devfs (of course, given my poor knowledge of it).
>
> I am using kernel 2.4.6, glibc-2.2.3 and devfsd-1.3.11.
> The machine has a disc and a CD-ROM, used to be /dev/hda and /dev/hdb.
> The disc driver is in the kernel, and CD-ROM support is in modules.
>
> Without devfs, I have /dev/hda and /dev/hdb. When /dev/hdb is accessed,
> ide-cd module gets loaded. I don't know how this happens, probably the
> kernel uses the results of IDE probe to find out which module to load.
>
> With devfs, there is no /dev/hdb. This is ok, devfsd is supposed to
> manage it. (And it does so with some other devices - e.g. /dev/ttyS1
> works though the serial driver is modular.) But not so with ide-cd.
> It is not autoloaded when /dev/hdb is referenced.
>
> Well, /dev/hdb is an old name, maybe I should use the new name,
> /dev/ide/host0/bus0/target1/lun0/cd. No, it does not work. Why?
> Let's look into /etc/modules.devfs. What a hell, there is a line
> `probeall /dev/ide ... ide-cd ...' ,
> why doesn't it do what I want? Hmm, right, it cannot. Because /dev/ide
> already exists. It was created by the in-kernel IDE driver!
Ah.
> If *all* IDE drivers were modules, then indeed, lookup to /dev/ide
> would load them all. But once some of them are in the kernel
> (or loaded by other means), there is no such effect. Right?
>
> I can load ide-cd using /dev/cdroms (it does not exist upon boot).
> But this works just because I have only one CD-ROM. If I had two,
> and one of the drivers was already loaded, then the second one would
> be not (auto)loadable at all. Or it seems so.
Ah.
> And this method probes for all cdroms, thus loading a lot of modules
> (including SCSI), and I definitely don't want this.
>
> What can be done: adding a line
> `alias /dev/ide/*/cd ide-cd'
> in /etc/modules.conf makes the system load the module when
> the "canonical" device name is referenced.
>
> This is the Right Thing, and this is what devfs is for.
> I think such alias(es) should be in modules.devfs, or built into modprobe.
I've added that line to the modules.devfs file, plus a few others.
> Or maybe the right place for this is the kernel itself?
No. The core kernel cannot have any knowledge of device names. It's up
to each driver to deal with names. And if a driver isn't loaded, then
the name can't be given to an internal lookup function.
> Can devfs load modules without devfsd?
It used to call modprobe as a fallback, but that was pointless
bloat. So I removed it.
> But I still don't have my /dev/hdb! Well, it appears there as soon
> as ide-cd is loaded, but I don't know how to make it work "by lookup".
> Yes I can do `alias /dev/hdb ide-cd', but this assumes that /dev/hdb
> is always a CD-ROM. The problem is that there is no magical device
> like the old /dev/hdb, referring to "whatever sitting at the primary
> slave IDE".
Whatever /dev/hdb is will be host-dependent, and thus must be left to
your personalised configuration files.
> Maybe there should be nodes /dev/ide/.../lun0/disc for all IDE
> devices, not only hard discs? These could belong to the base
> IDE driver (ide-probe-mod?) and work like the old /dev/hdX.
No. That's just too ugly to contemplate.
> Then `/dev/ide/.../cd' could be a symlink to `disc'.
> And there might be a symlink `/dev/ide/.../hd' if the device
> is a hard disc. So one could refer to a device "of unknown type",
> or of a specific type (hd/cd/whatever) if desired.
Oh, the horrors. Remove half your RAM for a week as pennance.
> Okay, if you are still reading, here is the summary.
>
> 0) Devfs is a good thing. Really.
>
> 1) The "probeall" lines in modules.devfsd are bad - because the effect
> is inpredictable. More generally, loading modules by lookup should not
> load anything beyond the module providing the referenced node.
There isn't a way to do that. A single driver can support more than
once device.
> 2) The default configuration (maybe any configuration) should have aliases
> for the kernel names (like /dev/ide/*/cd -> ide-cd).
Yep.
> 3) If a driver can load modules itself, devfs should cooperate.
> Not everything can be done via devfsd.
Devfsd is great: it can come with a default configration to work
correctly on most systems, and it can be configured by the sysadmin as
required. We don't want the kernel hard-wiring stuff.
> P.S. It would be nice to mention in the FAQ that non-devfs modules
> do not work with devfs kernels.
It's the same as many, many other CONFIG options. Change the
configuration, and modules are no longer compatible. This a basic FAQ
entry and belongs elsewere.
Regards,
Richard....
Permanent: rgooch@xxxxxxxxxxxxx
Current: rgooch@xxxxxxxxxxxxxxx
|