Clarify kernel header inclusion
Both <linux/module.h> and <linux/kernel.h> are essential headers, and LKM should include them. Here, we do not use the fully qualified path specifying the headers.
This commit is contained in:
parent
251adeb075
commit
e551c98dde
|
@ -269,9 +269,9 @@ However, many people still use \cpp|init_module()| and \cpp|cleanup_module()| fo
|
||||||
Typically, \cpp|init_module()| either registers a handler for something with the kernel, or it replaces one of the kernel functions with its own code (usually code to do something and then call the original function).
|
Typically, \cpp|init_module()| either registers a handler for something with the kernel, or it replaces one of the kernel functions with its own code (usually code to do something and then call the original function).
|
||||||
The \cpp|cleanup_module()| function is supposed to undo whatever \cpp|init_module()| did, so the module can be unloaded safely.
|
The \cpp|cleanup_module()| function is supposed to undo whatever \cpp|init_module()| did, so the module can be unloaded safely.
|
||||||
|
|
||||||
Lastly, every kernel module needs to include \verb|linux/module.h|.
|
Lastly, every kernel module needs to include \verb|<linux/module.h>|.
|
||||||
% TODO: adjust the section anchor
|
% TODO: adjust the section anchor
|
||||||
We needed to include \verb|linux/kernel.h| only for the macro expansion for the \cpp|pr_alert()| log level, which you'll learn about in Section \ref{sec:printk}.
|
We needed to include \verb|<linux/kernel.h>| only for the macro expansion for the \cpp|pr_alert()| log level, which you'll learn about in Section \ref{sec:printk}.
|
||||||
|
|
||||||
\begin{enumerate}
|
\begin{enumerate}
|
||||||
\item A point about coding style.
|
\item A point about coding style.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user