Modularisierung in 2.4
Jan-Benedict Glaw
jbglaw at lug-owl.de
Sat Aug 19 10:34:17 CEST 2000
On Sat, Aug 19, 2000 at 10:35:08AM +0200, Dennis Wetzig wrote:
> Hi,
>
> kann mir einer von Euch verraten, wie die Macros heissen, die in 2.4.x
> die Modul-Initialisierung leisten?
>
> In 2.2.x (oder war es doch 2.0.x) waren das init_module() und Konsorten. Dieses
> Konzept gibt es ja angeblich nicht mehr.
Da brachst Du Dirdoch nur mal irgendein Modul anzugucken:
- Du hast eine init-Funktion, die als
static int __init funktionsname_von_init_funktion(void);
deklariertr sein soll.
- Du hast eine exit-Funktion, die als
static void __exit funktionsname_von_exit_funktion(void);
deklariert sein soll.
- Du machst #include <linux/module.h>
- Du machst #include <linux/init.h>
- Ans Ende der source-Datei packst Du:
module_init(funktionsname_von_init_funktion);
module_exit(funktionsname_von_exit_funktion);
...und das war's. Der Rest ist Magie von Precompiler und Linker;)
MfG, JBG
--
Fehler eingestehen, Größe zeigen: Nehmt die Rechtschreibreform zurück!!!
/* Jan-Benedict Glaw <jbglaw at lug-owl.de> -- +49-177-5601720 */
keyID=0x8399E1BB fingerprint=250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB
"insmod vi.o and there we go..." (Alexander Viro on linux-kernel)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://lug-owl.de/pipermail/linux/attachments/20000819/66551bca/attachment.sig>
More information about the Linux
mailing list