Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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<!--
74X!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
113X!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!Imm/page_alloc.c
162!Emm/mempool.c
163!Emm/page-writeback.c
164!Emm/truncate.c
165 </sect1>
166 </chapter>
167
168
169 <chapter id="ipc">
170 <title>Kernel IPC facilities</title>
171
172 <sect1><title>IPC utilities</title>
173!Iipc/util.c
174 </sect1>
175 </chapter>
176
177 <chapter id="kfifo">
178 <title>FIFO Buffer</title>
179 <sect1><title>kfifo interface</title>
180!Iinclude/linux/kfifo.h
181!Ekernel/kfifo.c
182 </sect1>
183 </chapter>
184
185 <chapter id="relayfs">
186 <title>relay interface support</title>
187
188 <para>
189 Relay interface support
190 is designed to provide an efficient mechanism for tools and
191 facilities to relay large amounts of data from kernel space to
192 user space.
193 </para>
194
195 <sect1><title>relay interface</title>
196!Ekernel/relay.c
197!Ikernel/relay.c
198 </sect1>
199 </chapter>
200
201 <chapter id="netcore">
202 <title>Linux Networking</title>
203 <sect1><title>Networking Base Types</title>
204!Iinclude/linux/net.h
205 </sect1>
206 <sect1><title>Socket Buffer Functions</title>
207!Iinclude/linux/skbuff.h
208!Iinclude/net/sock.h
209!Enet/socket.c
210!Enet/core/skbuff.c
211!Enet/core/sock.c
212!Enet/core/datagram.c
213!Enet/core/stream.c
214 </sect1>
215 <sect1><title>Socket Filter</title>
216!Enet/core/filter.c
217 </sect1>
218 <sect1><title>Generic Network Statistics</title>
219!Iinclude/linux/gen_stats.h
220!Enet/core/gen_stats.c
221!Enet/core/gen_estimator.c
222 </sect1>
223 <sect1><title>SUN RPC subsystem</title>
224<!-- The !D functionality is not perfect, garbage has to be protected by comments
225!Dnet/sunrpc/sunrpc_syms.c
226-->
227!Enet/sunrpc/xdr.c
228!Enet/sunrpc/svcsock.c
229!Enet/sunrpc/sched.c
230 </sect1>
231 </chapter>
232
233 <chapter id="netdev">
234 <title>Network device support</title>
235 <sect1><title>Driver Support</title>
236!Enet/core/dev.c
237!Enet/ethernet/eth.c
238!Iinclude/linux/etherdevice.h
239<!-- FIXME: Removed for now since no structured comments in source
240X!Enet/core/wireless.c
241-->
242 </sect1>
243 <sect1><title>Synchronous PPP</title>
244!Edrivers/net/wan/syncppp.c
245 </sect1>
246 </chapter>
247
248 <chapter id="modload">
249 <title>Module Support</title>
250 <sect1><title>Module Loading</title>
251!Ekernel/kmod.c
252 </sect1>
253 <sect1><title>Inter Module support</title>
254 <para>
255 Refer to the file kernel/module.c for more information.
256 </para>
257<!-- FIXME: Removed for now since no structured comments in source
258X!Ekernel/module.c
259-->
260 </sect1>
261 </chapter>
262
263 <chapter id="hardware">
264 <title>Hardware Interfaces</title>
265 <sect1><title>Interrupt Handling</title>
266!Ekernel/irq/manage.c
267 </sect1>
268
269 <sect1><title>DMA Channels</title>
270!Ekernel/dma.c
271 </sect1>
272
273 <sect1><title>Resources Management</title>
274!Ikernel/resource.c
275!Ekernel/resource.c
276 </sect1>
277
278 <sect1><title>MTRR Handling</title>
279!Earch/i386/kernel/cpu/mtrr/main.c
280 </sect1>
281
282 <sect1><title>PCI Support Library</title>
283!Edrivers/pci/pci.c
284!Edrivers/pci/pci-driver.c
285!Edrivers/pci/remove.c
286!Edrivers/pci/pci-acpi.c
287!Edrivers/pci/search.c
288!Edrivers/pci/msi.c
289!Edrivers/pci/bus.c
290<!-- FIXME: Removed for now since no structured comments in source
291X!Edrivers/pci/hotplug.c
292-->
293!Edrivers/pci/probe.c
294!Edrivers/pci/rom.c
295 </sect1>
296 <sect1><title>PCI Hotplug Support Library</title>
297!Edrivers/pci/hotplug/pci_hotplug_core.c
298 </sect1>
299 <sect1><title>MCA Architecture</title>
300 <sect2><title>MCA Device Functions</title>
301 <para>
302 Refer to the file arch/i386/kernel/mca.c for more information.
303 </para>
304<!-- FIXME: Removed for now since no structured comments in source
305X!Earch/i386/kernel/mca.c
306-->
307 </sect2>
308 <sect2><title>MCA Bus DMA</title>
309!Iinclude/asm-i386/mca_dma.h
310 </sect2>
311 </sect1>
312 </chapter>
313
314 <chapter id="firmware">
315 <title>Firmware Interfaces</title>
316 <sect1><title>DMI Interfaces</title>
317!Edrivers/firmware/dmi_scan.c
318 </sect1>
319 </chapter>
320
321 <chapter id="security">
322 <title>Security Framework</title>
323!Esecurity/security.c
324 </chapter>
325
326 <chapter id="audit">
327 <title>Audit Interfaces</title>
328!Ekernel/audit.c
329!Ikernel/auditsc.c
330!Ikernel/auditfilter.c
331 </chapter>
332
333 <chapter id="accounting">
334 <title>Accounting Framework</title>
335!Ikernel/acct.c
336 </chapter>
337
338 <chapter id="pmfuncs">
339 <title>Power Management</title>
340!Ekernel/power/pm.c
341 </chapter>
342
343 <chapter id="devdrivers">
344 <title>Device drivers infrastructure</title>
345 <sect1><title>Device Drivers Base</title>
346<!--
347X!Iinclude/linux/device.h
348-->
349!Edrivers/base/driver.c
350!Edrivers/base/core.c
351!Edrivers/base/class.c
352!Edrivers/base/firmware_class.c
353!Edrivers/base/transport_class.c
354!Edrivers/base/dmapool.c
355<!-- Cannot be included, because
356 attribute_container_add_class_device_adapter
357 and attribute_container_classdev_to_container
358 exceed allowed 44 characters maximum
359X!Edrivers/base/attribute_container.c
360-->
361!Edrivers/base/sys.c
362<!--
363X!Edrivers/base/interface.c
364-->
365!Edrivers/base/platform.c
366!Edrivers/base/bus.c
367 </sect1>
368 <sect1><title>Device Drivers Power Management</title>
369!Edrivers/base/power/main.c
370!Edrivers/base/power/resume.c
371!Edrivers/base/power/suspend.c
372 </sect1>
373 <sect1><title>Device Drivers ACPI Support</title>
374<!-- Internal functions only
375X!Edrivers/acpi/sleep/main.c
376X!Edrivers/acpi/sleep/wakeup.c
377X!Edrivers/acpi/motherboard.c
378X!Edrivers/acpi/bus.c
379-->
380!Edrivers/acpi/scan.c
381!Idrivers/acpi/scan.c
382<!-- No correct structured comments
383X!Edrivers/acpi/pci_bind.c
384-->
385 </sect1>
386 <sect1><title>Device drivers PnP support</title>
387!Edrivers/pnp/core.c
388<!-- No correct structured comments
389X!Edrivers/pnp/system.c
390 -->
391!Edrivers/pnp/card.c
392!Edrivers/pnp/driver.c
393!Edrivers/pnp/manager.c
394!Edrivers/pnp/support.c
395 </sect1>
396 </chapter>
397
398 <chapter id="blkdev">
399 <title>Block Devices</title>
400!Eblock/ll_rw_blk.c
401 </chapter>
402
403 <chapter id="chrdev">
404 <title>Char devices</title>
405!Efs/char_dev.c
406 </chapter>
407
408 <chapter id="miscdev">
409 <title>Miscellaneous Devices</title>
410!Edrivers/char/misc.c
411 </chapter>
412
413 <chapter id="parportdev">
414 <title>Parallel Port Devices</title>
415!Iinclude/linux/parport.h
416!Edrivers/parport/ieee1284.c
417!Edrivers/parport/share.c
418!Idrivers/parport/daisy.c
419 </chapter>
420
421 <chapter id="viddev">
422 <title>Video4Linux</title>
423!Edrivers/media/video/videodev.c
424 </chapter>
425
426 <chapter id="snddev">
427 <title>Sound Devices</title>
428!Iinclude/sound/core.h
429!Esound/sound_core.c
430!Iinclude/sound/pcm.h
431!Esound/core/pcm.c
432!Esound/core/device.c
433!Esound/core/info.c
434!Esound/core/rawmidi.c
435!Esound/core/sound.c
436!Esound/core/memory.c
437!Esound/core/pcm_memory.c
438!Esound/core/init.c
439!Esound/core/isadma.c
440!Esound/core/control.c
441!Esound/core/pcm_lib.c
442!Esound/core/hwdep.c
443!Esound/core/pcm_native.c
444!Esound/core/memalloc.c
445<!-- FIXME: Removed for now since no structured comments in source
446X!Isound/sound_firmware.c
447-->
448 </chapter>
449
450 <chapter id="uart16x50">
451 <title>16x50 UART Driver</title>
452!Iinclude/linux/serial_core.h
453!Edrivers/serial/serial_core.c
454!Edrivers/serial/8250.c
455 </chapter>
456
457 <chapter id="z85230">
458 <title>Z85230 Support Library</title>
459!Edrivers/net/wan/z85230.c
460 </chapter>
461
462 <chapter id="fbdev">
463 <title>Frame Buffer Library</title>
464
465 <para>
466 The frame buffer drivers depend heavily on four data structures.
467 These structures are declared in include/linux/fb.h. They are
468 fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
469 The last three can be made available to and from userland.
470 </para>
471
472 <para>
473 fb_info defines the current state of a particular video card.
474 Inside fb_info, there exists a fb_ops structure which is a
475 collection of needed functions to make fbdev and fbcon work.
476 fb_info is only visible to the kernel.
477 </para>
478
479 <para>
480 fb_var_screeninfo is used to describe the features of a video card
481 that are user defined. With fb_var_screeninfo, things such as
482 depth and the resolution may be defined.
483 </para>
484
485 <para>
486 The next structure is fb_fix_screeninfo. This defines the
487 properties of a card that are created when a mode is set and can't
488 be changed otherwise. A good example of this is the start of the
489 frame buffer memory. This "locks" the address of the frame buffer
490 memory, so that it cannot be changed or moved.
491 </para>
492
493 <para>
494 The last structure is fb_monospecs. In the old API, there was
495 little importance for fb_monospecs. This allowed for forbidden things
496 such as setting a mode of 800x600 on a fix frequency monitor. With
497 the new API, fb_monospecs prevents such things, and if used
498 correctly, can prevent a monitor from being cooked. fb_monospecs
499 will not be useful until kernels 2.5.x.
500 </para>
501
502 <sect1><title>Frame Buffer Memory</title>
503!Edrivers/video/fbmem.c
504 </sect1>
505<!--
506 <sect1><title>Frame Buffer Console</title>
507X!Edrivers/video/console/fbcon.c
508 </sect1>
509-->
510 <sect1><title>Frame Buffer Colormap</title>
511!Edrivers/video/fbcmap.c
512 </sect1>
513<!-- FIXME:
514 drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
515 out until somebody adds docs. KAO
516 <sect1><title>Frame Buffer Generic Functions</title>
517X!Idrivers/video/fbgen.c
518 </sect1>
519KAO -->
520 <sect1><title>Frame Buffer Video Mode Database</title>
521!Idrivers/video/modedb.c
522!Edrivers/video/modedb.c
523 </sect1>
524 <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
525!Edrivers/video/macmodes.c
526 </sect1>
527 <sect1><title>Frame Buffer Fonts</title>
528 <para>
529 Refer to the file drivers/video/console/fonts.c for more information.
530 </para>
531<!-- FIXME: Removed for now since no structured comments in source
532X!Idrivers/video/console/fonts.c
533-->
534 </sect1>
535 </chapter>
536</book>