Merge branch 'drm-next-4.16' of git://people.freedesktop.org/~agd5f/linux into drm...
[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 Math Functions in Linux
107 =======================
108
109 Base 2 log and power Functions
110 ------------------------------
111
112 .. kernel-doc:: include/linux/log2.h
113    :internal:
114
115 Division Functions
116 ------------------
117
118 .. kernel-doc:: include/asm-generic/div64.h
119    :functions: do_div
120
121 .. kernel-doc:: include/linux/math64.h
122    :internal:
123
124 .. kernel-doc:: lib/div64.c
125    :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64
126
127 .. kernel-doc:: lib/gcd.c
128    :export:
129
130 Sorting
131 -------
132
133 .. kernel-doc:: lib/sort.c
134    :export:
135
136 .. kernel-doc:: lib/list_sort.c
137    :export:
138
139 UUID/GUID
140 ---------
141
142 .. kernel-doc:: lib/uuid.c
143    :export:
144
145 Memory Management in Linux
146 ==========================
147
148 The Slab Cache
149 --------------
150
151 .. kernel-doc:: include/linux/slab.h
152    :internal:
153
154 .. kernel-doc:: mm/slab.c
155    :export:
156
157 .. kernel-doc:: mm/util.c
158    :export:
159
160 User Space Memory Access
161 ------------------------
162
163 .. kernel-doc:: arch/x86/include/asm/uaccess.h
164    :internal:
165
166 .. kernel-doc:: arch/x86/lib/usercopy_32.c
167    :export:
168
169 More Memory Management Functions
170 --------------------------------
171
172 .. kernel-doc:: mm/readahead.c
173    :export:
174
175 .. kernel-doc:: mm/filemap.c
176    :export:
177
178 .. kernel-doc:: mm/memory.c
179    :export:
180
181 .. kernel-doc:: mm/vmalloc.c
182    :export:
183
184 .. kernel-doc:: mm/page_alloc.c
185    :internal:
186
187 .. kernel-doc:: mm/mempool.c
188    :export:
189
190 .. kernel-doc:: mm/dmapool.c
191    :export:
192
193 .. kernel-doc:: mm/page-writeback.c
194    :export:
195
196 .. kernel-doc:: mm/truncate.c
197    :export:
198
199 Kernel IPC facilities
200 =====================
201
202 IPC utilities
203 -------------
204
205 .. kernel-doc:: ipc/util.c
206    :internal:
207
208 FIFO Buffer
209 ===========
210
211 kfifo interface
212 ---------------
213
214 .. kernel-doc:: include/linux/kfifo.h
215    :internal:
216
217 relay interface support
218 =======================
219
220 Relay interface support is designed to provide an efficient mechanism
221 for tools and facilities to relay large amounts of data from kernel
222 space to user space.
223
224 relay interface
225 ---------------
226
227 .. kernel-doc:: kernel/relay.c
228    :export:
229
230 .. kernel-doc:: kernel/relay.c
231    :internal:
232
233 Module Support
234 ==============
235
236 Module Loading
237 --------------
238
239 .. kernel-doc:: kernel/kmod.c
240    :export:
241
242 Inter Module support
243 --------------------
244
245 Refer to the file kernel/module.c for more information.
246
247 Hardware Interfaces
248 ===================
249
250 Interrupt Handling
251 ------------------
252
253 .. kernel-doc:: kernel/irq/manage.c
254    :export:
255
256 DMA Channels
257 ------------
258
259 .. kernel-doc:: kernel/dma.c
260    :export:
261
262 Resources Management
263 --------------------
264
265 .. kernel-doc:: kernel/resource.c
266    :internal:
267
268 .. kernel-doc:: kernel/resource.c
269    :export:
270
271 MTRR Handling
272 -------------
273
274 .. kernel-doc:: arch/x86/kernel/cpu/mtrr/main.c
275    :export:
276
277 Security Framework
278 ==================
279
280 .. kernel-doc:: security/security.c
281    :internal:
282
283 .. kernel-doc:: security/inode.c
284    :export:
285
286 Audit Interfaces
287 ================
288
289 .. kernel-doc:: kernel/audit.c
290    :export:
291
292 .. kernel-doc:: kernel/auditsc.c
293    :internal:
294
295 .. kernel-doc:: kernel/auditfilter.c
296    :internal:
297
298 Accounting Framework
299 ====================
300
301 .. kernel-doc:: kernel/acct.c
302    :internal:
303
304 Block Devices
305 =============
306
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-exec.c
323    :export:
324
325 .. kernel-doc:: block/blk-flush.c
326    :export:
327
328 .. kernel-doc:: block/blk-lib.c
329    :export:
330
331 .. kernel-doc:: block/blk-tag.c
332    :export:
333
334 .. kernel-doc:: block/blk-tag.c
335    :internal:
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 Char devices
350 ============
351
352 .. kernel-doc:: fs/char_dev.c
353    :export:
354
355 Clock Framework
356 ===============
357
358 The clock framework defines programming interfaces to support software
359 management of the system clock tree. This framework is widely used with
360 System-On-Chip (SOC) platforms to support power management and various
361 devices which may need custom clock rates. Note that these "clocks"
362 don't relate to timekeeping or real time clocks (RTCs), each of which
363 have separate frameworks. These :c:type:`struct clk <clk>`
364 instances may be used to manage for example a 96 MHz signal that is used
365 to shift bits into and out of peripherals or busses, or otherwise
366 trigger synchronous state machine transitions in system hardware.
367
368 Power management is supported by explicit software clock gating: unused
369 clocks are disabled, so the system doesn't waste power changing the
370 state of transistors that aren't in active use. On some systems this may
371 be backed by hardware clock gating, where clocks are gated without being
372 disabled in software. Sections of chips that are powered but not clocked
373 may be able to retain their last state. This low power state is often
374 called a *retention mode*. This mode still incurs leakage currents,
375 especially with finer circuit geometries, but for CMOS circuits power is
376 mostly used by clocked state changes.
377
378 Power-aware drivers only enable their clocks when the device they manage
379 is in active use. Also, system sleep states often differ according to
380 which clock domains are active: while a "standby" state may allow wakeup
381 from several active domains, a "mem" (suspend-to-RAM) state may require
382 a more wholesale shutdown of clocks derived from higher speed PLLs and
383 oscillators, limiting the number of possible wakeup event sources. A
384 driver's suspend method may need to be aware of system-specific clock
385 constraints on the target sleep state.
386
387 Some platforms support programmable clock generators. These can be used
388 by external chips of various kinds, such as other CPUs, multimedia
389 codecs, and devices with strict requirements for interface clocking.
390
391 .. kernel-doc:: include/linux/clk.h
392    :internal:
393
394 Synchronization Primitives
395 ==========================
396
397 Read-Copy Update (RCU)
398 ----------------------
399
400 .. kernel-doc:: include/linux/rcupdate.h
401
402 .. kernel-doc:: include/linux/rcupdate_wait.h
403
404 .. kernel-doc:: include/linux/rcutree.h
405
406 .. kernel-doc:: kernel/rcu/tree.c
407
408 .. kernel-doc:: kernel/rcu/tree_plugin.h
409
410 .. kernel-doc:: kernel/rcu/tree_exp.h
411
412 .. kernel-doc:: kernel/rcu/update.c
413
414 .. kernel-doc:: include/linux/srcu.h
415
416 .. kernel-doc:: kernel/rcu/srcutree.c
417
418 .. kernel-doc:: include/linux/rculist_bl.h
419
420 .. kernel-doc:: include/linux/rculist.h
421
422 .. kernel-doc:: include/linux/rculist_nulls.h
423
424 .. kernel-doc:: include/linux/rcu_sync.h
425
426 .. kernel-doc:: kernel/rcu/sync.c
427