Block device driver info in /proc?

Daniel Tuijnman (daniel@ATComputing.nl)
Mon, 15 Jul 2002 17:34:50 +0200


Hello,

I'm looking for a robust way to match block devices with the
corresponding device driver modules. Not just IDE and SCSI disks, but
also disks attached to disk array controllers as the Compaq IDA or
CCISS. All these modules present info in the /proc filesystem.

My question is, is there a uniform way to find it, i.e., is there a
standard for the /proc layout?

Or should I resort to make my own table to match device names to module
names? That's a solution I don't like, as it means adapting my program
each time a new device comes to the market.

Background of this question: I'm writing a Linux installer, and I need
to add the right entries to /etc/modules.conf
(e.g.: alias block-major-82 cpqarray),
and to pass the right modules to mkinitrd so Linux can be booted from
a disk attached to such a device. So then I need to find out which
(loaded) modules correspond to which devices. I can read in
/proc/partitions which disks there are, with their device names and
major numbers, but how can I relate this to the module that drives it?

For the Compaq IDA controller, for instance, /proc/partitions tells me I
have a disk /dev/ida/c0d0 with major device number 82,
then /proc/devices tells me block device 82 is named ida0, and then I
can find a file /proc/driver/block/cpqarray/ida0 from which I can infer
that the module name is cpqarray. Does this work for other drivers the
same? Or is there another way to match the two?

Cheers,
Daniel Tuijnman

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