You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce the 'cleveref' package to the document. This package allows
for intelligent cross-referencing that automatically includes the
reference type (e.g., "Section" or "Figure").
The change replaces all instances of \ref{...} with \Cref{...}. This
improves document readability and simplifies maintenance by removing the
need for manual text prefixes like "Section" or "Figure" before a
reference.
This aligns with contributor suggestions to adopt cleveref for better
maintenance of cross-references across the document.
Signed-off-by: Chia-Hao Chiu <[email protected]>
Copy file name to clipboardExpand all lines: lkmpg.tex
+14-13Lines changed: 14 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,7 @@
25
25
% citation
26
26
\usepackage{cite}
27
27
\usepackage[colorlinks,citecolor=green]{hyperref}
28
+
\usepackage{cleveref}
28
29
29
30
\usepackage{xcolor}
30
31
\hypersetup{
@@ -180,7 +181,7 @@ \subsection{Before We Begin}
180
181
This output is \emph{not} automatically displayed on any console or terminal.
181
182
To view kernel module messages, you must use \sh|dmesg| to read the kernel log ring buffer,
182
183
or check the systemd journal with \sh|journalctl -k| for kernel messages.
183
-
Refer to \ref{sec:helloworld} for more information.
184
+
Refer to \Cref{sec:helloworld} for more information.
184
185
The terminal or environment from which you load the module does not affect where the output goes—it always goes to the kernel log.
185
186
\item SecureBoot.
186
187
Numerous modern computers arrive pre-configured with UEFI SecureBoot enabled—an essential security standard ensuring booting exclusively through trusted software endorsed by the original equipment manufacturer.
Lastly, every kernel module needs to include \verb|<linux/module.h>|.
423
424
% TODO: adjust the section anchor
424
-
We needed to include \verb|<linux/printk.h>| only for the macro expansion for the \cpp|pr_alert()| log level, which you'll learn about in Section \ref{sec:printk}.
425
+
We needed to include \verb|<linux/printk.h>| only for the macro expansion for the \cpp|pr_alert()| log level, which you'll learn about in \Cref{sec:printk}.
So, we can safely implement those operations without unnecessary locking.
1014
1015
1015
1016
Additionally, since Linux v5.6, the \cpp|proc_ops| structure was introduced to replace the use of the \cpp|file_operations| structure when registering proc handlers.
1016
-
See more information in the \ref{sec:proc_ops} section.
1017
+
See more information in the \Cref{sec:proc_ops}.
1017
1018
1018
1019
\subsection{The file structure}
1019
1020
\label{sec:file_struct}
@@ -1098,7 +1099,7 @@ \subsection{Registering A Device}
1098
1099
int cdev_add(struct cdev *p, dev_t dev, unsigned count);
1099
1100
\end{code}
1100
1101
1101
-
To find an example using the interface, you can see \verb|ioctl.c| described in section \ref{sec:device_files}.
1102
+
To find an example using the interface, you can see \verb|ioctl.c| described in \Cref{sec:device_files}.
1102
1103
1103
1104
\subsection{Unregistering A Device}
1104
1105
\label{sec:unregister_device}
@@ -1147,7 +1148,7 @@ \subsection{chardev.c}
1147
1148
Therefore, a solution is to enforce exclusive access.
1148
1149
We use atomic Compare-And-Swap (CAS) to maintain the states, \cpp|CDEV_NOT_USED| and \cpp|CDEV_EXCLUSIVE_OPEN|, to determine whether the file is currently opened by someone or not.
1149
1150
CAS compares the contents of a memory location with the expected value and, only if they are the same, modifies the contents of that memory location to the desired value.
1150
-
See more concurrency details in the \ref{sec:synchronization} section.
1151
+
See more concurrency details in the \Cref{sec:synchronization}.
1151
1152
1152
1153
\samplec{examples/chardev.c}
1153
1154
@@ -1272,7 +1273,7 @@ \subsection{Manage /proc file with seq\_file}
1272
1273
BE CAREFUL: when a sequence is finished, another one starts.
1273
1274
That means that at the end of function \cpp|stop()|, the function \cpp|start()| is called again.
1274
1275
This loop finishes when the function \cpp|start()| returns \cpp|NULL|.
1275
-
You can see a scheme of this in the Figure~\ref{img:seqfile}.
1276
+
You can see a scheme of this in the \Cref{img:seqfile}.
1276
1277
1277
1278
\begin{figure}[h]
1278
1279
\center
@@ -1429,7 +1430,7 @@ \section{Talking To Device Files}
1429
1430
For more information, consult the kernel source tree at \src{Documentation/userspace-api/ioctl/ioctl-number.rst}.
1430
1431
1431
1432
Also, we need to be careful that concurrent access to the shared resources will lead to the race condition.
1432
-
The solution is using atomic Compare-And-Swap (CAS), which we mentioned at \ref{sec:chardev_c} section, to enforce the exclusive access.
1433
+
The solution is using atomic Compare-And-Swap (CAS), which we mentioned at \Cref{sec:chardev_c}, to enforce the exclusive access.
In Section \ref{sec:preparation}, it was noted that the X Window System and kernel module programming are not conducive to integration.
1831
+
In \Cref{sec:preparation}, it was noted that the X Window System and kernel module programming are not conducive to integration.
1831
1832
This remains valid during the development of kernel modules.
1832
1833
However, in practical scenarios, the necessity emerges to relay messages to the tty (teletype) originating the module load command.
1833
1834
@@ -1931,7 +1932,7 @@ \subsection{GPIO}
1931
1932
1932
1933
\subsection{Control the LED's on/off state}
1933
1934
\label{sec:gpio_led}
1934
-
In Section \ref{sec:device_files}, we learned how to communicate with device files.
1935
+
In \Cref{sec:device_files}, we learned how to communicate with device files.
1935
1936
Therefore, we will further use device files to control the LED on and off.
1936
1937
1937
1938
In the implementation, a pull-down resistor is used.
@@ -2007,7 +2008,7 @@ \section{Scheduling Tasks}
2007
2008
It is possible that in future tasklets may be replaced by \textit{threaded IRQs}.
2008
2009
However, discussion about that has been ongoing since 2007 (\href{https://lwn.net/Articles/239633}{Eliminating tasklets} and \href{https://lwn.net/Articles/960041/}{The end of tasklets}),
2009
2010
so expecting immediate changes would be unwise.
2010
-
See the section \ref{sec:irq} for alternatives that avoid the tasklet debate.
2011
+
See the \Cref{sec:irq} for alternatives that avoid the tasklet debate.
0 commit comments