SysFS, module names and .name
Greetings,
in sysfs, /sys/bus/*/drivers lists the driver names, with their exported .name (eg. '.name = "EMU10K1_Audigy"' in the module code, from now on 'driver name'). In /sys/modules, the kernel modules are listed with their module name, eg. snd_emu10k1. However, it seems to me that in sysfs, there is no way in particular to tell, which module has which .name. That is, that snd_emu10k1 is EMU10K1_Audigy and vice versa.
I wonder whether it wouldn't be possible to add a symlink to the particular module from the driver, and/or from the module to the driver, so the list of devices handled by the module and the module name would be accessible. This way, I would know which driver name corresponds to which module name and vice versa.
Or am I just boldly missing something, and there is a way how to do this from userspace, preferably without reading /proc/kcore?
Thanks in advance for reply.
- iSteve
Quoted 8 lines · iSteve
Greetings,
in sysfs,/sys/bus/*/driverslists the driver names, with their exported .name (eg. '.name = "EMU10K1_Audigy"' in the module code, from now on 'driver name'). In/sys/modules, the kernel modules are listed with their module name, eg.snd_emu10k1. However, it seems to me that in sysfs, there is no way in particular to tell, which module has which .name. That is, thatsnd_emu10k1isEMU10K1_Audigyand vice versa.
Quoted 5 lines
I wonder whether it wouldn't be possible to add a symlink to the particular module from the driver, and/or from the module to the driver, so the list of devices handled by the module and the module name would be accessible. This way, I would know which driver name corresponds to which module name and vice versa.
It's already automatically created for some bus drivers (like USB). I had a simple patch to enable this for PCI, but haven't gotten around to changing every single pci driver to enable it. If you want to do so, it isn't tough at all.
thanks,
greg k-h
Yes, I am rather interested -- could you please provide details about this method?
Thanks in advance.
- iSteve
Quoted 16 lines · Greg KH
Quoted 4 lines · iSteve
Greetings,
in sysfs,/sys/bus/*/driverslists the driver names, with their exported .name (eg. '.name = "EMU10K1_Audigy"' in the module code, from now on 'driver name'). In/sys/modules, the kernel modules are listed with their module name, eg.snd_emu10k1. However, it seems to me that in sysfs, there is no way in particular to tell, which module has which .name. That is, thatsnd_emu10k1isEMU10K1_Audigyand vice versa.I wonder whether it wouldn't be possible to add a symlink to the particular module from the driver, and/or from the module to the driver, so the list of devices handled by the module and the module name would be accessible. This way, I would know which driver name corresponds to which module name and vice versa.
It's already automatically created for some bus drivers (like USB). I had a simple patch to enable this for PCI, but haven't gotten around to changing every single pci driver to enable it. If you want to do so, it isn't tough at all.
thanks,
greg k-h
Quoted 2 lines · iSteve
Yes, I am rather interested -- could you please provide details about this method?
For PCI drivers, just add the line:
.owner = THIS_MODULE,
to their struct pci_driver definition and you will get the symlink created for you.
USB drivers already do this.
Hope this helps,
greg k-h
Quoted 11 lines · Greg KH
Quoted 1 line · iSteve
Yes, I am rather interested -- could you please provide details about this method?
For PCI drivers, just add the line:
.owner =THIS_MODULE,to their struct
pci_driverdefinition and you will get the symlink created for you.
Quoted 6 lines
USB drivers already do this.
Hope this helps,
greg k-h
-
I will add this to the alsa driver snd-emu10k1 and snd-ca0106.
James