1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[]>
2 <book id="LinuxKernelAPI">
4 <title>The Linux Kernel API</title>
8 This documentation is free software; you can redistribute
9 it and/or modify it under the terms of the GNU General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later
16 This program is distributed in the hope that it will be
17 useful, but WITHOUT ANY WARRANTY; without even the implied
18 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 See the GNU General Public License for more details.
23 You should have received a copy of the GNU General Public
24 License along with this program; if not, write to the Free
25 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 For more details see the file COPYING in the source
31 distribution of Linux.
39 <title>Driver Basics</title>
40 <sect1><title>Driver Entry and Exit points</title>
41 !Iinclude/linux/init.h
44 <sect1><title>Atomic and pointer manipulation</title>
45 !Iinclude/asm-i386/atomic.h
46 !Iinclude/asm-i386/unaligned.h
50 kernel/sched.c has no docs, which stuffs up the sgml. Comment
51 out until somebody adds docs. KAO
52 <sect1><title>Delaying, scheduling, and timer routines</title>
59 <title>Data Types</title>
60 <sect1><title>Doubly Linked Lists</title>
61 !Iinclude/linux/list.h
66 <title>Basic C Library Functions</title>
69 When writing drivers, you cannot in general use routines which are
70 from the C Library. Some of the functions have been found generally
71 useful and they are listed below. The behaviour of these functions
72 may vary slightly from those defined by ANSI, and these deviations
73 are noted in the text.
76 <sect1><title>String Conversions</title>
80 <sect1><title>String Manipulation</title>
84 <sect1><title>Bit Operations</title>
85 !Iinclude/asm-i386/bitops.h
90 <title>Memory Management in Linux</title>
91 <sect1><title>The Slab Cache</title>
94 <sect1><title>User Space Memory Access</title>
95 !Iinclude/asm-i386/uaccess.h
96 !Iarch/i386/lib/usercopy.c
101 <title>The proc filesystem</title>
103 <sect1><title>sysctl interface</title>
108 <chapter id="debugfs">
109 <title>The debugfs filesystem</title>
111 <sect1><title>debugfs interface</title>
118 <title>The Linux VFS</title>
119 <sect1><title>The Directory Cache</title>
121 !Iinclude/linux/dcache.h
123 <sect1><title>Inode Handling</title>
127 <sect1><title>Registration and Superblocks</title>
130 <sect1><title>File Locks</title>
136 <chapter id="netcore">
137 <title>Linux Networking</title>
138 <sect1><title>Socket Buffer Functions</title>
139 !Iinclude/linux/skbuff.h
142 <sect1><title>Socket Filter</title>
145 <sect1><title>Generic Network Statistics</title>
146 !Iinclude/linux/gen_stats.h
147 !Enet/core/gen_stats.c
148 !Enet/core/gen_estimator.c
152 <chapter id="netdev">
153 <title>Network device support</title>
154 <sect1><title>Driver Support</title>
157 <sect1><title>8390 Based Network Cards</title>
160 <sect1><title>Synchronous PPP</title>
161 !Edrivers/net/wan/syncppp.c
165 <chapter id="modload">
166 <title>Module Support</title>
167 <sect1><title>Module Loading</title>
170 <sect1><title>Inter Module support</title>
172 Refer to the file kernel/module.c for more information.
174 <!-- FIXME: Removed for now since no structured comments in source
180 <chapter id="hardware">
181 <title>Hardware Interfaces</title>
182 <sect1><title>Interrupt Handling</title>
183 !Iarch/i386/kernel/irq.c
186 <sect1><title>MTRR Handling</title>
187 !Earch/i386/kernel/cpu/mtrr/main.c
189 <sect1><title>PCI Support Library</title>
192 <sect1><title>PCI Hotplug Support Library</title>
193 !Edrivers/pci/hotplug/pci_hotplug_core.c
195 <sect1><title>MCA Architecture</title>
196 <sect2><title>MCA Device Functions</title>
198 Refer to the file arch/i386/kernel/mca.c for more information.
200 <!-- FIXME: Removed for now since no structured comments in source
201 X!Earch/i386/kernel/mca.c
204 <sect2><title>MCA Bus DMA</title>
205 !Iinclude/asm-i386/mca_dma.h
211 <title>The Device File System</title>
215 <chapter id="security">
216 <title>Security Framework</title>
217 !Esecurity/security.c
220 <chapter id="pmfuncs">
221 <title>Power Management</title>
225 <chapter id="blkdev">
226 <title>Block Devices</title>
227 !Edrivers/block/ll_rw_blk.c
230 <chapter id="miscdev">
231 <title>Miscellaneous Devices</title>
232 !Edrivers/char/misc.c
235 <chapter id="viddev">
236 <title>Video4Linux</title>
237 !Edrivers/media/video/videodev.c
240 <chapter id="snddev">
241 <title>Sound Devices</title>
243 <!-- FIXME: Removed for now since no structured comments in source
244 X!Isound/sound_firmware.c
248 <chapter id="uart16x50">
249 <title>16x50 UART Driver</title>
250 !Edrivers/serial/serial_core.c
251 !Edrivers/serial/8250.c
254 <chapter id="z85230">
255 <title>Z85230 Support Library</title>
256 !Edrivers/net/wan/z85230.c
260 <title>Frame Buffer Library</title>
263 The frame buffer drivers depend heavily on four data structures.
264 These structures are declared in include/linux/fb.h. They are
265 fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
266 The last three can be made available to and from userland.
270 fb_info defines the current state of a particular video card.
271 Inside fb_info, there exists a fb_ops structure which is a
272 collection of needed functions to make fbdev and fbcon work.
273 fb_info is only visible to the kernel.
277 fb_var_screeninfo is used to describe the features of a video card
278 that are user defined. With fb_var_screeninfo, things such as
279 depth and the resolution may be defined.
283 The next structure is fb_fix_screeninfo. This defines the
284 properties of a card that are created when a mode is set and can't
285 be changed otherwise. A good example of this is the start of the
286 frame buffer memory. This "locks" the address of the frame buffer
287 memory, so that it cannot be changed or moved.
291 The last structure is fb_monospecs. In the old API, there was
292 little importance for fb_monospecs. This allowed for forbidden things
293 such as setting a mode of 800x600 on a fix frequency monitor. With
294 the new API, fb_monospecs prevents such things, and if used
295 correctly, can prevent a monitor from being cooked. fb_monospecs
296 will not be useful until kernels 2.5.x.
299 <sect1><title>Frame Buffer Memory</title>
300 !Edrivers/video/fbmem.c
302 <sect1><title>Frame Buffer Console</title>
303 !Edrivers/video/console/fbcon.c
305 <sect1><title>Frame Buffer Colormap</title>
306 !Edrivers/video/fbcmap.c
309 drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
310 out until somebody adds docs. KAO
311 <sect1><title>Frame Buffer Generic Functions</title>
312 X!Idrivers/video/fbgen.c
315 <sect1><title>Frame Buffer Video Mode Database</title>
316 !Idrivers/video/modedb.c
317 !Edrivers/video/modedb.c
319 <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
320 !Idrivers/video/macmodes.c
322 <sect1><title>Frame Buffer Fonts</title>
324 Refer to the file drivers/video/console/fonts.c for more information.
326 <!-- FIXME: Removed for now since no structured comments in source
327 X!Idrivers/video/console/fonts.c