at v2.6.14 13 kB view raw
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<!-- 64X!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<!-- This needs to clean up to make kernel-doc happy 72X!Ekernel/printk.c 73 --> 74!Ekernel/panic.c 75!Ekernel/sys.c 76!Ekernel/rcupdate.c 77 </sect1> 78 79 </chapter> 80 81 <chapter id="adt"> 82 <title>Data Types</title> 83 <sect1><title>Doubly Linked Lists</title> 84!Iinclude/linux/list.h 85 </sect1> 86 </chapter> 87 88 <chapter id="libc"> 89 <title>Basic C Library Functions</title> 90 91 <para> 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. 97 </para> 98 99 <sect1><title>String Conversions</title> 100!Ilib/vsprintf.c 101!Elib/vsprintf.c 102 </sect1> 103 <sect1><title>String Manipulation</title> 104<!-- All functions are exported at now 105X!Ilib/string.c 106 --> 107!Elib/string.c 108 </sect1> 109 <sect1><title>Bit Operations</title> 110!Iinclude/asm-i386/bitops.h 111 </sect1> 112 </chapter> 113 114 <chapter id="mm"> 115 <title>Memory Management in Linux</title> 116 <sect1><title>The Slab Cache</title> 117!Emm/slab.c 118 </sect1> 119 <sect1><title>User Space Memory Access</title> 120!Iinclude/asm-i386/uaccess.h 121!Iarch/i386/lib/usercopy.c 122 </sect1> 123 <sect1><title>More Memory Management Functions</title> 124!Iinclude/linux/rmap.h 125!Emm/readahead.c 126!Emm/filemap.c 127!Emm/memory.c 128!Emm/vmalloc.c 129!Emm/mempool.c 130!Emm/page-writeback.c 131!Emm/truncate.c 132 </sect1> 133 </chapter> 134 135 136 <chapter id="ipc"> 137 <title>Kernel IPC facilities</title> 138 139 <sect1><title>IPC utilities</title> 140!Iipc/util.c 141 </sect1> 142 </chapter> 143 144 <chapter id="kfifo"> 145 <title>FIFO Buffer</title> 146 <sect1><title>kfifo interface</title> 147!Iinclude/linux/kfifo.h 148!Ekernel/kfifo.c 149 </sect1> 150 </chapter> 151 152 <chapter id="proc"> 153 <title>The proc filesystem</title> 154 155 <sect1><title>sysctl interface</title> 156!Ekernel/sysctl.c 157 </sect1> 158 159 <sect1><title>proc filesystem interface</title> 160!Ifs/proc/base.c 161 </sect1> 162 </chapter> 163 164 <chapter id="debugfs"> 165 <title>The debugfs filesystem</title> 166 167 <sect1><title>debugfs interface</title> 168!Efs/debugfs/inode.c 169!Efs/debugfs/file.c 170 </sect1> 171 </chapter> 172 173 <chapter id="vfs"> 174 <title>The Linux VFS</title> 175 <sect1><title>The Filesystem types</title> 176!Iinclude/linux/fs.h 177!Einclude/linux/fs.h 178 </sect1> 179 <sect1><title>The Directory Cache</title> 180!Efs/dcache.c 181!Iinclude/linux/dcache.h 182 </sect1> 183 <sect1><title>Inode Handling</title> 184!Efs/inode.c 185!Efs/bad_inode.c 186 </sect1> 187 <sect1><title>Registration and Superblocks</title> 188!Efs/super.c 189 </sect1> 190 <sect1><title>File Locks</title> 191!Efs/locks.c 192!Ifs/locks.c 193 </sect1> 194 <sect1><title>Other Functions</title> 195!Efs/mpage.c 196!Efs/namei.c 197!Efs/buffer.c 198!Efs/bio.c 199!Efs/seq_file.c 200!Efs/filesystems.c 201!Efs/fs-writeback.c 202!Efs/block_dev.c 203 </sect1> 204 </chapter> 205 206 <chapter id="netcore"> 207 <title>Linux Networking</title> 208 <sect1><title>Networking Base Types</title> 209!Iinclude/linux/net.h 210 </sect1> 211 <sect1><title>Socket Buffer Functions</title> 212!Iinclude/linux/skbuff.h 213!Iinclude/net/sock.h 214!Enet/socket.c 215!Enet/core/skbuff.c 216!Enet/core/sock.c 217!Enet/core/datagram.c 218!Enet/core/stream.c 219 </sect1> 220 <sect1><title>Socket Filter</title> 221!Enet/core/filter.c 222 </sect1> 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 227 </sect1> 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 231--> 232!Enet/sunrpc/xdr.c 233!Enet/sunrpc/svcsock.c 234!Enet/sunrpc/sched.c 235 </sect1> 236 </chapter> 237 238 <chapter id="netdev"> 239 <title>Network device support</title> 240 <sect1><title>Driver Support</title> 241!Enet/core/dev.c 242 </sect1> 243 <sect1><title>8390 Based Network Cards</title> 244!Edrivers/net/8390.c 245 </sect1> 246 <sect1><title>Synchronous PPP</title> 247!Edrivers/net/wan/syncppp.c 248 </sect1> 249 </chapter> 250 251 <chapter id="modload"> 252 <title>Module Support</title> 253 <sect1><title>Module Loading</title> 254!Ekernel/kmod.c 255 </sect1> 256 <sect1><title>Inter Module support</title> 257 <para> 258 Refer to the file kernel/module.c for more information. 259 </para> 260<!-- FIXME: Removed for now since no structured comments in source 261X!Ekernel/module.c 262--> 263 </sect1> 264 </chapter> 265 266 <chapter id="hardware"> 267 <title>Hardware Interfaces</title> 268 <sect1><title>Interrupt Handling</title> 269!Ikernel/irq/manage.c 270 </sect1> 271 272 <sect1><title>Resources Management</title> 273!Ekernel/resource.c 274 </sect1> 275 276 <sect1><title>MTRR Handling</title> 277!Earch/i386/kernel/cpu/mtrr/main.c 278 </sect1> 279 <sect1><title>PCI Support Library</title> 280!Edrivers/pci/pci.c 281!Edrivers/pci/pci-driver.c 282!Edrivers/pci/remove.c 283!Edrivers/pci/pci-acpi.c 284<!-- kerneldoc does not understand to __devinit 285X!Edrivers/pci/search.c 286 --> 287!Edrivers/pci/msi.c 288!Edrivers/pci/bus.c 289!Edrivers/pci/hotplug.c 290!Edrivers/pci/probe.c 291!Edrivers/pci/rom.c 292 </sect1> 293 <sect1><title>PCI Hotplug Support Library</title> 294!Edrivers/pci/hotplug/pci_hotplug_core.c 295 </sect1> 296 <sect1><title>MCA Architecture</title> 297 <sect2><title>MCA Device Functions</title> 298 <para> 299 Refer to the file arch/i386/kernel/mca.c for more information. 300 </para> 301<!-- FIXME: Removed for now since no structured comments in source 302X!Earch/i386/kernel/mca.c 303--> 304 </sect2> 305 <sect2><title>MCA Bus DMA</title> 306!Iinclude/asm-i386/mca_dma.h 307 </sect2> 308 </sect1> 309 </chapter> 310 311 <chapter id="devfs"> 312 <title>The Device File System</title> 313!Efs/devfs/base.c 314 </chapter> 315 316 <chapter id="sysfs"> 317 <title>The Filesystem for Exporting Kernel Objects</title> 318!Efs/sysfs/file.c 319!Efs/sysfs/dir.c 320!Efs/sysfs/symlink.c 321!Efs/sysfs/bin.c 322 </chapter> 323 324 <chapter id="security"> 325 <title>Security Framework</title> 326!Esecurity/security.c 327 </chapter> 328 329 <chapter id="pmfuncs"> 330 <title>Power Management</title> 331!Ekernel/power/pm.c 332 </chapter> 333 334 <chapter id="devdrivers"> 335 <title>Device drivers infrastructure</title> 336 <sect1><title>Device Drivers Base</title> 337<!-- 338X!Iinclude/linux/device.h 339--> 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 349X!Edrivers/base/attribute_container.c 350--> 351!Edrivers/base/sys.c 352<!-- 353X!Edrivers/base/interface.c 354--> 355!Edrivers/base/platform.c 356!Edrivers/base/bus.c 357 </sect1> 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 362 </sect1> 363 <sect1><title>Device Drivers ACPI Support</title> 364<!-- Internal functions only 365X!Edrivers/acpi/sleep/main.c 366X!Edrivers/acpi/sleep/wakeup.c 367X!Edrivers/acpi/motherboard.c 368X!Edrivers/acpi/bus.c 369--> 370!Edrivers/acpi/scan.c 371<!-- No correct structured comments 372X!Edrivers/acpi/pci_bind.c 373--> 374 </sect1> 375 <sect1><title>Device drivers PnP support</title> 376!Edrivers/pnp/core.c 377<!-- No correct structured comments 378X!Edrivers/pnp/system.c 379 --> 380!Edrivers/pnp/card.c 381!Edrivers/pnp/driver.c 382!Edrivers/pnp/manager.c 383!Edrivers/pnp/support.c 384 </sect1> 385 </chapter> 386 387 388 <chapter id="blkdev"> 389 <title>Block Devices</title> 390!Edrivers/block/ll_rw_blk.c 391 </chapter> 392 393 <chapter id="miscdev"> 394 <title>Miscellaneous Devices</title> 395!Edrivers/char/misc.c 396 </chapter> 397 398 <chapter id="viddev"> 399 <title>Video4Linux</title> 400!Edrivers/media/video/videodev.c 401 </chapter> 402 403 <chapter id="snddev"> 404 <title>Sound Devices</title> 405!Iinclude/sound/core.h 406!Esound/sound_core.c 407!Iinclude/sound/pcm.h 408!Esound/core/pcm.c 409!Esound/core/device.c 410!Esound/core/info.c 411!Esound/core/rawmidi.c 412!Esound/core/sound.c 413!Esound/core/memory.c 414!Esound/core/pcm_memory.c 415!Esound/core/init.c 416!Esound/core/isadma.c 417!Esound/core/control.c 418!Esound/core/pcm_lib.c 419!Esound/core/hwdep.c 420!Esound/core/pcm_native.c 421!Esound/core/memalloc.c 422<!-- FIXME: Removed for now since no structured comments in source 423X!Isound/sound_firmware.c 424--> 425 </chapter> 426 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 432 </chapter> 433 434 <chapter id="z85230"> 435 <title>Z85230 Support Library</title> 436!Edrivers/net/wan/z85230.c 437 </chapter> 438 439 <chapter id="fbdev"> 440 <title>Frame Buffer Library</title> 441 442 <para> 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. 447 </para> 448 449 <para> 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. 454 </para> 455 456 <para> 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. 460 </para> 461 462 <para> 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. 468 </para> 469 470 <para> 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. 477 </para> 478 479 <sect1><title>Frame Buffer Memory</title> 480!Edrivers/video/fbmem.c 481 </sect1> 482<!-- 483 <sect1><title>Frame Buffer Console</title> 484X!Edrivers/video/console/fbcon.c 485 </sect1> 486--> 487 <sect1><title>Frame Buffer Colormap</title> 488!Edrivers/video/fbcmap.c 489 </sect1> 490<!-- FIXME: 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> 494X!Idrivers/video/fbgen.c 495 </sect1> 496KAO --> 497 <sect1><title>Frame Buffer Video Mode Database</title> 498!Idrivers/video/modedb.c 499!Edrivers/video/modedb.c 500 </sect1> 501 <sect1><title>Frame Buffer Macintosh Video Mode Database</title> 502!Idrivers/video/macmodes.c 503 </sect1> 504 <sect1><title>Frame Buffer Fonts</title> 505 <para> 506 Refer to the file drivers/video/console/fonts.c for more information. 507 </para> 508<!-- FIXME: Removed for now since no structured comments in source 509X!Idrivers/video/console/fonts.c 510--> 511 </sect1> 512 </chapter> 513</book>