📄 node28.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.1 release (February 19th, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Changes between 2.0 and 2.2</TITLE>
<META NAME="description" CONTENT="Changes between 2.0 and 2.2">
<META NAME="keywords" CONTENT="mpg">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="mpg.css">
<LINK REL="next" HREF="node29.html">
<LINK REL="previous" HREF="node27.html">
<LINK REL="up" HREF="mpg.html">
<LINK REL="next" HREF="node29.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html718"
HREF="node29.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next_motif.gif"></A>
<A NAME="tex2html714"
HREF="mpg.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up_motif.gif"></A>
<A NAME="tex2html708"
HREF="node27.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="previous_motif.gif"></A>
<A NAME="tex2html716"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents_motif.gif"></A>
<A NAME="tex2html717"
HREF="node34.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index_motif.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html719"
HREF="node29.html">Where From Here?</A>
<B> Up:</B> <A NAME="tex2html715"
HREF="mpg.html">Linux Kernel Module Programming</A>
<B> Previous:</B> <A NAME="tex2html709"
HREF="node27.html">Common Pitfalls</A>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION001600000000000000000"> </A><A NAME="ver-changes"> </A><A NAME="741"> </A><A NAME="742"> </A>
<BR>
Changes between 2.0 and 2.2
</H1>
<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>
An additional resource for people who wish to convert to 2.2 is in
<TT>http://www.atnf.csiro.au/~ rgooch/linux/docs/porting-to-2.2.html</TT>.
<P>
<DL COMPACT>
<DD><P>
<DT>1.
<DD><B>asm/uaccess.h</B> If you need <TT>put_user</TT>
or <TT>get_user</TT> you have to #include it.
<A NAME="748"> </A><A NAME="749"> </A>
<A NAME="750"> </A><A NAME="751"> </A>
<P>
<DT>2.
<DD><B>get_user</B> In version 2.2, <TT>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>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>
<DT>3.
<DD><B>file_operations</B> This structure now has a flush function between
the <TT>open</TT> and <TT>close</TT> functions.
<A NAME="758"> </A><A NAME="759"> </A>
<P>
<DT>4.
<DD><B>close in file_operations</B> In version 2.2, the close
function returns an integer, so it's allowed to fail.
<A NAME="761"> </A>
<P>
<DT>5.
<DD><B>read and write in file_operations</B> The headers
for these functions changed. They now return <TT>ssize_t</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.
<A NAME="764"> </A><A NAME="765"> </A><A NAME="766"> </A>
<P>
<DT>6.
<DD><B>proc_register_dynamic</B> This function no longer exists. Instead,
you call the regular <TT>proc_register</TT> and put zero in the inode
field of the structure.
<A NAME="769"> </A><A NAME="770"> </A>
<P>
<DT>7.
<DD><B>Signals</B> The signals in the task structure are no longer a 32 bit
integer, but an array of <TT>_NSIG_WORDS</TT> integers.
<A NAME="773"> </A><A NAME="774"> </A>
<P>
<DT>8.
<DD><B>queue_task_irq</B> Even if you want to scheduale a task to happen
from inside an interrupt handler, you use <TT>queue_task</TT>, not
<TT>queue_task_irq</TT>.
<A NAME="778"> </A><A NAME="779"> </A><A NAME="780"> </A>
<A NAME="781"> </A>
<P>
<DT>9.
<DD><B>Module Parameters</B> You no longer just declare module parameters
as global variables. In 2.2 you have to also use <TT>MODULE_PARM</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.
<A NAME="784"> </A><A NAME="785"> </A>
<A NAME="786"> </A>
<P>
<DT>10.
<DD><B>Symmetrical Multi-Processing</B> The kernel is no longer inside one
huge spinlock, which means that kernel modules have to be aware of
SMP.
<A NAME="788"> </A><A NAME="789"> </A>
<P>
</DL>
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html718"
HREF="node29.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next_motif.gif"></A>
<A NAME="tex2html714"
HREF="mpg.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up_motif.gif"></A>
<A NAME="tex2html708"
HREF="node27.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="previous_motif.gif"></A>
<A NAME="tex2html716"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents_motif.gif"></A>
<A NAME="tex2html717"
HREF="node34.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index_motif.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html719"
HREF="node29.html">Where From Here?</A>
<B> Up:</B> <A NAME="tex2html715"
HREF="mpg.html">Linux Kernel Module Programming</A>
<B> Previous:</B> <A NAME="tex2html709"
HREF="node27.html">Common Pitfalls</A>
<!--End of Navigation Panel-->
<ADDRESS>
<I></I>
<BR><I>1999-05-19</I>
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -