<HTML ><HEAD ><TITLE >Changes: 2.0 To 2.2</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="The Linux Kernel Module Programming Guide" HREF="book1.htm"><LINK REL="PREVIOUS" TITLE="Common Pitfalls" HREF="c1320.htm"><LINK REL="NEXT" TITLE="Where To Go From Here" HREF="a1486.htm"></HEAD ><BODY CLASS="APPENDIX" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >The Linux Kernel Module Programming Guide</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="c1320.htm" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="a1486.htm" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="APPENDIX" ><H1 ><A NAME="AEN1357" ></A >Appendix A. Changes: 2.0 To 2.2</H1 ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN1359" ></A >Changes between 2.0 and 2.2</H1 ><A NAME="AEN1361" ></A ><A NAME="AEN1363" ></A ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN1366" ></A >Changes between 2.0 and 2.2</H2 ><P >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.</P ><P >An additional resource for people who wish to convert to 2.2 is located on <A HREF="http://www.atnf.csiro.au/~rgooch/linux/docs/porting-to-2.2.html" TARGET="_top" > Richard Gooch's site </A >.</P ><A NAME="AEN1371" ></A ><A NAME="AEN1373" ></A ><A NAME="AEN1376" ></A ><A NAME="AEN1378" ></A ><A NAME="AEN1380" ></A ><A NAME="AEN1383" ></A ><A NAME="AEN1385" ></A ><A NAME="AEN1387" ></A ><A NAME="AEN1389" ></A ><A NAME="AEN1391" ></A ><A NAME="AEN1393" ></A ><A NAME="AEN1395" ></A ><A NAME="AEN1397" ></A ><A NAME="AEN1399" ></A ><A NAME="AEN1401" ></A ><A NAME="AEN1403" ></A ><A NAME="AEN1405" ></A ><A NAME="AEN1408" ></A ><A NAME="AEN1410" ></A ><A NAME="AEN1412" ></A ><A NAME="AEN1414" ></A ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="FILENAME" >asm/uaccess.h</TT ></DT ><DD ><P >If you need <TT CLASS="FUNCTION" >put_user</TT > or <TT CLASS="FUNCTION" >get_user</TT > you have to <TT CLASS="USERINPUT" ><B >#include</B ></TT > it.</P ></DD ><DT ><TT CLASS="FUNCTION" >get_user</TT ></DT ><DD ><P >In version 2.2, <TT CLASS="FUNCTION" >get_user</TT > receives both the pointer into user memory and the variable in kernel memory to fill with the information. The reason for this is that <TT CLASS="FUNCTION" >get_user</TT > can now read two or four bytes at a time if the variable we read is two or four bytes long.</P ></DD ><DT ><SPAN CLASS="STRUCTNAME" >file_operations</SPAN ></DT ><DD ><P >This structure now has a flush function between the <TT CLASS="FUNCTION" >open</TT > and <TT CLASS="FUNCTION" >close</TT > functions. </P ></DD ><DT ><TT CLASS="FUNCTION" >close</TT > in <SPAN CLASS="STRUCTNAME" >file_operations</SPAN ></DT ><DD ><P >In version 2.2, the <TT CLASS="FUNCTION" >close</TT > function returns an integer, so it's allowed to fail.</P ></DD ><DT ><TT CLASS="FUNCTION" >read</TT >,<TT CLASS="FUNCTION" >write</TT > in <SPAN CLASS="STRUCTNAME" >file_operations</SPAN ></DT ><DD ><P >The headers for these functions changed. They now return <TT CLASS="USERINPUT" ><B >ssize_t</B ></TT > 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.</P ></DD ><DT ><TT CLASS="FUNCTION" >proc_register_dynamic</TT ></DT ><DD ><P >This function no longer exists. Instead, you call the regular <TT CLASS="FUNCTION" >proc_register</TT > <A NAME="AEN1460" ></A > and put zero in the inode field of the structure.</P ></DD ><DT >Signals</DT ><DD ><P >The signals in the task structure are no longer a 32 bit integer, but an array of <TT CLASS="PARAMETER" ><I >_NSIG_WORDS</I ></TT > <A NAME="AEN1467" ></A > integers.</P ></DD ><DT ><TT CLASS="FUNCTION" >queue_task_irq</TT ></DT ><DD ><P >Even if you want to scheduale a task to happen from inside an interrupt handler, you use <TT CLASS="FUNCTION" >queue_task</TT >, not <TT CLASS="FUNCTION" >queue_task_irq</TT >.</P ></DD ><DT >Module Parameters</DT ><DD ><P >You no longer just declare module parameters as global variables. In 2.2 you have to also use <TT CLASS="PARAMETER" ><I >MODULE_PARM</I ></TT > 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.</P ></DD ><DT >Symmetrical Multi-Processing</DT ><DD ><P >The kernel is no longer inside one huge spinlock, which means that kernel modules have to be aware of <SPAN CLASS="ACRONYM" >SMP</SPAN >.</P ></DD ></DL ></DIV ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="c1320.htm" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="book1.htm" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="a1486.htm" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Common Pitfalls</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Where To Go From Here</TD ></TR ></TABLE ></DIV ></BODY ></HTML >