mirror of https://github.com/tLDP/LDP
186 lines
6.1 KiB
Plaintext
186 lines
6.1 KiB
Plaintext
<sect1>
|
|
<title>Changes between 2.0 and 2.2</title>
|
|
|
|
<indexterm><primary>2.2 changes</primary></indexterm>
|
|
<indexterm>
|
|
<primary>kernel</primary>
|
|
<secondary>versions</secondary>
|
|
</indexterm>
|
|
|
|
<para>Good writing style says we have a paragraph here.</para>
|
|
|
|
<sect2>
|
|
<title>Changes between 2.0 and 2.2</title>
|
|
|
|
<para>
|
|
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.
|
|
</para>
|
|
|
|
<para>
|
|
An additional resource for people who wish to convert to 2.2 is located
|
|
on
|
|
<ulink
|
|
url="http://www.atnf.csiro.au/~rgooch/linux/docs/porting-to-2.2.html">
|
|
Richard Gooch's site
|
|
</ulink>.
|
|
</para>
|
|
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><filename class="headerfile">asm/uaccess.h</filename></term>
|
|
<indexterm><primary>asm/uaccess.h</primary></indexterm>
|
|
<indexterm>
|
|
<primary>asm</primary>
|
|
<secondary>uaccess.h</secondary>
|
|
</indexterm>
|
|
<listitem>
|
|
<para>
|
|
If you need <function>put_user</function>
|
|
<indexterm><primary>put_user</primary></indexterm> or
|
|
<function>get_user</function>
|
|
<indexterm><primary>get_user</primary></indexterm> you have to
|
|
<userinput>#include</userinput> it.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><function>get_user</function></term>
|
|
<listitem>
|
|
<para>
|
|
In version 2.2, <function>get_user</function> receives both the
|
|
pointer into user memory and the variable in kernel memory to fill
|
|
with the information. The reason for this is that
|
|
<function>get_user</function> can now read two or four bytes at a
|
|
time if the variable we read is two or four bytes long.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><structname>file_operations</structname></term>
|
|
<indexterm>
|
|
<primary>structure</primary>
|
|
<secondary>file_operations</secondary>
|
|
</indexterm>
|
|
<listitem>
|
|
<para>
|
|
This structure now has a flush
|
|
<indexterm><primary>flush</primary></indexterm> function between
|
|
the <function>open</function> and <function>close</function>
|
|
functions.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term>
|
|
<function>close</function> in
|
|
<structname>file_operations</structname>
|
|
</term>
|
|
<indexterm><primary>close</primary></indexterm>
|
|
<listitem>
|
|
<para>
|
|
In version 2.2, the <function>close</function> function returns an
|
|
integer, so it's allowed to fail.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term>
|
|
<function>read</function> and <function>write</function> in
|
|
<structname>file_operations</structname>
|
|
</term>
|
|
<indexterm><primary>read</primary></indexterm>
|
|
<indexterm><primary>write</primary></indexterm>
|
|
<indexterm><primary>ssize_t</primary></indexterm>
|
|
<listitem>
|
|
<para>
|
|
The headers for these functions changed. They now return
|
|
<userinput>ssize_t</userinput> 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.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><function>proc_register_dynamic</function></term>
|
|
<indexterm><primary>proc_register_dynamic</primary></indexterm>
|
|
<listitem>
|
|
<para>
|
|
This function no longer exists. Instead, you call the regular
|
|
<function>proc_register</function>
|
|
<indexterm><primary>proc_register</primary></indexterm> and put
|
|
zero in the inode field of the structure.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term>Signals</term>
|
|
<indexterm><primary>signals</primary></indexterm>
|
|
<listitem>
|
|
<para>
|
|
The signals in the task structure are no longer a 32 bit integer,
|
|
but an array of <parameter>_NSIG_WORDS</parameter>
|
|
<indexterm><primary>_NSIG_WORDS</primary></indexterm> integers.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><function>queue_task_irq</function></term>
|
|
<indexterm><primary>queue_task_irq</primary></indexterm>
|
|
<listitem>
|
|
<para>
|
|
Even if you want to scheduale a task to happen from inside an
|
|
interrupt handler, you use <function>queue_task</function>,
|
|
<indexterm><primary>queue_task</primary></indexterm> not
|
|
<function>queue_task_irq</function>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<indexterm><primary>interrupts</primary></indexterm>
|
|
<indexterm><primary>irqs</primary></indexterm>
|
|
|
|
<varlistentry>
|
|
<term>Module Parameters</term>
|
|
<indexterm>
|
|
<primary>module</primary>
|
|
<secondary>parameters</secondary>
|
|
</indexterm>
|
|
<indexterm><primary>module parameters</primary></indexterm>
|
|
<listitem>
|
|
<para>
|
|
You no longer just declare module parameters as global variables.
|
|
In 2.2 you have to also use <parameter>MODULE_PARM</parameter>
|
|
<indexterm><primary>MODULE_PARM</primary></indexterm> to 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.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term>Symmetrical Multi-Processing</term>
|
|
<indexterm><primary>Symmetrical Multi-Processing</primary></indexterm>
|
|
<indexterm><primary>SMP</primary></indexterm>
|
|
<listitem>
|
|
<para>
|
|
The kernel is no longer inside one huge spinlock, which means that
|
|
kernel modules have to be aware of <acronym>SMP</acronym>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</sect2>
|
|
</sect1>
|