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
80 <title>Data Types
</title>
81 <sect1><title>Doubly Linked Lists
</title>
82 !Iinclude/linux/list.h
87 <title>Basic C Library Functions
</title>
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.
97 <sect1><title>String Conversions
</title>
101 <sect1><title>String Manipulation
</title>
102 <!-- All functions are exported at now
107 <sect1><title>Bit Operations
</title>
108 !Iinclude/asm-i386/bitops.h
113 <title>Memory Management in Linux
</title>
114 <sect1><title>The Slab Cache
</title>
117 <sect1><title>User Space Memory Access
</title>
118 !Iinclude/asm-i386/uaccess.h
119 !Earch/i386/lib/usercopy.c
121 <sect1><title>More Memory Management Functions
</title>
122 !Iinclude/linux/rmap.h
128 !Emm/page-writeback.c
135 <title>Kernel IPC facilities
</title>
137 <sect1><title>IPC utilities
</title>
143 <title>FIFO Buffer
</title>
144 <sect1><title>kfifo interface
</title>
145 !Iinclude/linux/kfifo.h
151 <title>The proc filesystem
</title>
153 <sect1><title>sysctl interface
</title>
157 <sect1><title>proc filesystem interface
</title>
162 <chapter id=
"debugfs">
163 <title>The debugfs filesystem
</title>
165 <sect1><title>debugfs interface
</title>
172 <title>The Linux VFS
</title>
173 <sect1><title>The Filesystem types
</title>
176 <sect1><title>The Directory Cache
</title>
178 !Iinclude/linux/dcache.h
180 <sect1><title>Inode Handling
</title>
184 <sect1><title>Registration and Superblocks
</title>
187 <sect1><title>File Locks
</title>
191 <sect1><title>Other Functions
</title>
203 <chapter id=
"netcore">
204 <title>Linux Networking
</title>
205 <sect1><title>Networking Base Types
</title>
206 !Iinclude/linux/net.h
208 <sect1><title>Socket Buffer Functions
</title>
209 !Iinclude/linux/skbuff.h
214 !Enet/core/datagram.c
217 <sect1><title>Socket Filter
</title>
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
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
230 !Enet/sunrpc/svcsock.c
235 <chapter id=
"netdev">
236 <title>Network device support
</title>
237 <sect1><title>Driver Support
</title>
240 !Iinclude/linux/etherdevice.h
241 <!-- FIXME: Removed for now since no structured comments in source
242 X!Enet/core/wireless.c
245 <sect1><title>Synchronous PPP
</title>
246 !Edrivers/net/wan/syncppp.c
250 <chapter id=
"modload">
251 <title>Module Support
</title>
252 <sect1><title>Module Loading
</title>
255 <sect1><title>Inter Module support
</title>
257 Refer to the file kernel/module.c for more information.
259 <!-- FIXME: Removed for now since no structured comments in source
265 <chapter id=
"hardware">
266 <title>Hardware Interfaces
</title>
267 <sect1><title>Interrupt Handling
</title>
268 !Ekernel/irq/manage.c
271 <sect1><title>Resources Management
</title>
275 <sect1><title>MTRR Handling
</title>
276 !Earch/i386/kernel/cpu/mtrr/main.c
278 <sect1><title>PCI Support Library
</title>
280 !Edrivers/pci/pci-driver.c
281 !Edrivers/pci/remove.c
282 !Edrivers/pci/pci-acpi.c
283 <!-- kerneldoc does not understand to __devinit
284 X!Edrivers/pci/search.c
288 <!-- FIXME: Removed for now since no structured comments in source
289 X!Edrivers/pci/hotplug.c
291 !Edrivers/pci/probe.c
294 <sect1><title>PCI Hotplug Support Library
</title>
295 !Edrivers/pci/hotplug/pci_hotplug_core.c
297 <sect1><title>MCA Architecture
</title>
298 <sect2><title>MCA Device Functions
</title>
300 Refer to the file arch/i386/kernel/mca.c for more information.
302 <!-- FIXME: Removed for now since no structured comments in source
303 X!Earch/i386/kernel/mca.c
306 <sect2><title>MCA Bus DMA
</title>
307 !Iinclude/asm-i386/mca_dma.h
313 <title>The Device File System
</title>
318 <title>The Filesystem for Exporting Kernel Objects
</title>
325 <chapter id=
"security">
326 <title>Security Framework
</title>
327 !Esecurity/security.c
330 <chapter id=
"pmfuncs">
331 <title>Power Management
</title>
335 <chapter id=
"devdrivers">
336 <title>Device drivers infrastructure
</title>
337 <sect1><title>Device Drivers Base
</title>
339 X!Iinclude/linux/device.h
341 !Edrivers/base/driver.c
342 !Edrivers/base/core.c
343 !Edrivers/base/firmware_class.c
344 !Edrivers/base/transport_class.c
345 !Edrivers/base/dmapool.c
346 <!-- Cannot be included, because
347 attribute_container_add_class_device_adapter
348 and attribute_container_classdev_to_container
349 exceed allowed 44 characters maximum
350 X!Edrivers/base/attribute_container.c
354 X!Edrivers/base/interface.c
356 !Edrivers/base/platform.c
359 <sect1><title>Device Drivers Power Management
</title>
360 !Edrivers/base/power/main.c
361 !Edrivers/base/power/resume.c
362 !Edrivers/base/power/suspend.c
364 <sect1><title>Device Drivers ACPI Support
</title>
365 <!-- Internal functions only
366 X!Edrivers/acpi/sleep/main.c
367 X!Edrivers/acpi/sleep/wakeup.c
368 X!Edrivers/acpi/motherboard.c
369 X!Edrivers/acpi/bus.c
371 !Edrivers/acpi/scan.c
372 <!-- No correct structured comments
373 X!Edrivers/acpi/pci_bind.c
376 <sect1><title>Device drivers PnP support
</title>
378 <!-- No correct structured comments
379 X!Edrivers/pnp/system.c
382 !Edrivers/pnp/driver.c
383 !Edrivers/pnp/manager.c
384 !Edrivers/pnp/support.c
389 <chapter id=
"blkdev">
390 <title>Block Devices
</title>
394 <chapter id=
"miscdev">
395 <title>Miscellaneous Devices
</title>
396 !Edrivers/char/misc.c
399 <chapter id=
"viddev">
400 <title>Video4Linux
</title>
401 !Edrivers/media/video/videodev.c
404 <chapter id=
"snddev">
405 <title>Sound Devices
</title>
406 !Iinclude/sound/core.h
408 !Iinclude/sound/pcm.h
410 !Esound/core/device.c
412 !Esound/core/rawmidi.c
414 !Esound/core/memory.c
415 !Esound/core/pcm_memory.c
417 !Esound/core/isadma.c
418 !Esound/core/control.c
419 !Esound/core/pcm_lib.c
421 !Esound/core/pcm_native.c
422 !Esound/core/memalloc.c
423 <!-- FIXME: Removed for now since no structured comments in source
424 X!Isound/sound_firmware.c
428 <chapter id=
"uart16x50">
429 <title>16x50 UART Driver
</title>
430 !Iinclude/linux/serial_core.h
431 !Edrivers/serial/serial_core.c
432 !Edrivers/serial/
8250.c
435 <chapter id=
"z85230">
436 <title>Z85230 Support Library
</title>
437 !Edrivers/net/wan/z85230.c
441 <title>Frame Buffer Library
</title>
444 The frame buffer drivers depend heavily on four data structures.
445 These structures are declared in include/linux/fb.h. They are
446 fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
447 The last three can be made available to and from userland.
451 fb_info defines the current state of a particular video card.
452 Inside fb_info, there exists a fb_ops structure which is a
453 collection of needed functions to make fbdev and fbcon work.
454 fb_info is only visible to the kernel.
458 fb_var_screeninfo is used to describe the features of a video card
459 that are user defined. With fb_var_screeninfo, things such as
460 depth and the resolution may be defined.
464 The next structure is fb_fix_screeninfo. This defines the
465 properties of a card that are created when a mode is set and can't
466 be changed otherwise. A good example of this is the start of the
467 frame buffer memory. This
"locks" the address of the frame buffer
468 memory, so that it cannot be changed or moved.
472 The last structure is fb_monospecs. In the old API, there was
473 little importance for fb_monospecs. This allowed for forbidden things
474 such as setting a mode of
800x600 on a fix frequency monitor. With
475 the new API, fb_monospecs prevents such things, and if used
476 correctly, can prevent a monitor from being cooked. fb_monospecs
477 will not be useful until kernels
2.5.x.
480 <sect1><title>Frame Buffer Memory
</title>
481 !Edrivers/video/fbmem.c
484 <sect1><title>Frame Buffer Console</title>
485 X!Edrivers/video/console/fbcon.c
488 <sect1><title>Frame Buffer Colormap
</title>
489 !Edrivers/video/fbcmap.c
492 drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
493 out until somebody adds docs. KAO
494 <sect1><title>Frame Buffer Generic Functions</title>
495 X!Idrivers/video/fbgen.c
498 <sect1><title>Frame Buffer Video Mode Database
</title>
499 !Idrivers/video/modedb.c
500 !Edrivers/video/modedb.c
502 <sect1><title>Frame Buffer Macintosh Video Mode Database
</title>
503 !Edrivers/video/macmodes.c
505 <sect1><title>Frame Buffer Fonts
</title>
507 Refer to the file drivers/video/console/fonts.c for more information.
509 <!-- FIXME: Removed for now since no structured comments in source
510 X!Idrivers/video/console/fonts.c