[Gllug] Discover device node associated with a module

Nix nix at esperi.org.uk
Sun Apr 30 13:59:02 UTC 2006


On Sat, 29 Apr 2006, Tom Schutzer-Weissmann moaned:
> This is something I've wanted to know for ages: when I load a kernel
> module that provides a device driver, is there any way to find out what
> device node it's driving? And vice-versa, is there a way to query the
> module associated with a /dev entry?

modinfo should be a start:

nix at hades 217 /home/nix% modinfo /lib/modules/2.6.16.9-skas3-v9-pre9/kernel/drivers/block/loop.ko
filename:       /lib/modules/2.6.16.9-skas3-v9-pre9/kernel/drivers/block/loop.ko
license:        GPL
alias:          block-major-7-*
vermagic:       2.6.16.9-skas3-v9-pre9 preempt K7 REGPARM gcc-3.4
depends:
parm:           max_loop:Maximum number of loop devices (1-256) (int)

That alias (used by kmod to automatically load modules on block device
access) should be what you're looking for.

You can't go the other way (well, you can, but I don't think `read the
kernel source' was really the answer you wanted, was it?)

-- 
`On a scale of 1-10, X's "brokenness rating" is 1.1, but that's only
 because bringing Windows into the picture rescaled "brokenness" by
 a factor of 10.' --- Peter da Silva
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list