Merge with http://kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[pandora-kernel.git] / Documentation / DocBook / kernel-api.tmpl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3         "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5 <book id="LinuxKernelAPI">
6  <bookinfo>
7   <title>The Linux Kernel API</title>
8   
9   <legalnotice>
10    <para>
11      This documentation is free software; you can redistribute
12      it and/or modify it under the terms of the GNU General Public
13      License as published by the Free Software Foundation; either
14      version 2 of the License, or (at your option) any later
15      version.
16    </para>
17       
18    <para>
19      This program is distributed in the hope that it will be
20      useful, but WITHOUT ANY WARRANTY; without even the implied
21      warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22      See the GNU General Public License for more details.
23    </para>
24       
25    <para>
26      You should have received a copy of the GNU General Public
27      License along with this program; if not, write to the Free
28      Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29      MA 02111-1307 USA
30    </para>
31       
32    <para>
33      For more details see the file COPYING in the source
34      distribution of Linux.
35    </para>
36   </legalnotice>
37  </bookinfo>
38
39 <toc></toc>
40
41   <chapter id="Basics">
42      <title>Driver Basics</title>
43      <sect1><title>Driver Entry and Exit points</title>
44 !Iinclude/linux/init.h
45      </sect1>
46
47      <sect1><title>Atomic and pointer manipulation</title>
48 !Iinclude/asm-i386/atomic.h
49 !Iinclude/asm-i386/unaligned.h
50      </sect1>
51
52      <sect1><title>Delaying, scheduling, and timer routines</title>
53 !Iinclude/linux/sched.h
54 !Ekernel/sched.c
55 !Ekernel/timer.c
56      </sect1>
57      <sect1><title>Internal Functions</title>
58 !Ikernel/exit.c
59 !Ikernel/signal.c
60      </sect1>
61
62      <sect1><title>Kernel objects manipulation</title>
63 <!--
64 X!Iinclude/linux/kobject.h
65 -->
66 !Elib/kobject.c
67      </sect1>
68
69      <sect1><title>Kernel utility functions</title>
70 !Iinclude/linux/kernel.h
71 !Ekernel/printk.c
72 !Ekernel/panic.c
73 !Ekernel/sys.c
74 !Ekernel/rcupdate.c
75      </sect1>
76
77   </chapter>
78
79   <chapter id="adt">
80      <title>Data Types</title>
81      <sect1><title>Doubly Linked Lists</title>
82 !Iinclude/linux/list.h
83      </sect1>
84   </chapter>
85
86   <chapter id="libc">
87      <title>Basic C Library Functions</title>
88
89      <para>
90        When writing drivers, you cannot in general use routines which are
91        from the C Library.  Some of the functions have been found generally
92        useful and they are listed below.  The behaviour of these functions
93        may vary slightly from those defined by ANSI, and these deviations
94        are noted in the text.
95      </para>
96
97      <sect1><title>String Conversions</title>
98 !Ilib/vsprintf.c
99 !Elib/vsprintf.c
100      </sect1>
101      <sect1><title>String Manipulation</title>
102 <!-- All functions are exported at now
103 X!Ilib/string.c
104  -->
105 !Elib/string.c
106      </sect1>
107      <sect1><title>Bit Operations</title>
108 !Iinclude/asm-i386/bitops.h
109      </sect1>
110   </chapter>
111
112   <chapter id="mm">
113      <title>Memory Management in Linux</title>
114      <sect1><title>The Slab Cache</title>
115 !Emm/slab.c
116      </sect1>
117      <sect1><title>User Space Memory Access</title>
118 !Iinclude/asm-i386/uaccess.h
119 !Earch/i386/lib/usercopy.c
120      </sect1>
121      <sect1><title>More Memory Management Functions</title>
122 !Iinclude/linux/rmap.h
123 !Emm/readahead.c
124 !Emm/filemap.c
125 !Emm/memory.c
126 !Emm/vmalloc.c
127 !Emm/mempool.c
128 !Emm/page-writeback.c
129 !Emm/truncate.c
130      </sect1>
131   </chapter>
132
133
134   <chapter id="ipc">
135      <title>Kernel IPC facilities</title>
136
137      <sect1><title>IPC utilities</title>
138 !Iipc/util.c
139      </sect1>
140   </chapter>
141
142   <chapter id="kfifo">
143      <title>FIFO Buffer</title>
144      <sect1><title>kfifo interface</title>
145 !Iinclude/linux/kfifo.h
146 !Ekernel/kfifo.c
147      </sect1>
148   </chapter>
149
150   <chapter id="proc">
151      <title>The proc filesystem</title>
152  
153      <sect1><title>sysctl interface</title>
154 !Ekernel/sysctl.c
155      </sect1>
156
157      <sect1><title>proc filesystem interface</title>
158 !Ifs/proc/base.c
159      </sect1>
160   </chapter>
161
162   <chapter id="debugfs">
163      <title>The debugfs filesystem</title>
164  
165      <sect1><title>debugfs interface</title>
166 !Efs/debugfs/inode.c
167 !Efs/debugfs/file.c
168      </sect1>
169   </chapter>
170
171   <chapter id="vfs">
172      <title>The Linux VFS</title>
173      <sect1><title>The Filesystem types</title>
174 !Iinclude/linux/fs.h
175      </sect1>
176      <sect1><title>The Directory Cache</title>
177 !Efs/dcache.c
178 !Iinclude/linux/dcache.h
179      </sect1>
180      <sect1><title>Inode Handling</title>
181 !Efs/inode.c
182 !Efs/bad_inode.c
183      </sect1>
184      <sect1><title>Registration and Superblocks</title>
185 !Efs/super.c
186      </sect1>
187      <sect1><title>File Locks</title>
188 !Efs/locks.c
189 !Ifs/locks.c
190      </sect1>
191      <sect1><title>Other Functions</title>
192 !Efs/mpage.c
193 !Efs/namei.c
194 !Efs/buffer.c
195 !Efs/bio.c
196 !Efs/seq_file.c
197 !Efs/filesystems.c
198 !Efs/fs-writeback.c
199 !Efs/block_dev.c
200      </sect1>
201   </chapter>
202
203   <chapter id="netcore">
204      <title>Linux Networking</title>
205      <sect1><title>Networking Base Types</title>
206 !Iinclude/linux/net.h
207      </sect1>
208      <sect1><title>Socket Buffer Functions</title>
209 !Iinclude/linux/skbuff.h
210 !Iinclude/net/sock.h
211 !Enet/socket.c
212 !Enet/core/skbuff.c
213 !Enet/core/sock.c
214 !Enet/core/datagram.c
215 !Enet/core/stream.c
216      </sect1>
217      <sect1><title>Socket Filter</title>
218 !Enet/core/filter.c
219      </sect1>
220      <sect1><title>Generic Network Statistics</title>
221 !Iinclude/linux/gen_stats.h
222 !Enet/core/gen_stats.c
223 !Enet/core/gen_estimator.c
224      </sect1>
225      <sect1><title>SUN RPC subsystem</title>
226 <!-- The !D functionality is not perfect, garbage has to be protected by comments
227 !Dnet/sunrpc/sunrpc_syms.c
228 -->
229 !Enet/sunrpc/xdr.c
230 !Enet/sunrpc/svcsock.c
231 !Enet/sunrpc/sched.c
232      </sect1>
233   </chapter>
234
235   <chapter id="netdev">
236      <title>Network device support</title>
237      <sect1><title>Driver Support</title>
238 !Enet/core/dev.c
239 !Enet/ethernet/eth.c
240 !Einclude/linux/etherdevice.h
241 !Enet/core/wireless.c
242      </sect1>
243      <sect1><title>Synchronous PPP</title>
244 !Edrivers/net/wan/syncppp.c
245      </sect1>
246   </chapter>
247
248   <chapter id="modload">
249      <title>Module Support</title>
250      <sect1><title>Module Loading</title>
251 !Ekernel/kmod.c
252      </sect1>
253      <sect1><title>Inter Module support</title>
254         <para>
255            Refer to the file kernel/module.c for more information.
256         </para>
257 <!-- FIXME: Removed for now since no structured comments in source
258 X!Ekernel/module.c
259 -->
260      </sect1>
261   </chapter>
262
263   <chapter id="hardware">
264      <title>Hardware Interfaces</title>
265      <sect1><title>Interrupt Handling</title>
266 !Ekernel/irq/manage.c
267      </sect1>
268
269      <sect1><title>Resources Management</title>
270 !Ekernel/resource.c
271      </sect1>
272
273      <sect1><title>MTRR Handling</title>
274 !Earch/i386/kernel/cpu/mtrr/main.c
275      </sect1>
276      <sect1><title>PCI Support Library</title>
277 !Edrivers/pci/pci.c
278 !Edrivers/pci/pci-driver.c
279 !Edrivers/pci/remove.c
280 !Edrivers/pci/pci-acpi.c
281 <!-- kerneldoc does not understand to __devinit
282 X!Edrivers/pci/search.c
283  -->
284 !Edrivers/pci/msi.c
285 !Edrivers/pci/bus.c
286 <!-- FIXME: Removed for now since no structured comments in source
287 X!Edrivers/pci/hotplug.c
288 -->
289 !Edrivers/pci/probe.c
290 !Edrivers/pci/rom.c
291      </sect1>
292      <sect1><title>PCI Hotplug Support Library</title>
293 !Edrivers/pci/hotplug/pci_hotplug_core.c
294      </sect1>
295      <sect1><title>MCA Architecture</title>
296         <sect2><title>MCA Device Functions</title>
297            <para>
298               Refer to the file arch/i386/kernel/mca.c for more information.
299            </para>
300 <!-- FIXME: Removed for now since no structured comments in source
301 X!Earch/i386/kernel/mca.c
302 -->
303         </sect2>
304         <sect2><title>MCA Bus DMA</title>
305 !Iinclude/asm-i386/mca_dma.h
306         </sect2>
307      </sect1>
308   </chapter>
309
310   <chapter id="devfs">
311      <title>The Device File System</title>
312 !Efs/devfs/base.c
313   </chapter>
314
315   <chapter id="sysfs">
316      <title>The Filesystem for Exporting Kernel Objects</title>
317 !Efs/sysfs/file.c
318 !Efs/sysfs/dir.c
319 !Efs/sysfs/symlink.c
320 !Efs/sysfs/bin.c
321   </chapter>
322
323   <chapter id="security">
324      <title>Security Framework</title>
325 !Esecurity/security.c
326   </chapter>
327
328   <chapter id="pmfuncs">
329      <title>Power Management</title>
330 !Ekernel/power/pm.c
331   </chapter>
332
333   <chapter id="devdrivers">
334      <title>Device drivers infrastructure</title>
335      <sect1><title>Device Drivers Base</title>
336 <!--
337 X!Iinclude/linux/device.h
338 -->
339 !Edrivers/base/driver.c
340 !Edrivers/base/core.c
341 !Edrivers/base/firmware_class.c
342 !Edrivers/base/transport_class.c
343 !Edrivers/base/dmapool.c
344 <!-- Cannot be included, because
345      attribute_container_add_class_device_adapter
346  and attribute_container_classdev_to_container
347      exceed allowed 44 characters maximum
348 X!Edrivers/base/attribute_container.c
349 -->
350 !Edrivers/base/sys.c
351 <!--
352 X!Edrivers/base/interface.c
353 -->
354 !Edrivers/base/platform.c
355 !Edrivers/base/bus.c
356      </sect1>
357      <sect1><title>Device Drivers Power Management</title>
358 !Edrivers/base/power/main.c
359 !Edrivers/base/power/resume.c
360 !Edrivers/base/power/suspend.c
361      </sect1>
362      <sect1><title>Device Drivers ACPI Support</title>
363 <!-- Internal functions only
364 X!Edrivers/acpi/sleep/main.c
365 X!Edrivers/acpi/sleep/wakeup.c
366 X!Edrivers/acpi/motherboard.c
367 X!Edrivers/acpi/bus.c
368 -->
369 !Edrivers/acpi/scan.c
370 <!-- No correct structured comments
371 X!Edrivers/acpi/pci_bind.c
372 -->
373      </sect1>
374      <sect1><title>Device drivers PnP support</title>
375 !Edrivers/pnp/core.c
376 <!-- No correct structured comments
377 X!Edrivers/pnp/system.c
378  -->
379 !Edrivers/pnp/card.c
380 !Edrivers/pnp/driver.c
381 !Edrivers/pnp/manager.c
382 !Edrivers/pnp/support.c
383      </sect1>
384   </chapter>
385
386
387   <chapter id="blkdev">
388      <title>Block Devices</title>
389 !Eblock/ll_rw_blk.c
390   </chapter>
391
392   <chapter id="miscdev">
393      <title>Miscellaneous Devices</title>
394 !Edrivers/char/misc.c
395   </chapter>
396
397   <chapter id="viddev">
398      <title>Video4Linux</title>
399 !Edrivers/media/video/videodev.c
400   </chapter>
401
402   <chapter id="snddev">
403      <title>Sound Devices</title>
404 !Iinclude/sound/core.h
405 !Esound/sound_core.c
406 !Iinclude/sound/pcm.h
407 !Esound/core/pcm.c
408 !Esound/core/device.c
409 !Esound/core/info.c
410 !Esound/core/rawmidi.c
411 !Esound/core/sound.c
412 !Esound/core/memory.c
413 !Esound/core/pcm_memory.c
414 !Esound/core/init.c
415 !Esound/core/isadma.c
416 !Esound/core/control.c
417 !Esound/core/pcm_lib.c
418 !Esound/core/hwdep.c
419 !Esound/core/pcm_native.c
420 !Esound/core/memalloc.c
421 <!-- FIXME: Removed for now since no structured comments in source
422 X!Isound/sound_firmware.c
423 -->
424   </chapter>
425
426   <chapter id="uart16x50">
427      <title>16x50 UART Driver</title>
428 !Iinclude/linux/serial_core.h
429 !Edrivers/serial/serial_core.c
430 !Edrivers/serial/8250.c
431   </chapter>
432
433   <chapter id="z85230">
434      <title>Z85230 Support Library</title>
435 !Edrivers/net/wan/z85230.c
436   </chapter>
437
438   <chapter id="fbdev">
439      <title>Frame Buffer Library</title>
440
441      <para>
442        The frame buffer drivers depend heavily on four data structures.  
443        These structures are declared in include/linux/fb.h.  They are 
444        fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. 
445        The last three can be made available to and from userland. 
446      </para>
447
448      <para>
449        fb_info defines the current state of a particular video card. 
450        Inside fb_info, there exists a fb_ops structure which is a 
451        collection of needed functions to make fbdev and fbcon work.
452        fb_info is only visible to the kernel.
453      </para>
454
455      <para>
456        fb_var_screeninfo is used to describe the features of a video card 
457        that are user defined.  With fb_var_screeninfo, things such as
458        depth and the resolution may be defined.
459      </para>
460
461      <para>
462        The next structure is fb_fix_screeninfo. This defines the 
463        properties of a card that are created when a mode is set and can't 
464        be changed otherwise.  A good example of this is the start of the 
465        frame buffer memory.  This "locks" the address of the frame buffer
466        memory, so that it cannot be changed or moved.
467      </para>
468
469      <para>
470        The last structure is fb_monospecs. In the old API, there was 
471        little importance for fb_monospecs. This allowed for forbidden things 
472        such as setting a mode of 800x600 on a fix frequency monitor. With 
473        the new API, fb_monospecs prevents such things, and if used 
474        correctly, can prevent a monitor from being cooked.  fb_monospecs
475        will not be useful until kernels 2.5.x.
476      </para>
477
478      <sect1><title>Frame Buffer Memory</title>
479 !Edrivers/video/fbmem.c
480      </sect1>
481 <!--
482      <sect1><title>Frame Buffer Console</title>
483 X!Edrivers/video/console/fbcon.c
484      </sect1>
485 -->
486      <sect1><title>Frame Buffer Colormap</title>
487 !Edrivers/video/fbcmap.c
488      </sect1>
489 <!-- FIXME:
490   drivers/video/fbgen.c has no docs, which stuffs up the sgml.  Comment
491   out until somebody adds docs.  KAO
492      <sect1><title>Frame Buffer Generic Functions</title>
493 X!Idrivers/video/fbgen.c
494      </sect1>
495 KAO -->
496      <sect1><title>Frame Buffer Video Mode Database</title>
497 !Idrivers/video/modedb.c
498 !Edrivers/video/modedb.c
499      </sect1>
500      <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
501 !Edrivers/video/macmodes.c
502      </sect1>
503      <sect1><title>Frame Buffer Fonts</title>
504         <para>
505            Refer to the file drivers/video/console/fonts.c for more information.
506         </para>
507 <!-- FIXME: Removed for now since no structured comments in source
508 X!Idrivers/video/console/fonts.c
509 -->
510      </sect1>
511   </chapter>
512 </book>