1====================
2The Linux Kernel API
3====================
4
5
6List Management Functions
7=========================
8
9.. kernel-doc:: include/linux/list.h
10   :internal:
11
12Basic C Library Functions
13=========================
14
15When writing drivers, you cannot in general use routines which are from
16the C Library. Some of the functions have been found generally useful
17and they are listed below. The behaviour of these functions may vary
18slightly from those defined by ANSI, and these deviations are noted in
19the text.
20
21String Conversions
22------------------
23
24.. kernel-doc:: lib/vsprintf.c
25   :export:
26
27.. kernel-doc:: include/linux/kstrtox.h
28   :functions: kstrtol kstrtoul
29
30.. kernel-doc:: lib/kstrtox.c
31   :export:
32
33.. kernel-doc:: lib/string_helpers.c
34   :export:
35
36String Manipulation
37-------------------
38
39.. kernel-doc:: include/linux/fortify-string.h
40   :internal:
41
42.. kernel-doc:: lib/string.c
43   :export:
44
45.. kernel-doc:: include/linux/string.h
46   :internal:
47
48.. kernel-doc:: mm/util.c
49   :functions: kstrdup kstrdup_const kstrndup kmemdup kmemdup_nul memdup_user
50               vmemdup_user strndup_user memdup_user_nul
51
52Basic Kernel Library Functions
53==============================
54
55The Linux kernel provides more basic utility functions.
56
57Bit Operations
58--------------
59
60.. kernel-doc:: include/asm-generic/bitops/instrumented-atomic.h
61   :internal:
62
63.. kernel-doc:: include/asm-generic/bitops/instrumented-non-atomic.h
64   :internal:
65
66.. kernel-doc:: include/asm-generic/bitops/instrumented-lock.h
67   :internal:
68
69Bitmap Operations
70-----------------
71
72.. kernel-doc:: lib/bitmap.c
73   :doc: bitmap introduction
74
75.. kernel-doc:: include/linux/bitmap.h
76   :doc: declare bitmap
77
78.. kernel-doc:: include/linux/bitmap.h
79   :doc: bitmap overview
80
81.. kernel-doc:: include/linux/bitmap.h
82   :doc: bitmap bitops
83
84.. kernel-doc:: lib/bitmap.c
85   :export:
86
87.. kernel-doc:: lib/bitmap.c
88   :internal:
89
90.. kernel-doc:: include/linux/bitmap.h
91   :internal:
92
93Command-line Parsing
94--------------------
95
96.. kernel-doc:: lib/cmdline.c
97   :export:
98
99Error Pointers
100--------------
101
102.. kernel-doc:: include/linux/err.h
103   :internal:
104
105Sorting
106-------
107
108.. kernel-doc:: lib/sort.c
109   :export:
110
111.. kernel-doc:: lib/list_sort.c
112   :export:
113
114Text Searching
115--------------
116
117.. kernel-doc:: lib/textsearch.c
118   :doc: ts_intro
119
120.. kernel-doc:: lib/textsearch.c
121   :export:
122
123.. kernel-doc:: include/linux/textsearch.h
124   :functions: textsearch_find textsearch_next \
125               textsearch_get_pattern textsearch_get_pattern_len
126
127CRC and Math Functions in Linux
128===============================
129
130Arithmetic Overflow Checking
131----------------------------
132
133.. kernel-doc:: include/linux/overflow.h
134   :internal:
135
136CRC Functions
137-------------
138
139.. kernel-doc:: lib/crc4.c
140   :export:
141
142.. kernel-doc:: lib/crc7.c
143   :export:
144
145.. kernel-doc:: lib/crc8.c
146   :export:
147
148.. kernel-doc:: lib/crc16.c
149   :export:
150
151.. kernel-doc:: lib/crc32.c
152
153.. kernel-doc:: lib/crc-ccitt.c
154   :export:
155
156.. kernel-doc:: lib/crc-itu-t.c
157   :export:
158
159Base 2 log and power Functions
160------------------------------
161
162.. kernel-doc:: include/linux/log2.h
163   :internal:
164
165Integer log and power Functions
166-------------------------------
167
168.. kernel-doc:: include/linux/int_log.h
169   :export:
170
171.. kernel-doc:: lib/math/int_pow.c
172   :export:
173
174.. kernel-doc:: lib/math/int_sqrt.c
175   :export:
176
177Division Functions
178------------------
179
180.. kernel-doc:: include/asm-generic/div64.h
181   :functions: do_div
182
183.. kernel-doc:: include/linux/math64.h
184   :internal:
185
186.. kernel-doc:: lib/math/gcd.c
187   :export:
188
189UUID/GUID
190---------
191
192.. kernel-doc:: lib/uuid.c
193   :export:
194
195Kernel IPC facilities
196=====================
197
198IPC utilities
199-------------
200
201.. kernel-doc:: ipc/util.c
202   :internal:
203
204FIFO Buffer
205===========
206
207kfifo interface
208---------------
209
210.. kernel-doc:: include/linux/kfifo.h
211   :internal:
212
213relay interface support
214=======================
215
216Relay interface support is designed to provide an efficient mechanism
217for tools and facilities to relay large amounts of data from kernel
218space to user space.
219
220relay interface
221---------------
222
223.. kernel-doc:: kernel/relay.c
224   :export:
225
226.. kernel-doc:: kernel/relay.c
227   :internal:
228
229Module Support
230==============
231
232Kernel module auto-loading
233--------------------------
234
235.. kernel-doc:: kernel/module/kmod.c
236   :export:
237
238Module debugging
239----------------
240
241.. kernel-doc:: kernel/module/stats.c
242   :doc: module debugging statistics overview
243
244dup_failed_modules - tracks duplicate failed modules
245****************************************************
246
247.. kernel-doc:: kernel/module/stats.c
248   :doc: dup_failed_modules - tracks duplicate failed modules
249
250module statistics debugfs counters
251**********************************
252
253.. kernel-doc:: kernel/module/stats.c
254   :doc: module statistics debugfs counters
255
256Inter Module support
257--------------------
258
259Refer to the files in kernel/module/ for more information.
260
261Hardware Interfaces
262===================
263
264DMA Channels
265------------
266
267.. kernel-doc:: kernel/dma.c
268   :export:
269
270Resources Management
271--------------------
272
273.. kernel-doc:: kernel/resource.c
274   :internal:
275
276.. kernel-doc:: kernel/resource.c
277   :export:
278
279MTRR Handling
280-------------
281
282.. kernel-doc:: arch/x86/kernel/cpu/mtrr/mtrr.c
283   :export:
284
285Security Framework
286==================
287
288.. kernel-doc:: security/security.c
289   :internal:
290
291.. kernel-doc:: security/inode.c
292   :export:
293
294Audit Interfaces
295================
296
297.. kernel-doc:: kernel/audit.c
298   :export:
299
300.. kernel-doc:: kernel/auditsc.c
301   :internal:
302
303.. kernel-doc:: kernel/auditfilter.c
304   :internal:
305
306Accounting Framework
307====================
308
309.. kernel-doc:: kernel/acct.c
310   :internal:
311
312Block Devices
313=============
314
315.. kernel-doc:: include/linux/bio.h
316.. kernel-doc:: block/blk-core.c
317   :export:
318
319.. kernel-doc:: block/blk-core.c
320   :internal:
321
322.. kernel-doc:: block/blk-map.c
323   :export:
324
325.. kernel-doc:: block/blk-sysfs.c
326   :internal:
327
328.. kernel-doc:: block/blk-settings.c
329   :export:
330
331.. kernel-doc:: block/blk-flush.c
332   :export:
333
334.. kernel-doc:: block/blk-lib.c
335   :export:
336
337.. kernel-doc:: block/blk-integrity.c
338   :export:
339
340.. kernel-doc:: kernel/trace/blktrace.c
341   :internal:
342
343.. kernel-doc:: block/genhd.c
344   :internal:
345
346.. kernel-doc:: block/genhd.c
347   :export:
348
349.. kernel-doc:: block/bdev.c
350   :export:
351
352Char devices
353============
354
355.. kernel-doc:: fs/char_dev.c
356   :export:
357
358Clock Framework
359===============
360
361The clock framework defines programming interfaces to support software
362management of the system clock tree. This framework is widely used with
363System-On-Chip (SOC) platforms to support power management and various
364devices which may need custom clock rates. Note that these "clocks"
365don't relate to timekeeping or real time clocks (RTCs), each of which
366have separate frameworks. These :c:type:`struct clk <clk>`
367instances may be used to manage for example a 96 MHz signal that is used
368to shift bits into and out of peripherals or busses, or otherwise
369trigger synchronous state machine transitions in system hardware.
370
371Power management is supported by explicit software clock gating: unused
372clocks are disabled, so the system doesn't waste power changing the
373state of transistors that aren't in active use. On some systems this may
374be backed by hardware clock gating, where clocks are gated without being
375disabled in software. Sections of chips that are powered but not clocked
376may be able to retain their last state. This low power state is often
377called a *retention mode*. This mode still incurs leakage currents,
378especially with finer circuit geometries, but for CMOS circuits power is
379mostly used by clocked state changes.
380
381Power-aware drivers only enable their clocks when the device they manage
382is in active use. Also, system sleep states often differ according to
383which clock domains are active: while a "standby" state may allow wakeup
384from several active domains, a "mem" (suspend-to-RAM) state may require
385a more wholesale shutdown of clocks derived from higher speed PLLs and
386oscillators, limiting the number of possible wakeup event sources. A
387driver's suspend method may need to be aware of system-specific clock
388constraints on the target sleep state.
389
390Some platforms support programmable clock generators. These can be used
391by external chips of various kinds, such as other CPUs, multimedia
392codecs, and devices with strict requirements for interface clocking.
393
394.. kernel-doc:: include/linux/clk.h
395   :internal:
396
397Synchronization Primitives
398==========================
399
400Read-Copy Update (RCU)
401----------------------
402
403.. kernel-doc:: include/linux/rcupdate.h
404
405.. kernel-doc:: kernel/rcu/tree.c
406
407.. kernel-doc:: kernel/rcu/tree_exp.h
408
409.. kernel-doc:: kernel/rcu/update.c
410
411.. kernel-doc:: include/linux/srcu.h
412
413.. kernel-doc:: kernel/rcu/srcutree.c
414
415.. kernel-doc:: include/linux/rculist_bl.h
416
417.. kernel-doc:: include/linux/rculist.h
418
419.. kernel-doc:: include/linux/rculist_nulls.h
420
421.. kernel-doc:: include/linux/rcu_sync.h
422
423.. kernel-doc:: kernel/rcu/sync.c
424
425.. kernel-doc:: kernel/rcu/tasks.h
426
427.. kernel-doc:: kernel/rcu/tree_stall.h
428
429.. kernel-doc:: include/linux/rcupdate_trace.h
430
431.. kernel-doc:: include/linux/rcupdate_wait.h
432
433.. kernel-doc:: include/linux/rcuref.h
434
435.. kernel-doc:: include/linux/rcutree.h
436