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" []>
5 <book id="LinuxKernelAPI">
7 <title>The Linux Kernel API</title>
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
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.
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,
33 For more details see the file COPYING in the source
34 distribution of Linux.
42 <title>Driver Basics</title>
43 <sect1><title>Driver Entry and Exit points</title>
44 !Iinclude/linux/init.h
47 <sect1><title>Atomic and pointer manipulation</title>
48 !Iinclude/asm-i386/atomic.h
49 !Iinclude/asm-i386/unaligned.h
52 <sect1><title>Delaying, scheduling, and timer routines</title>
53 !Iinclude/linux/sched.h
57 <sect1><title>Internal Functions</title>
62 <sect1><title>Kernel objects manipulation</title>
64 X!Iinclude/linux/kobject.h
69 <sect1><title>Kernel utility functions</title>
70 !Iinclude/linux/kernel.h
71 <!-- This needs to clean up to make kernel-doc happy
82 <title>Data Types</title>
83 <sect1><title>Doubly Linked Lists</title>
84 !Iinclude/linux/list.h
89 <title>Basic C Library Functions</title>
92 When writing drivers, you cannot in general use routines which are
93 from the C Library. Some of the functions have been found generally
94 useful and they are listed below. The behaviour of these functions
95 may vary slightly from those defined by ANSI, and these deviations
96 are noted in the text.
99 <sect1><title>String Conversions</title>
103 <sect1><title>String Manipulation</title>
104 <!-- All functions are exported at now
109 <sect1><title>Bit Operations</title>
110 !Iinclude/asm-i386/bitops.h
115 <title>Memory Management in Linux</title>
116 <sect1><title>The Slab Cache</title>
119 <sect1><title>User Space Memory Access</title>
120 !Iinclude/asm-i386/uaccess.h
121 !Iarch/i386/lib/usercopy.c
123 <sect1><title>More Memory Management Functions</title>
124 !Iinclude/linux/rmap.h
130 !Emm/page-writeback.c
137 <title>Kernel IPC facilities</title>
139 <sect1><title>IPC utilities</title>
145 <title>FIFO Buffer</title>
146 <sect1><title>kfifo interface</title>
147 !Iinclude/linux/kfifo.h
153 <title>The proc filesystem</title>
155 <sect1><title>sysctl interface</title>
159 <sect1><title>proc filesystem interface</title>
164 <chapter id="debugfs">
165 <title>The debugfs filesystem</title>
167 <sect1><title>debugfs interface</title>
174 <title>The Linux VFS</title>
175 <sect1><title>The Filesystem types</title>
179 <sect1><title>The Directory Cache</title>
181 !Iinclude/linux/dcache.h
183 <sect1><title>Inode Handling</title>
187 <sect1><title>Registration and Superblocks</title>
190 <sect1><title>File Locks</title>
194 <sect1><title>Other Functions</title>
206 <chapter id="netcore">
207 <title>Linux Networking</title>
208 <sect1><title>Networking Base Types</title>
209 !Iinclude/linux/net.h
211 <sect1><title>Socket Buffer Functions</title>
212 !Iinclude/linux/skbuff.h
217 !Enet/core/datagram.c
220 <sect1><title>Socket Filter</title>
223 <sect1><title>Generic Network Statistics</title>
224 !Iinclude/linux/gen_stats.h
225 !Enet/core/gen_stats.c
226 !Enet/core/gen_estimator.c
228 <sect1><title>SUN RPC subsystem</title>
229 <!-- The !D functionality is not perfect, garbage has to be protected by comments
230 !Dnet/sunrpc/sunrpc_syms.c
233 !Enet/sunrpc/svcsock.c
238 <chapter id="netdev">
239 <title>Network device support</title>
240 <sect1><title>Driver Support</title>
243 <sect1><title>8390 Based Network Cards</title>
246 <sect1><title>Synchronous PPP</title>
247 !Edrivers/net/wan/syncppp.c
251 <chapter id="modload">
252 <title>Module Support</title>
253 <sect1><title>Module Loading</title>
256 <sect1><title>Inter Module support</title>
258 Refer to the file kernel/module.c for more information.
260 <!-- FIXME: Removed for now since no structured comments in source
266 <chapter id="hardware">
267 <title>Hardware Interfaces</title>
268 <sect1><title>Interrupt Handling</title>
269 !Ikernel/irq/manage.c
272 <sect1><title>Resources Management</title>
276 <sect1><title>MTRR Handling</title>
277 !Earch/i386/kernel/cpu/mtrr/main.c
279 <sect1><title>PCI Support Library</title>
281 !Edrivers/pci/pci-driver.c
282 !Edrivers/pci/remove.c
283 !Edrivers/pci/pci-acpi.c
284 <!-- kerneldoc does not understand to __devinit
285 X!Edrivers/pci/search.c
289 !Edrivers/pci/hotplug.c
290 !Edrivers/pci/probe.c
293 <sect1><title>PCI Hotplug Support Library</title>
294 !Edrivers/pci/hotplug/pci_hotplug_core.c
296 <sect1><title>MCA Architecture</title>
297 <sect2><title>MCA Device Functions</title>
299 Refer to the file arch/i386/kernel/mca.c for more information.
301 <!-- FIXME: Removed for now since no structured comments in source
302 X!Earch/i386/kernel/mca.c
305 <sect2><title>MCA Bus DMA</title>
306 !Iinclude/asm-i386/mca_dma.h
312 <title>The Device File System</title>
317 <title>The Filesystem for Exporting Kernel Objects</title>
324 <chapter id="security">
325 <title>Security Framework</title>
326 !Esecurity/security.c
329 <chapter id="pmfuncs">
330 <title>Power Management</title>
334 <chapter id="devdrivers">
335 <title>Device drivers infrastructure</title>
336 <sect1><title>Device Drivers Base</title>
338 X!Iinclude/linux/device.h
340 !Edrivers/base/driver.c
341 !Edrivers/base/core.c
342 !Edrivers/base/firmware_class.c
343 !Edrivers/base/transport_class.c
344 !Edrivers/base/dmapool.c
345 <!-- Cannot be included, because
346 attribute_container_add_class_device_adapter
347 and attribute_container_classdev_to_container
348 exceed allowed 44 characters maximum
349 X!Edrivers/base/attribute_container.c
353 X!Edrivers/base/interface.c
355 !Edrivers/base/platform.c
358 <sect1><title>Device Drivers Power Management</title>
359 !Edrivers/base/power/main.c
360 !Edrivers/base/power/resume.c
361 !Edrivers/base/power/suspend.c
363 <sect1><title>Device Drivers ACPI Support</title>
364 <!-- Internal functions only
365 X!Edrivers/acpi/sleep/main.c
366 X!Edrivers/acpi/sleep/wakeup.c
367 X!Edrivers/acpi/motherboard.c
368 X!Edrivers/acpi/bus.c
370 !Edrivers/acpi/scan.c
371 <!-- No correct structured comments
372 X!Edrivers/acpi/pci_bind.c
375 <sect1><title>Device drivers PnP support</title>
377 <!-- No correct structured comments
378 X!Edrivers/pnp/system.c
381 !Edrivers/pnp/driver.c
382 !Edrivers/pnp/manager.c
383 !Edrivers/pnp/support.c
388 <chapter id="blkdev">
389 <title>Block Devices</title>
390 !Edrivers/block/ll_rw_blk.c
393 <chapter id="miscdev">
394 <title>Miscellaneous Devices</title>
395 !Edrivers/char/misc.c
398 <chapter id="viddev">
399 <title>Video4Linux</title>
400 !Edrivers/media/video/videodev.c
403 <chapter id="snddev">
404 <title>Sound Devices</title>
405 !Iinclude/sound/core.h
407 !Iinclude/sound/pcm.h
409 !Esound/core/device.c
411 !Esound/core/rawmidi.c
413 !Esound/core/memory.c
414 !Esound/core/pcm_memory.c
416 !Esound/core/isadma.c
417 !Esound/core/control.c
418 !Esound/core/pcm_lib.c
420 !Esound/core/pcm_native.c
421 !Esound/core/memalloc.c
422 <!-- FIXME: Removed for now since no structured comments in source
423 X!Isound/sound_firmware.c
427 <chapter id="uart16x50">
428 <title>16x50 UART Driver</title>
429 !Iinclude/linux/serial_core.h
430 !Edrivers/serial/serial_core.c
431 !Edrivers/serial/8250.c
434 <chapter id="z85230">
435 <title>Z85230 Support Library</title>
436 !Edrivers/net/wan/z85230.c
440 <title>Frame Buffer Library</title>
443 The frame buffer drivers depend heavily on four data structures.
444 These structures are declared in include/linux/fb.h. They are
445 fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
446 The last three can be made available to and from userland.
450 fb_info defines the current state of a particular video card.
451 Inside fb_info, there exists a fb_ops structure which is a
452 collection of needed functions to make fbdev and fbcon work.
453 fb_info is only visible to the kernel.
457 fb_var_screeninfo is used to describe the features of a video card
458 that are user defined. With fb_var_screeninfo, things such as
459 depth and the resolution may be defined.
463 The next structure is fb_fix_screeninfo. This defines the
464 properties of a card that are created when a mode is set and can't
465 be changed otherwise. A good example of this is the start of the
466 frame buffer memory. This "locks" the address of the frame buffer
467 memory, so that it cannot be changed or moved.
471 The last structure is fb_monospecs. In the old API, there was
472 little importance for fb_monospecs. This allowed for forbidden things
473 such as setting a mode of 800x600 on a fix frequency monitor. With
474 the new API, fb_monospecs prevents such things, and if used
475 correctly, can prevent a monitor from being cooked. fb_monospecs
476 will not be useful until kernels 2.5.x.
479 <sect1><title>Frame Buffer Memory</title>
480 !Edrivers/video/fbmem.c
483 <sect1><title>Frame Buffer Console</title>
484 X!Edrivers/video/console/fbcon.c
487 <sect1><title>Frame Buffer Colormap</title>
488 !Edrivers/video/fbcmap.c
491 drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
492 out until somebody adds docs. KAO
493 <sect1><title>Frame Buffer Generic Functions</title>
494 X!Idrivers/video/fbgen.c
497 <sect1><title>Frame Buffer Video Mode Database</title>
498 !Idrivers/video/modedb.c
499 !Edrivers/video/modedb.c
501 <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
502 !Idrivers/video/macmodes.c
504 <sect1><title>Frame Buffer Fonts</title>
506 Refer to the file drivers/video/console/fonts.c for more information.
508 <!-- FIXME: Removed for now since no structured comments in source
509 X!Idrivers/video/console/fonts.c