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