LDP/LDP/guide/docbook/lkmpg-2.4/A1-ChangesBet20And22.sgml

99 lines
5.4 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>
<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>
<indexterm><primary>asm/uaccess.h</primary></indexterm>
<indexterm><primary>asm</primary><secondary>uaccess.h</secondary></indexterm>
<indexterm><primary>put_user</primary></indexterm>
<indexterm><primary>get_user</primary></indexterm>
<indexterm><primary>structure</primary><secondary>file_operations</secondary></indexterm>
<indexterm><primary>flush</primary></indexterm>
<indexterm><primary>close</primary></indexterm>
<indexterm><primary>read</primary></indexterm>
<indexterm><primary>write</primary></indexterm>
<indexterm><primary>ssize_t</primary></indexterm>
<indexterm><primary>proc_register_dynamic</primary></indexterm>
<indexterm><primary>signals</primary></indexterm>
<indexterm><primary>queue_task_irq</primary></indexterm>
<indexterm><primary>queue_task</primary></indexterm>
<indexterm><primary>interrupts</primary></indexterm>
<indexterm><primary>irqs</primary></indexterm>
<indexterm><primary>module</primary><secondary>parameters</secondary></indexterm>
<indexterm><primary>module parameters</primary></indexterm>
<indexterm><primary>MODULE_PARM</primary></indexterm>
<indexterm><primary>Symmetrical Multi-Processing</primary></indexterm>
<indexterm><primary>SMP</primary></indexterm>
<variablelist>
<varlistentry><term><filename class="headerfile">asm/uaccess.h</filename></term>
<listitem><para>If you need <function>put_user</function> or <function>get_user</function> 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>
<listitem><para>This structure now has a flush 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>
<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>,<function>write</function> in <structname>file_operations</structname></term>
<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>
<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>
<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>
<listitem><para>Even if you want to scheduale a task to happen from inside an interrupt handler, you use
<function>queue_task</function>, not <function>queue_task_irq</function>.</para></listitem></varlistentry>
<varlistentry><term>Module Parameters</term>
<listitem><para>You no longer just declare module parameters as global variables. In 2.2 you have to also use
<parameter>MODULE_PARM</parameter> 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>
<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>
<!--
vim: tw=128
-->