Commit Graph

226 Commits

Author SHA1 Message Date
Jim Huang
17162018fe
Merge pull request #128 from sudoliyang/patch-2
Fix typo
2021-11-08 22:30:20 +08:00
Jim Huang
19b4d4bd22
Merge pull request #127 from sudoliyang/patch-1
Fix typo
2021-11-08 22:14:16 +08:00
Liyang Zhang
f07d5d564d
Fix typo 2021-11-08 22:10:21 +08:00
Liyang Zhang
f5600a4ead
Fix typo 2021-11-08 22:07:08 +08:00
Jim Huang
d88d0cd227
Merge pull request #123 from fennecJ/patch
Generate contributor list as a modular inclusion
2021-11-08 12:07:57 +08:00
manbing
07a9741f79
Adjust the position of Figure 1 (#126) 2021-11-08 12:06:19 +08:00
fennecJ
af09a8a1e5 Add script to gen contributor list and contrib.tex
This script do mainly 2 things:
1.
Generate file `Contributors` with git log in following format:
Contributor's name,<1-st e-mail>[,<2nd e-mail>][,<3rd e-mail>]...
The 2-nd email and so on are based on file `.mailmap` in the root
directory of the repo.
Note that it will also append contributors in File `Include`; and
will NOT append contributors in File `Exclude`.
If there are new contributors, script will sort `Contributor` after
append new contributors into each file; Otherwise it do nothing.

2.
Generate contrib.tex based on `Contributors` into lib/contrib.tex in
following format:
[name], (reasonable width) % [1-st e-mail]
Which is inspired by The Not So Short Introduction to Latex 2e[1]

We need to maintain `.mailmap`, `Exclude` and `Include` manually.
All Chinese name should be converted into English/Pinyin in `.mailmap`,
otherwise we may need extra pkg for latex to parse Chinese characters.

[1] - https://tobi.oetiker.ch/lshort/lshort.pdf

Close #68
2021-11-03 19:32:48 +08:00
linD026
6b6b6635cf
CI: Introduce Smatch for static analysis (#125)
Smatch[1][2] is a pluggable static analysis for C. It may help us find
out the potential problem of the example code.

Doing with smatch, if set the --file-output flag, it will generate the
{}.c.smatch report for each c file. This will make a little bit
complicated to collect all the report messages. So, here we stay at the
default setting, stdout for the smatch messages.

For more information, see:
- https://lwn.net/Articles/696624/
- https://elinux.org/images/d/d3/Bargmann.pdf

Also, fix the warning from Smatch:

Smatch failed: 1 warning(s), 1 error(s)
lkmpg/examples/procfs2.c:57 procfile_write() error: buffer overflow 'procfs_buffer' 1024 <= 1024
lkmpg/examples/kbleds.c:58 kbleds_init() warn: argument 5 to %lx specifier is cast from pointer

Furthermore, the effect of the write operation in procfs2.c is too
implied. So after writing, print the buffer every time.

Close #122

[1] https://github.com/error27/smatch
[2] https://repo.or.cz/w/smatch.git
2021-11-01 08:20:41 +08:00
demonsome
67149719a4
Explain inode at the first occurrence (#115)
The explanation of "inode" should appear at the first occurrence to which readers
can refer.
2021-10-25 22:46:02 +08:00
Jim Huang
28018227fc Remove out-of-date syscall information
Close #121
2021-10-14 20:51:09 +08:00
Jim Huang
151a91ecf4 Fix wording 2021-10-10 21:45:12 +08:00
Kellegram
dbac3869c7
Add Manrope variable font (#118)
Manrope is an open-source modern sans-serif font family.
2021-10-10 21:34:25 +08:00
Jim Huang
1cb35ac976
Merge pull request #120 from linD026/master
CI: Introduce GCC static analysis
2021-10-08 20:58:52 +08:00
linD026
d6e1044aa7 CI: introduce GCC static analysis
Since GCC version 10, there has been a new option -fanalyzer for
static analysis. It can make the CI pipeline more comprehensive.

Also, the static analysis updates in GCC 11, but we cannot install
the GCC 11 in ubuntu 20.04 straightforwardly right now, which is
the GitHub workflow environment (see status-check.yaml).
For this reason, we stay at the GCC 10.

Close #117

Reference
- https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/Static-Analyzer-Options.html
- https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10
- https://lwn.net/Articles/870290/
- https://developers.redhat.com/blog/2021/01/28/static-analysis-updates-in-gcc-11
- 7d73c3e9c5
2021-10-08 19:41:22 +08:00
Jim Huang
b0bbe0121f
Merge pull request #119 from marconi1964/master
Improve grammar
2021-09-29 22:20:49 +08:00
Marconi Jiang
89755e146a Correct English gramma 2021-09-29 06:41:31 -07:00
Jim Huang
0a176fbb19 Simplify the epilog 2021-09-25 19:53:13 +08:00
Jim Huang
707e193cbe Always run "dmesg" with sudo
The dmesg command allows you to review the messages that are stored in the
ring buffer. Some Linux distributions have strict requirements for
dmesg, and you need to use sudo to use dmesg.
2021-09-25 02:09:13 +08:00
Jim Huang
11e40dc8ef Remove unintended code block 2021-09-25 02:06:26 +08:00
Marconi Jiang
a1c3cca6db
Dump the message of hello-5 explicitly (#112)
Close #111
2021-09-25 02:03:44 +08:00
Jim Huang
238921037a
Merge pull request #114 from fennecJ/patch
CI: Keep workflow running even if no release tag found
2021-09-24 15:48:22 +08:00
fennecJ
76c7b0edbd Keep workflow running even if no release tag found
The action we used to delete the old release somehow cannot find the
release tag in forked repo and cause the workflow failed.
To solve this issue, simply setting `fail-if-no-release` option to false
will do the trick.
2021-09-24 13:34:32 +08:00
linD026
0d5ac2a5e2
CI: Enforce status checks once pull requests received (#113)
We tend to reject the pull requests if they fail to pass coding style checks
and static analysis.

See https://www.wesleyhaakman.org/working-with-pull-requests-status-checks-arm-templates-and-github-actions/
2021-09-23 20:01:13 +08:00
linD026
1a6fb67cf2
Fix potential concurrent access problems with VFS (#108)
Since Linux v3.14, the read, write and seek operations of "struct file" are
guaranteed for thread safety [1][2]. This patch added an explanation.

Here are the potential problems:
chardev.c:
- Move the "msg_ptr" pointer into the read function to remove unnecessary usage.
- List the clear states of "already_open" by using mnemonic enumeration.

chardev2.c:
- The "buffer" in the write function is user space data. It cannot use in the
  kernel space.
- Reduce the redundant type transformation.
- List the states of "already_open". Same as chardev.c.

[1] https://lore.kernel.org/lkml/20140303210359.26624.qmail@science.horizon.com/T/#u
[2] 9c225f2655
2021-09-23 12:20:10 +08:00
Jim Huang
027f39c0c1 Denote LWN hyperlink 2021-09-23 00:36:42 +08:00
Jim Huang
37f9a86fec Mention the Online Books Page 2021-09-22 01:38:39 +08:00
Jim Huang
81a1e88c64
Merge pull request #109 from YLowy/master
Fix typo
2021-09-19 20:47:19 +08:00
Ylowy
24257e837e
Typo. 2021-09-19 20:39:56 +08:00
Jim Huang
09e636cc80
Merge pull request #107 from sprowell/master
Fixed parameter name for hello-5.
2021-09-16 04:19:49 +08:00
Stacy Prowell
728b7fd432
Fixed parameter name for hello-5.
Parameters are case-sensitive, so myintArray is different from myintarray, and people who are running the example with copy/paste will find it doesn't work as described in the text.
2021-09-15 16:05:26 -04:00
Jim Huang
7fd696cb95
Merge pull request #106 from linD026/master
CI: Integrate the Sparse into the CI pipeline
2021-09-15 13:27:02 +08:00
linD026
25d82ec47f CI: Integrate the Sparse into the CI pipeline
Sparse[1] is a semantic parser for C language, it can find out the
potential problem of the example code.

[1] https://www.kernel.org/doc/html/latest/dev-tools/sparse.html
2021-09-15 12:43:56 +08:00
linD026
5070fcd9d0
CI: Run static analysis with Cppcheck (#105)
Cppcheck[1] is integrated into CI pipeline for running static analysis.

However, Cppcheck is known to report false-positive, and we have to
suppress some warnings in advance.

[1] https://cppcheck.sourceforge.io/
2021-09-14 00:52:04 +08:00
Jim Huang
55b77fac8d
Merge pull request #104 from linD026/master
ioctl: Remove unnecessary initialization
2021-09-13 16:15:08 +08:00
linD026
fa035da36e ioctl.c: Remove unnecessary initialization
The "alloc_chrdev_region" function will dynamically choose the
major number and store it at "dev". It is unnecessary to initialize
the "dev" before the "alloc_chrdev_region" function.
2021-09-13 14:55:16 +08:00
Jim Huang
a1aa18efe0 Trivial GitHub workflow tweak 2021-09-13 06:41:47 +00:00
Jim Huang
0a4aad90b4 Make CI validation more verbose 2021-09-13 04:03:04 +00:00
Jim Huang
42a21d2c55 Mention Free Ebook Foundation 2021-09-12 09:34:04 +00:00
Jim Huang
4473733c2e
Merge pull request #102 from giladreti/patch-1
Fix typo
2021-09-12 17:11:44 +08:00
Gilad Reti
e8d5bf7fd4
fix typo: compatibiity -> compatibility 2021-09-12 08:54:53 +03:00
Jim Huang
3c3ef728bf
Merge pull request #101 from fennecJ/patch
Enable kbleds in CI pipeline
2021-09-12 12:05:00 +08:00
fennecJ
377e63449b Remove kbleds from non-working list
Since #98 has fixed the error with kbleds caused by changed timer API,
now it can work again with docker container.
2021-09-12 11:47:00 +08:00
Jim Huang
c519f57403 Simplify the wording 2021-09-10 14:19:22 +00:00
Jim Huang
0400543038 Improve top-level documentation
This patch introduced the changes:
- Build instructions
- Strip duplicated commands
- Add more hyperlinks
- Mention nerdctl as Docker CLI replacement
2021-09-10 14:03:09 +00:00
linD026
62dbb1b7b8
Adapt the timer API Usage (#98)
Since v4.14 [1], the timer API has been changed to improve memory safety.
The series of improvements ended up at v4.15 [2].

Reference: https://lwn.net/Articles/735887/

Close #97

[1] 686fef928b
[2] 841b86f328
2021-09-10 12:29:48 +08:00
Kellegram
d5c43420c8
Workaround inconsistent text scaling (#100)
p + pre remains at em as we want to use the parent element here (however rem
could be used too, just requires a bigger value). I am setting it to 110% size,
otherwise some code blocks have relatively small text. The smaller code blocks
do appear bigger.
2021-09-10 12:08:57 +08:00
Kellegram
3b9a3bd0b8
Improve readability (#96)
This new foreground + background color maintains the minimum of 7:1 contrast ratio as specified by WCAG (this has 7.36:1) and is the same colors Firefox reading mode uses when choosing the sepia theme. 

Fonts are too small by default, using responsive units (em) let's me increase them, I am unsure where or if there is font-size specified for parent anywhere but it seems to have been manually decreased.

Increased max-width slightly to adjust for new size and more standard line-height, so the doc doesn't feel significantly longer, still maintains good eye travel.
2021-09-09 11:20:41 +08:00
Jim Huang
4ef3d90ffe suppress warning: no newline at end of file 2021-09-08 22:23:02 +08:00
fennecJ
3fcbb8e182
Improve CI pipeline to automate module testing (#95)
The script executes insmod/rmmod twice with available kernel modules.

Close #72
2021-09-08 20:38:50 +08:00
linD026
148fb013ee
Avoid unexpected concurrent access (#94)
In file {chardev,chardev2,sleep}.c, the variable to determine
the exclusive access was of integer type, which led to race
condition.

This patch rewrote the above with atomic CAS respectively
to eliminate the race.

Close #93
2021-09-07 23:42:06 +08:00