blob: 08af5caf036db8997cac6d58e0de5022515d2473 [file] [log] [blame]
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -03001====================
2The Linux Kernel API
3====================
4
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -03005
Randy Dunlap416c7512017-09-17 15:19:10 -07006List Management Functions
7=========================
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -03008
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/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
Andy Shevchenkob4221242019-06-05 19:39:44 +030036.. kernel-doc:: lib/string_helpers.c
37 :export:
38
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -030039String Manipulation
40-------------------
41
42.. kernel-doc:: lib/string.c
43 :export:
44
Mike Rapoport15956172018-08-23 17:01:09 -070045.. kernel-doc:: mm/util.c
46 :functions: kstrdup kstrdup_const kstrndup kmemdup kmemdup_nul memdup_user
47 vmemdup_user strndup_user memdup_user_nul
48
Randy Dunlapeacc6702018-04-26 18:11:02 -070049Basic Kernel Library Functions
50==============================
51
52The Linux kernel provides more basic utility functions.
53
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -030054Bit Operations
55--------------
56
Marco Elver751ad982019-07-11 20:54:00 -070057.. kernel-doc:: include/asm-generic/bitops-instrumented.h
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -030058 :internal:
59
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -030060Bitmap Operations
61-----------------
62
63.. kernel-doc:: lib/bitmap.c
Randy Dunlap7d7363e2017-10-16 16:32:51 -070064 :doc: bitmap introduction
65
66.. kernel-doc:: include/linux/bitmap.h
67 :doc: declare bitmap
68
69.. kernel-doc:: include/linux/bitmap.h
70 :doc: bitmap overview
71
72.. kernel-doc:: include/linux/bitmap.h
73 :doc: bitmap bitops
74
75.. kernel-doc:: lib/bitmap.c
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -030076 :export:
77
78.. kernel-doc:: lib/bitmap.c
79 :internal:
80
Randy Dunlap404376a2017-09-17 19:07:10 -070081.. kernel-doc:: include/linux/bitmap.h
82 :internal:
83
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -030084Command-line Parsing
85--------------------
86
87.. kernel-doc:: lib/cmdline.c
88 :export:
89
Randy Dunlapeacc6702018-04-26 18:11:02 -070090Sorting
91-------
92
93.. kernel-doc:: lib/sort.c
94 :export:
95
96.. kernel-doc:: lib/list_sort.c
97 :export:
98
99Text Searching
100--------------
101
102.. kernel-doc:: lib/textsearch.c
103 :doc: ts_intro
104
105.. kernel-doc:: lib/textsearch.c
106 :export:
107
108.. kernel-doc:: include/linux/textsearch.h
109 :functions: textsearch_find textsearch_next \
110 textsearch_get_pattern textsearch_get_pattern_len
111
112CRC and Math Functions in Linux
113===============================
114
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -0300115CRC Functions
116-------------
117
Randy Dunlap8a298962017-09-08 16:35:55 -0700118.. kernel-doc:: lib/crc4.c
119 :export:
120
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -0300121.. kernel-doc:: lib/crc7.c
122 :export:
123
Randy Dunlap8a298962017-09-08 16:35:55 -0700124.. kernel-doc:: lib/crc8.c
125 :export:
126
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -0300127.. kernel-doc:: lib/crc16.c
128 :export:
129
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -0300130.. kernel-doc:: lib/crc32.c
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -0300131
132.. kernel-doc:: lib/crc-ccitt.c
133 :export:
134
Randy Dunlap8a298962017-09-08 16:35:55 -0700135.. kernel-doc:: lib/crc-itu-t.c
136 :export:
137
Randy Dunlap68e51252017-09-30 08:43:53 -0700138Base 2 log and power Functions
139------------------------------
140
141.. kernel-doc:: include/linux/log2.h
142 :internal:
143
Andy Shevchenko58d49462019-06-05 19:51:13 +0300144Integer power Functions
145-----------------------
146
147.. kernel-doc:: lib/math/int_pow.c
148 :export:
149
150.. kernel-doc:: lib/math/int_sqrt.c
151 :export:
152
Randy Dunlap68e51252017-09-30 08:43:53 -0700153Division Functions
154------------------
155
156.. kernel-doc:: include/asm-generic/div64.h
157 :functions: do_div
158
159.. kernel-doc:: include/linux/math64.h
160 :internal:
161
Andy Shevchenko2c64e9c2019-05-14 15:43:05 -0700162.. kernel-doc:: lib/math/div64.c
Randy Dunlap68e51252017-09-30 08:43:53 -0700163 :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64
164
Andy Shevchenko2c64e9c2019-05-14 15:43:05 -0700165.. kernel-doc:: lib/math/gcd.c
Randy Dunlap68e51252017-09-30 08:43:53 -0700166 :export:
167
Randy Dunlapd0636232017-11-29 12:32:42 -0800168UUID/GUID
169---------
170
171.. kernel-doc:: lib/uuid.c
172 :export:
173
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -0300174Kernel IPC facilities
175=====================
176
177IPC utilities
178-------------
179
180.. kernel-doc:: ipc/util.c
181 :internal:
182
183FIFO Buffer
184===========
185
186kfifo interface
187---------------
188
189.. kernel-doc:: include/linux/kfifo.h
190 :internal:
191
192relay interface support
193=======================
194
195Relay interface support is designed to provide an efficient mechanism
196for tools and facilities to relay large amounts of data from kernel
197space to user space.
198
199relay interface
200---------------
201
202.. kernel-doc:: kernel/relay.c
203 :export:
204
205.. kernel-doc:: kernel/relay.c
206 :internal:
207
208Module Support
209==============
210
211Module Loading
212--------------
213
214.. kernel-doc:: kernel/kmod.c
215 :export:
216
217Inter Module support
218--------------------
219
220Refer to the file kernel/module.c for more information.
221
222Hardware Interfaces
223===================
224
225Interrupt Handling
226------------------
227
228.. kernel-doc:: kernel/irq/manage.c
229 :export:
230
231DMA Channels
232------------
233
234.. kernel-doc:: kernel/dma.c
235 :export:
236
237Resources Management
238--------------------
239
240.. kernel-doc:: kernel/resource.c
241 :internal:
242
243.. kernel-doc:: kernel/resource.c
244 :export:
245
246MTRR Handling
247-------------
248
Randy Dunlap3ed1d012018-06-16 17:09:41 -0700249.. kernel-doc:: arch/x86/kernel/cpu/mtrr/mtrr.c
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -0300250 :export:
251
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -0300252Security Framework
253==================
254
255.. kernel-doc:: security/security.c
256 :internal:
257
258.. kernel-doc:: security/inode.c
259 :export:
260
261Audit Interfaces
262================
263
264.. kernel-doc:: kernel/audit.c
265 :export:
266
267.. kernel-doc:: kernel/auditsc.c
268 :internal:
269
270.. kernel-doc:: kernel/auditfilter.c
271 :internal:
272
273Accounting Framework
274====================
275
276.. kernel-doc:: kernel/acct.c
277 :internal:
278
279Block Devices
280=============
281
282.. kernel-doc:: block/blk-core.c
283 :export:
284
285.. kernel-doc:: block/blk-core.c
286 :internal:
287
288.. kernel-doc:: block/blk-map.c
289 :export:
290
291.. kernel-doc:: block/blk-sysfs.c
292 :internal:
293
294.. kernel-doc:: block/blk-settings.c
295 :export:
296
297.. kernel-doc:: block/blk-exec.c
298 :export:
299
300.. kernel-doc:: block/blk-flush.c
301 :export:
302
303.. kernel-doc:: block/blk-lib.c
304 :export:
305
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -0300306.. kernel-doc:: block/blk-integrity.c
307 :export:
308
309.. kernel-doc:: kernel/trace/blktrace.c
310 :internal:
311
312.. kernel-doc:: block/genhd.c
313 :internal:
314
315.. kernel-doc:: block/genhd.c
316 :export:
317
318Char devices
319============
320
321.. kernel-doc:: fs/char_dev.c
322 :export:
323
Mauro Carvalho Chehabbaca8a02017-03-30 17:11:32 -0300324Clock Framework
325===============
326
327The clock framework defines programming interfaces to support software
328management of the system clock tree. This framework is widely used with
329System-On-Chip (SOC) platforms to support power management and various
330devices which may need custom clock rates. Note that these "clocks"
331don't relate to timekeeping or real time clocks (RTCs), each of which
332have separate frameworks. These :c:type:`struct clk <clk>`
333instances may be used to manage for example a 96 MHz signal that is used
334to shift bits into and out of peripherals or busses, or otherwise
335trigger synchronous state machine transitions in system hardware.
336
337Power management is supported by explicit software clock gating: unused
338clocks are disabled, so the system doesn't waste power changing the
339state of transistors that aren't in active use. On some systems this may
340be backed by hardware clock gating, where clocks are gated without being
341disabled in software. Sections of chips that are powered but not clocked
342may be able to retain their last state. This low power state is often
343called a *retention mode*. This mode still incurs leakage currents,
344especially with finer circuit geometries, but for CMOS circuits power is
345mostly used by clocked state changes.
346
347Power-aware drivers only enable their clocks when the device they manage
348is in active use. Also, system sleep states often differ according to
349which clock domains are active: while a "standby" state may allow wakeup
350from several active domains, a "mem" (suspend-to-RAM) state may require
351a more wholesale shutdown of clocks derived from higher speed PLLs and
352oscillators, limiting the number of possible wakeup event sources. A
353driver's suspend method may need to be aware of system-specific clock
354constraints on the target sleep state.
355
356Some platforms support programmable clock generators. These can be used
357by external chips of various kinds, such as other CPUs, multimedia
358codecs, and devices with strict requirements for interface clocking.
359
360.. kernel-doc:: include/linux/clk.h
361 :internal:
Paul E. McKenney764f8072017-07-04 14:42:20 -0700362
363Synchronization Primitives
364==========================
365
366Read-Copy Update (RCU)
367----------------------
368
369.. kernel-doc:: include/linux/rcupdate.h
Paul E. McKenney764f8072017-07-04 14:42:20 -0700370
Paul E. McKenney764f8072017-07-04 14:42:20 -0700371.. kernel-doc:: kernel/rcu/tree.c
Paul E. McKenney764f8072017-07-04 14:42:20 -0700372
Paul E. McKenney764f8072017-07-04 14:42:20 -0700373.. kernel-doc:: kernel/rcu/tree_exp.h
Paul E. McKenney764f8072017-07-04 14:42:20 -0700374
375.. kernel-doc:: kernel/rcu/update.c
Paul E. McKenney764f8072017-07-04 14:42:20 -0700376
377.. kernel-doc:: include/linux/srcu.h
Paul E. McKenney764f8072017-07-04 14:42:20 -0700378
379.. kernel-doc:: kernel/rcu/srcutree.c
Paul E. McKenney764f8072017-07-04 14:42:20 -0700380
381.. kernel-doc:: include/linux/rculist_bl.h
Paul E. McKenney764f8072017-07-04 14:42:20 -0700382
383.. kernel-doc:: include/linux/rculist.h
Paul E. McKenney764f8072017-07-04 14:42:20 -0700384
385.. kernel-doc:: include/linux/rculist_nulls.h
Paul E. McKenney764f8072017-07-04 14:42:20 -0700386
387.. kernel-doc:: include/linux/rcu_sync.h
Paul E. McKenney764f8072017-07-04 14:42:20 -0700388
389.. kernel-doc:: kernel/rcu/sync.c