Skip to content

Commit f2e09d3

Browse files
authored
Merge pull request #351 from Jordymalone/improve-latex
Improve LaTeX source maintainability
2 parents a19a42b + 38b7470 commit f2e09d3

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

lkmpg.tex

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,23 @@ \section{Introduction}
6565
\label{sec:introduction}
6666
The Linux Kernel Module Programming Guide is a free book; you may reproduce or modify it under the terms of the \href{https://opensource.org/licenses/OSL-3.0}{Open Software License}, version 3.0.
6767

68-
This book is distributed in the hope that it would be useful, but without any warranty, without even the implied warranty of merchantability or fitness for a particular purpose.
68+
This book is distributed in the hope that it would be useful, but without any warranty,
69+
without even the implied warranty of merchantability or fitness for a particular purpose.
6970

70-
The author encourages wide distribution of this book for personal or commercial use, provided the above copyright notice remains intact and the method adheres to the provisions of the \href{https://opensource.org/licenses/OSL-3.0}{Open Software License}.
71-
In summary, you may copy and distribute this book free of charge or for a profit. No explicit permission is required from the author for reproduction of this book in any medium, physical or electronic.
71+
The author encourages wide distribution of this book for personal or commercial use,
72+
provided the above copyright notice remains intact and the method adheres to the provisions of the \href{https://opensource.org/licenses/OSL-3.0}{Open Software License}.
73+
In summary, you may copy and distribute this book free of charge or for a profit.
74+
No explicit permission is required from the author for reproduction of this book in any medium, physical or electronic.
7275

7376
Derivative works and translations of this document must be placed under the Open Software License, and the original copyright notice must remain intact.
7477
If you have contributed new material to this book, you must make the material and source code available for your revisions.
7578
Please make revisions and updates available directly to the document maintainer, Jim Huang <jserv@ccns.ncku.edu.tw>.
7679
This will allow for the merging of updates and provide consistent revisions to the Linux community.
7780

78-
If you publish or distribute this book commercially, donations, royalties, or printed copies are greatly appreciated by the author and the \href{https://tldp.org/}{Linux Documentation Project} (LDP).
79-
Contributing in this way shows your support for free software and the LDP. If you have questions or comments, please contact the address above.
81+
If you publish or distribute this book commercially, donations, royalties,
82+
or printed copies are greatly appreciated by the author and the \href{https://tldp.org/}{Linux Documentation Project} (LDP).
83+
Contributing in this way shows your support for free software and the LDP.
84+
If you have questions or comments, please contact the address above.
8085

8186
\subsection{Authorship}
8287
\label{sec:authorship}
@@ -536,7 +541,8 @@ \subsection{Passing Command Line Arguments to a Module}
536541
The example code should clear up my admittedly lousy explanation.
537542

538543
The \cpp|module_param()| macro takes 3 arguments: the name of the variable, its type and permissions for the corresponding file in sysfs.
539-
Integer types can be signed as usual or unsigned. If you would like to use arrays of integers or strings, see \cpp|module_param_array()| and \cpp|module_param_string()|.
544+
Integer types can be signed as usual or unsigned. If you would like to use arrays of integers or strings,
545+
see \cpp|module_param_array()| and \cpp|module_param_string()|.
540546

541547
\begin{code}
542548
int myint = 3;
@@ -545,7 +551,8 @@ \subsection{Passing Command Line Arguments to a Module}
545551

546552
Arrays are supported too, but things are a bit different now than they were in the olden days.
547553
To keep track of the number of parameters, you need to pass a pointer to a count variable as the third parameter.
548-
At your option, you could also ignore the count and pass \cpp|NULL| instead. We show both possibilities here:
554+
At your option, you could also ignore the count and pass \cpp|NULL| instead.
555+
We show both possibilities here:
549556

550557
\begin{code}
551558
int myintarray[2];
@@ -557,7 +564,8 @@ \subsection{Passing Command Line Arguments to a Module}
557564
\end{code}
558565

559566
A good use for this is to have the module variable's default values set, like a port or IO address.
560-
If the variables contain the default values, then perform autodetection (explained elsewhere). Otherwise, keep the current value.
567+
If the variables contain the default values, then perform autodetection (explained elsewhere).
568+
Otherwise, keep the current value.
561569
This will be made clear later on.
562570

563571
Lastly, there is a macro function, \cpp|MODULE_PARM_DESC()|, that is used to document arguments that the module can take.
@@ -635,16 +643,22 @@ \subsection{Modules Spanning Multiple Files}
635643
636644
\subsection{Building modules for a precompiled kernel}
637645
\label{sec:precompiled}
638-
Obviously, we strongly suggest you to recompile your kernel, so that you can enable a number of useful debugging features, such as forced module unloading (\cpp|MODULE_FORCE_UNLOAD|): when this option is enabled, you can force the kernel to unload a module even when it believes it is unsafe, via a \sh|sudo rmmod -f module| command.
646+
% TODO: Recent Linux kernel images shipped with distributions should already have sufficient debugging features enabled for LKMPG.
647+
Obviously, we strongly suggest you to recompile your kernel, so that you can enable a number of useful debugging features,
648+
such as forced module unloading (\cpp|MODULE_FORCE_UNLOAD|): when this option is enabled,
649+
you can force the kernel to unload a module even when it believes it is unsafe, via a \sh|sudo rmmod -f module| command.
639650
This option can save you a lot of time and a number of reboots during the development of a module.
640651
If you do not want to recompile your kernel then you should consider running the examples within a test distribution on a virtual machine.
641652
If you mess anything up then you can easily reboot or restore the virtual machine (VM).
642653
643-
There are a number of cases in which you may want to load your module into a precompiled running kernel, such as the ones shipped with common Linux distributions, or a kernel you have compiled in the past.
644-
In certain circumstances you could require to compile and insert a module into a running kernel which you are not allowed to recompile, or on a machine that you prefer not to reboot.
654+
There are a number of cases in which you may want to load your module into a precompiled running kernel,
655+
such as the ones shipped with common Linux distributions, or a kernel you have compiled in the past.
656+
In certain circumstances you could require to compile and insert a module into a running kernel which you are not allowed to recompile,
657+
or on a machine that you prefer not to reboot.
645658
If you can't think of a case that will force you to use modules for a precompiled kernel you might want to skip this and treat the rest of this chapter as a big footnote.
646659
647-
Now, if you just install a kernel source tree, use it to compile your kernel module and you try to insert your module into the kernel, in most cases you would obtain an error as follows:
660+
Now, if you just install a kernel source tree, use it to compile your kernel module and you try to insert your module into the kernel,
661+
in most cases you would obtain an error as follows:
648662
649663
\begin{verbatim}
650664
insmod: ERROR: could not insert module poet.ko: Invalid module format

0 commit comments

Comments
 (0)