Aquiring a spinlock makes the holder enter atomic context. Extra
attention is needed in atomic context. In particular, functions
that may sleep must not be used. Add this detail to the spinlock
section.
The past content in the crypto section lacks informative descriptions,
and there should be a proper procedure to demonstrate how Linux
cryptography works. Due to poor maintenance, let's drop the section.
The SA_xxx flags has been removed for years. Nowadays the kernel uses
the IRQF_xxx flags to specify IRQ behaviors. Adjust the descriptions
in the book accordingly.
The code 'case -EINPROGRESS || -EBUSY: ' is the same as
'case -115 || -16 :' at compiler time, as both error code are
implemented with macro like '#define EBUSY 16'.
The code above is essentially the same as 'case 1:'. In C, there is no
real boolean value. Boolean-like value will be converted to 1 or 0.
It does not matter too much if the '-EINPROGRESS || -EBUSY' is
calculated at build time or at runtime. In both case, it will compare
the 'rc' with 1 in the switch expression. It will not compare the
'rc' with any real error code number. When the code is really '-EBUSY',
the execution will fallback to the default branch.
And in practice, most of the compilers will do this simple compile-time
static calculation, and generate code like
static int test_skcipher_result(struct skcipher_def *sk, int rc)
{
switch (rc) {
case 0:
break;
case 1:
rc = wait_for_completion_interruptible(&sk->result.completion);
/* code removed for conciseness */
break;
default:
pr_info("skcipher encrypt returned with %d result %d\n", rc,
sk->result.err);
break;
}
init_completion(&sk->result.completion);
return rc;
}
A lot of distributions are emitting warnings when using egrep and fgrep
since these are deprecated.
Update occurrences of egrep to 'grep -E' keeping the same functionality
and making the code more portable without emitting warnings.
sys_call_table is already declared in arch/x86/include/asm/syscall.h but of
cource not exported by the kernel.
before this commit, gcc complains as follows:
/usr/src/linux-headers-6.1.0-16-common/arch/x86/include/asm/syscall.h:21:29:
note: previous declaration of 'sys_call_table' with type 'long int (*
const[])(const struct pt_regs *)'
21 | extern const sys_call_ptr_t sys_call_table[];
In Debian, the name syscall conflicts with this patch:
in debian kernel source tree:
debian/patches/features/x86/x86-make-x32-syscall-support-conditional.patch
mailing list url:
https://lore.kernel.org/lkml/1415245982.3398.53.camel@decadent.org.uk/T/#u
which introduces a parameter named syscall.x32. So change our name.
schedule_work adds work to global workqueue. In this example, we create a local workqueue. Use the local workqueue by calling queue_work(), instead of putting work on the global workqueue.
The word 'defator' is unable to be found in a lexicon. Change the word
'defator' with 'drawbacks' which should imply the negative meaning intended
in the sentence.
dmesg only flushes when it encounter a newline. Without a newline, the line
is held in memory pending another printk. In this particular example
(example_atomic.c), the last pr_info in atomic_bitwise() prints when
another printk happens (either by another module, or __exit for this
module.
This can be confusing to new learner. This patch adds a newline to the last
pr_info forcing dmesg to print to the screen when the module is loaded.
Two struct completion(s) are encapsulated within another 'struct machine'.
Simplify the code by removing the outer struct and let the struct
completion(s) be self-standing.
Update description in tex to match code.