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