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