A.1. Changes between 2.0 and 2.2
A.1.1. Changes between 2.0 and 2.2
I don't know the entire kernel well enough do document all of the changes. In the course of converting the examples (or actually, adapting Emmanuel Papirakis's changes) I came across the following differences. I listed all of them here together to help module programmers, especially those who learned from previous versions of this book and are most familiar with the techniques I use, convert to the new version.
An additional resource for people who wish to convert to 2.2 is located on Richard Gooch's site .
- asm/uaccess.h
If you need
put_userorget_useryou have to #include it.get_userIn version 2.2,
get_userreceives both the pointer into user memory and the variable in kernel memory to fill with the information. The reason for this is thatget_usercan now read two or four bytes at a time if the variable we read is two or four bytes long.file_operationsThis structure now has a flush function between the
openandclosefunctions.closeinfile_operationsIn version 2.2, the
closefunction returns an integer, so it's allowed to fail.read,writeinfile_operationsThe headers for these functions changed. They now return ssize_t instead of an integer, and their parameter list is different. The inode is no longer a parameter, and on the other hand the offset into the file is.
proc_register_dynamicThis function no longer exists. Instead, you call the regular
proc_registerand put zero in the inode field of the structure.- Signals
The signals in the task structure are no longer a 32 bit integer, but an array of
_NSIG_WORDSintegers.queue_task_irqEven if you want to schedule a task to happen from inside an interrupt handler, you use
queue_task, notqueue_task_irq.- Module Parameters
You no longer just declare module parameters as global variables. In 2.2 you have to also use
MODULE_PARMto declare their type. This is a big improvement, because it allows the module to receive string parameters which start with a digits, for example, without getting confused.- Symmetrical Multi-Processing
The kernel is no longer inside one huge spinlock, which means that kernel modules have to be aware of SMP.