Merge branch 'linux-4.15' of git://github.com/skeggsb/linux into drm-fixes
[sfrench/cifs-2.6.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/kernel.h
28    :functions: kstrtol
29
30 .. kernel-doc:: include/linux/kernel.h
31    :functions: kstrtoul
32
33 .. kernel-doc:: lib/kstrtox.c
34    :export:
35
36 String Manipulation
37 -------------------
38
39 .. kernel-doc:: lib/string.c
40    :export:
41
42 Bit Operations
43 --------------
44
45 .. kernel-doc:: arch/x86/include/asm/bitops.h
46    :internal:
47
48 Basic Kernel Library Functions
49 ==============================
50
51 The Linux kernel provides more basic utility functions.
52
53 Bitmap Operations
54 -----------------
55
56 .. kernel-doc:: lib/bitmap.c
57    :doc: bitmap introduction
58
59 .. kernel-doc:: include/linux/bitmap.h
60    :doc: declare bitmap
61
62 .. kernel-doc:: include/linux/bitmap.h
63    :doc: bitmap overview
64
65 .. kernel-doc:: include/linux/bitmap.h
66    :doc: bitmap bitops
67
68 .. kernel-doc:: lib/bitmap.c
69    :export:
70
71 .. kernel-doc:: lib/bitmap.c
72    :internal:
73
74 .. kernel-doc:: include/linux/bitmap.h
75    :internal:
76
77 Command-line Parsing
78 --------------------
79
80 .. kernel-doc:: lib/cmdline.c
81    :export:
82
83 CRC Functions
84 -------------
85
86 .. kernel-doc:: lib/crc4.c
87    :export:
88
89 .. kernel-doc:: lib/crc7.c
90    :export:
91
92 .. kernel-doc:: lib/crc8.c
93    :export:
94
95 .. kernel-doc:: lib/crc16.c
96    :export:
97
98 .. kernel-doc:: lib/crc32.c
99
100 .. kernel-doc:: lib/crc-ccitt.c
101    :export:
102
103 .. kernel-doc:: lib/crc-itu-t.c
104    :export:
105
106 idr/ida Functions
107 -----------------
108
109 .. kernel-doc:: include/linux/idr.h
110    :doc: idr sync
111
112 .. kernel-doc:: lib/idr.c
113    :doc: IDA description
114
115 .. kernel-doc:: lib/idr.c
116    :export:
117
118 Math Functions in Linux
119 =======================
120
121 Base 2 log and power Functions
122 ------------------------------
123
124 .. kernel-doc:: include/linux/log2.h
125    :internal:
126
127 Division Functions
128 ------------------
129
130 .. kernel-doc:: include/asm-generic/div64.h
131    :functions: do_div
132
133 .. kernel-doc:: include/linux/math64.h
134    :internal:
135
136 .. kernel-doc:: lib/div64.c
137    :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64
138
139 .. kernel-doc:: lib/gcd.c
140    :export:
141
142 Memory Management in Linux
143 ==========================
144
145 The Slab Cache
146 --------------
147
148 .. kernel-doc:: include/linux/slab.h
149    :internal:
150
151 .. kernel-doc:: mm/slab.c
152    :export:
153
154 .. kernel-doc:: mm/util.c
155    :export:
156
157 User Space Memory Access
158 ------------------------
159
160 .. kernel-doc:: arch/x86/include/asm/uaccess.h
161    :internal:
162
163 .. kernel-doc:: arch/x86/lib/usercopy_32.c
164    :export:
165
166 More Memory Management Functions
167 --------------------------------
168
169 .. kernel-doc:: mm/readahead.c
170    :export:
171
172 .. kernel-doc:: mm/filemap.c
173    :export:
174
175 .. kernel-doc:: mm/memory.c
176    :export:
177
178 .. kernel-doc:: mm/vmalloc.c
179    :export:
180
181 .. kernel-doc:: mm/page_alloc.c
182    :internal:
183
184 .. kernel-doc:: mm/mempool.c
185    :export:
186
187 .. kernel-doc:: mm/dmapool.c
188    :export:
189
190 .. kernel-doc:: mm/page-writeback.c
191    :export:
192
193 .. kernel-doc:: mm/truncate.c
194    :export:
195
196 Kernel IPC facilities
197 =====================
198
199 IPC utilities
200 -------------
201
202 .. kernel-doc:: ipc/util.c
203    :internal:
204
205 FIFO Buffer
206 ===========
207
208 kfifo interface
209 ---------------
210
211 .. kernel-doc:: include/linux/kfifo.h
212    :internal:
213
214 relay interface support
215 =======================
216
217 Relay interface support is designed to provide an efficient mechanism
218 for tools and facilities to relay large amounts of data from kernel
219 space to user space.
220
221 relay interface
222 ---------------
223
224 .. kernel-doc:: kernel/relay.c
225    :export:
226
227 .. kernel-doc:: kernel/relay.c
228    :internal:
229
230 Module Support
231 ==============
232
233 Module Loading
234 --------------
235
236 .. kernel-doc:: kernel/kmod.c
237    :export:
238
239 Inter Module support
240 --------------------
241
242 Refer to the file kernel/module.c for more information.
243
244 Hardware Interfaces
245 ===================
246
247 Interrupt Handling
248 ------------------
249
250 .. kernel-doc:: kernel/irq/manage.c
251    :export:
252
253 DMA Channels
254 ------------
255
256 .. kernel-doc:: kernel/dma.c
257    :export:
258
259 Resources Management
260 --------------------
261
262 .. kernel-doc:: kernel/resource.c
263    :internal:
264
265 .. kernel-doc:: kernel/resource.c
266    :export:
267
268 MTRR Handling
269 -------------
270
271 .. kernel-doc:: arch/x86/kernel/cpu/mtrr/main.c
272    :export:
273
274 Security Framework
275 ==================
276
277 .. kernel-doc:: security/security.c
278    :internal:
279
280 .. kernel-doc:: security/inode.c
281    :export:
282
283 Audit Interfaces
284 ================
285
286 .. kernel-doc:: kernel/audit.c
287    :export:
288
289 .. kernel-doc:: kernel/auditsc.c
290    :internal:
291
292 .. kernel-doc:: kernel/auditfilter.c
293    :internal:
294
295 Accounting Framework
296 ====================
297
298 .. kernel-doc:: kernel/acct.c
299    :internal:
300
301 Block Devices
302 =============
303
304 .. kernel-doc:: block/blk-core.c
305    :export:
306
307 .. kernel-doc:: block/blk-core.c
308    :internal:
309
310 .. kernel-doc:: block/blk-map.c
311    :export:
312
313 .. kernel-doc:: block/blk-sysfs.c
314    :internal:
315
316 .. kernel-doc:: block/blk-settings.c
317    :export:
318
319 .. kernel-doc:: block/blk-exec.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-tag.c
329    :export:
330
331 .. kernel-doc:: block/blk-tag.c
332    :internal:
333
334 .. kernel-doc:: block/blk-integrity.c
335    :export:
336
337 .. kernel-doc:: kernel/trace/blktrace.c
338    :internal:
339
340 .. kernel-doc:: block/genhd.c
341    :internal:
342
343 .. kernel-doc:: block/genhd.c
344    :export:
345
346 Char devices
347 ============
348
349 .. kernel-doc:: fs/char_dev.c
350    :export:
351
352 Clock Framework
353 ===============
354
355 The clock framework defines programming interfaces to support software
356 management of the system clock tree. This framework is widely used with
357 System-On-Chip (SOC) platforms to support power management and various
358 devices which may need custom clock rates. Note that these "clocks"
359 don't relate to timekeeping or real time clocks (RTCs), each of which
360 have separate frameworks. These :c:type:`struct clk <clk>`
361 instances may be used to manage for example a 96 MHz signal that is used
362 to shift bits into and out of peripherals or busses, or otherwise
363 trigger synchronous state machine transitions in system hardware.
364
365 Power management is supported by explicit software clock gating: unused
366 clocks are disabled, so the system doesn't waste power changing the
367 state of transistors that aren't in active use. On some systems this may
368 be backed by hardware clock gating, where clocks are gated without being
369 disabled in software. Sections of chips that are powered but not clocked
370 may be able to retain their last state. This low power state is often
371 called a *retention mode*. This mode still incurs leakage currents,
372 especially with finer circuit geometries, but for CMOS circuits power is
373 mostly used by clocked state changes.
374
375 Power-aware drivers only enable their clocks when the device they manage
376 is in active use. Also, system sleep states often differ according to
377 which clock domains are active: while a "standby" state may allow wakeup
378 from several active domains, a "mem" (suspend-to-RAM) state may require
379 a more wholesale shutdown of clocks derived from higher speed PLLs and
380 oscillators, limiting the number of possible wakeup event sources. A
381 driver's suspend method may need to be aware of system-specific clock
382 constraints on the target sleep state.
383
384 Some platforms support programmable clock generators. These can be used
385 by external chips of various kinds, such as other CPUs, multimedia
386 codecs, and devices with strict requirements for interface clocking.
387
388 .. kernel-doc:: include/linux/clk.h
389    :internal:
390
391 Synchronization Primitives
392 ==========================
393
394 Read-Copy Update (RCU)
395 ----------------------
396
397 .. kernel-doc:: include/linux/rcupdate.h
398
399 .. kernel-doc:: include/linux/rcupdate_wait.h
400
401 .. kernel-doc:: include/linux/rcutree.h
402
403 .. kernel-doc:: kernel/rcu/tree.c
404
405 .. kernel-doc:: kernel/rcu/tree_plugin.h
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