Skip to content

Commit 5e391e9

Browse files
committed
Improve grammar and add cursor cache to gitignore
1 parent b30af6b commit 5e391e9

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ modules.order
1212

1313
# LaTeX
1414
_minted-lkmpg
15+
_minted
1516
*.aux
1617
*.log
1718
*.out
@@ -21,6 +22,7 @@ lkmpg.pdf
2122
*.blg
2223
*.fdb_latexmk
2324
*.fls
25+
lkmpg.synctex.gz
2426

2527
# make4ht
2628
*.html

examples/hello-1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ int init_module(void)
88
{
99
pr_info("Hello world 1.\n");
1010

11-
/* A non 0 return means init_module failed; module can't be loaded. */
11+
/* A nonzero return means init_module failed; module can't be loaded. */
1212
return 0;
1313
}
1414

lkmpg.tex

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
\section{Introduction}
6464
\label{sec:introduction}
65-
The Linux Kernel Module Programming Guide is a free book; you may reproduce and/or modify it under the terms of the \href{https://opensource.org/licenses/OSL-3.0}{Open Software License}, version 3.0.
65+
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.
6666

6767
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.
6868

@@ -74,7 +74,7 @@ \section{Introduction}
7474
Please make revisions and updates available directly to the document maintainer, Jim Huang <jserv@ccns.ncku.edu.tw>.
7575
This will allow for the merging of updates and provide consistent revisions to the Linux community.
7676

77-
If you publish or distribute this book commercially, donations, royalties, and/or printed copies are greatly appreciated by the author and the \href{https://tldp.org/}{Linux Documentation Project} (LDP).
77+
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).
7878
Contributing in this way shows your support for free software and the LDP. If you have questions or comments, please contact the address above.
7979

8080
\subsection{Authorship}
@@ -170,7 +170,7 @@ \subsection{Before We Begin}
170170
However, most stock Linux distribution kernels come with modversioning enabled.
171171
If difficulties arise when loading the modules due to versioning errors, consider compiling a kernel with modversioning turned off.
172172

173-
\item Using X Window System.
173+
\item Using the X Window System.
174174
It is highly recommended to extract, compile, and load all the examples discussed in this guide from a console.
175175
Working on these tasks within the X Window System is discouraged.
176176

@@ -186,9 +186,9 @@ \subsection{Before We Begin}
186186
Certain Linux distributions even ship with the default Linux kernel configured to support SecureBoot.
187187
In these cases, the kernel module necessitates a signed security key.
188188

189-
Failing this, an attempt to insert your first ``hello world'' module would result in the message: ``\emph{ERROR: could not insert module}''.
190-
If this message \emph{Lockdown: insmod: unsigned module loading is restricted;
191-
see man kernel lockdown.7} appears in the \sh|dmesg| output,
189+
Failing that, an attempt to insert your first ``hello world'' module would result in the message: ``\emph{ERROR: could not insert module}''.
190+
If this message ``\emph{Lockdown: insmod: unsigned module loading is restricted;
191+
see man kernel lockdown.7}'' appears in the \sh|dmesg| output,
192192
the simplest approach involves disabling UEFI SecureBoot from the boot menu of your PC or laptop,
193193
allowing the successful insertion of ``hello world'' module.
194194
Naturally, an alternative involves undergoing intricate procedures such as generating keys, system key installation,
@@ -208,7 +208,7 @@ \section{Headers}
208208
\end{codebash}
209209

210210
The following command provides information on the available kernel header files.
211-
Then for example:
211+
Then, for example:
212212
\begin{codebash}
213213
sudo apt-get install linux-headers-`uname -r`
214214
\end{codebash}
@@ -264,7 +264,7 @@ \subsection{The Simplest Module}
264264
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
265265
\end{code}
266266
267-
In \verb|Makefile|, \verb|$(CURDIR)| can set to the absolute pathname of the current working directory(after all \verb|-C| options are processed, if any).
267+
In \verb|Makefile|, \verb|$(CURDIR)| can be set to the absolute pathname of the current working directory (after all \verb|-C| options are processed, if any).
268268
See more about \verb|CURDIR| in \href{https://www.gnu.org/software/make/manual/make.html}{GNU make manual}.
269269

270270
And finally, just run \verb|make| directly.
@@ -292,7 +292,7 @@ \subsection{The Simplest Module}
292292
echo $(PWD)
293293
\end{code}
294294
295-
Then, we can use \verb|-p| flag to print out the environment variable values from the Makefile.
295+
Then, we can use the \verb|-p| flag to print out the environment variable values from the Makefile.
296296
297297
\begin{verbatim}
298298
$ make -p | grep PWD
@@ -806,13 +806,13 @@ \subsection{Name Space}
806806
\subsection{Code space}
807807
\label{sec:codespace}
808808
Memory management is a very complicated subject and the majority of O'Reilly's \href{https://www.oreilly.com/library/view/understanding-the-linux/0596005652/}{Understanding The Linux Kernel} exclusively covers memory management!
809-
We are not setting out to be experts on memory managements, but we do need to know a couple of facts to even begin worrying about writing real modules.
809+
We are not setting out to be experts on memory management, but we do need to know a couple of facts to even begin worrying about writing real modules.
810810

811811
If you have not thought about what a segfault really means, you may be surprised to hear that pointers do not actually point to memory locations.
812812
Not real ones, anyway.
813813
When a process is created, the kernel sets aside a portion of real physical memory and hands it to the process to use for its executing code, variables, stack, heap and other things which a computer scientist would know about.
814814
This memory begins with 0x00000000 and extends up to whatever it needs to be.
815-
Since the memory space for any two processes do not overlap, every process that can access a memory address, say 0xbffff978, would be accessing a different location in real physical memory! The processes would be accessing an index named 0xbffff978 which points to some kind of offset into the region of memory set aside for that particular process.
815+
Since the memory space for any two processes does not overlap, every process that can access a memory address, say 0xbffff978, would be accessing a different location in real physical memory! The processes would be accessing an index named 0xbffff978 which points to some kind of offset into the region of memory set aside for that particular process.
816816
For the most part, a process like our Hello, World program can't access the space of another process, although there are ways which we will talk about later.
817817

818818
The kernel has its own space of memory as well. Since a module is code which can be dynamically inserted and removed in the kernel (as opposed to a semi-autonomous object), it shares the kernel's codespace rather than having its own.
@@ -1004,7 +1004,7 @@ \subsection{The file structure}
10041004
Resist the temptation.
10051005

10061006
Go ahead and look at the definition of file.
1007-
Most of the entries you see, like struct dentry are not used by device drivers, and you can ignore them.
1007+
Most of the entries you see, like struct dentry, are not used by device drivers, and you can ignore them.
10081008
This is because drivers do not fill file directly; they only use structures contained in file which are created elsewhere.
10091009

10101010
\subsection{Registering A Device}
@@ -1148,7 +1148,7 @@ \section{The /proc File System}
11481148

11491149
Because we don't get called when the file is opened or closed, there's nowhere for us to put \cpp|try_module_get| and \cpp|module_put| in this module, and if the file is opened and then the module is removed, there's no way to avoid the consequences.
11501150

1151-
Here a simple example showing how to use a \verb|/proc| file.
1151+
Here is a simple example showing how to use a \verb|/proc| file.
11521152
This is the HelloWorld for the \verb|/proc| filesystem.
11531153
There are three parts: create the file \verb|/proc/helloworld| in the function \cpp|init_module|, return a value (and a buffer) when the file \verb|/proc/helloworld| is read in the callback function \cpp|procfile_read|, and delete the file \verb|/proc/helloworld| in the function \cpp|cleanup_module|.
11541154

@@ -1294,7 +1294,7 @@ \section{sysfs: Interacting with your module}
12941294
Attributes can be exported for kobjects in the form of regular files in the filesystem.
12951295
Sysfs forwards file I/O operations to methods defined for the attributes, providing a means to read and write kernel attributes.
12961296

1297-
An attribute definition in simply:
1297+
A simple attribute definition:
12981298

12991299
\begin{code}
13001300
struct attribute {
@@ -1322,7 +1322,7 @@ \section{sysfs: Interacting with your module}
13221322
void device_remove_file(struct device *, const struct device_attribute *);
13231323
\end{code}
13241324

1325-
To read or write attributes, \cpp|show()| or \cpp|store()| method must be specified when declaring the attribute.
1325+
To read or write attributes, the \cpp|show()| or \cpp|store()| method must be specified when declaring the attribute.
13261326
For the common cases \src{include/linux/sysfs.h} provides convenience macros (\cpp|__ATTR|, \cpp|__ATTR_RO|, \cpp|__ATTR_WO|, etc.) to make defining attributes easier as well as making code more concise and readable.
13271327

13281328
An example of a hello world module which includes the creation of a variable accessible via sysfs is given below.

0 commit comments

Comments
 (0)