From: leovincentseles Date: Sat, 25 Jun 2022 15:15:48 +0000 (+0800) Subject: module_init and module_exit are defined in module.h X-Git-Tag: latest~59^2 X-Git-Url: https://www.ivnss.com/gitweb/?a=commitdiff_plain;h=22ebabe2973c0788e6fa9ebf2ffe2a3ab4c186cd;p=lkmpg module_init and module_exit are defined in module.h Both module_init and module_exit are defined in include/linux/module.h --- diff --git a/lkmpg.tex b/lkmpg.tex index 7af09ca..f7c94e5 100644 --- a/lkmpg.tex +++ b/lkmpg.tex @@ -419,7 +419,7 @@ What happens? \subsection{Hello and Goodbye} \label{hello_n_goodbye} In early kernel versions you had to use the \cpp|init_module| and \cpp|cleanup_module| functions, as in the first hello world example, but these days you can name those anything you want by using the \cpp|module_init| and \cpp|module_exit| macros. -These macros are defined in \src{include/linux/init.h}. +These macros are defined in \src{include/linux/module.h}. The only requirement is that your init and cleanup functions must be defined before calling the those macros, otherwise you'll get compilation errors. Here is an example of this technique: