xref: /linux/Documentation/core-api/kernel-api.rst (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1====================
2The Linux Kernel API
3====================
4
5Data Types
6==========
7
8Doubly Linked Lists
9-------------------
10
11.. kernel-doc:: include/linux/list.h
12   :internal:
13
14Basic C Library Functions
15=========================
16
17When writing drivers, you cannot in general use routines which are from
18the C Library. Some of the functions have been found generally useful
19and they are listed below. The behaviour of these functions may vary
20slightly from those defined by ANSI, and these deviations are noted in
21the text.
22
23String Conversions
24------------------
25
26.. kernel-doc:: lib/vsprintf.c
27   :export:
28
29.. kernel-doc:: include/linux/kernel.h
30   :functions: kstrtol
31
32.. kernel-doc:: include/linux/kernel.h
33   :functions: kstrtoul
34
35.. kernel-doc:: lib/kstrtox.c
36   :export:
37
38String Manipulation
39-------------------
40
41.. kernel-doc:: lib/string.c
42   :export:
43
44Bit Operations
45--------------
46
47.. kernel-doc:: arch/x86/include/asm/bitops.h
48   :internal:
49
50Basic Kernel Library Functions
51==============================
52
53The Linux kernel provides more basic utility functions.
54
55Bitmap Operations
56-----------------
57
58.. kernel-doc:: lib/bitmap.c
59   :export:
60
61.. kernel-doc:: lib/bitmap.c
62   :internal:
63
64Command-line Parsing
65--------------------
66
67.. kernel-doc:: lib/cmdline.c
68   :export:
69
70CRC Functions
71-------------
72
73.. kernel-doc:: lib/crc7.c
74   :export:
75
76.. kernel-doc:: lib/crc16.c
77   :export:
78
79.. kernel-doc:: lib/crc-itu-t.c
80   :export:
81
82.. kernel-doc:: lib/crc32.c
83
84.. kernel-doc:: lib/crc-ccitt.c
85   :export:
86
87idr/ida Functions
88-----------------
89
90.. kernel-doc:: include/linux/idr.h
91   :doc: idr sync
92
93.. kernel-doc:: lib/idr.c
94   :doc: IDA description
95
96.. kernel-doc:: lib/idr.c
97   :export:
98
99Memory Management in Linux
100==========================
101
102The Slab Cache
103--------------
104
105.. kernel-doc:: include/linux/slab.h
106   :internal:
107
108.. kernel-doc:: mm/slab.c
109   :export:
110
111.. kernel-doc:: mm/util.c
112   :export:
113
114User Space Memory Access
115------------------------
116
117.. kernel-doc:: arch/x86/include/asm/uaccess_32.h
118   :internal:
119
120.. kernel-doc:: arch/x86/lib/usercopy_32.c
121   :export:
122
123More Memory Management Functions
124--------------------------------
125
126.. kernel-doc:: mm/readahead.c
127   :export:
128
129.. kernel-doc:: mm/filemap.c
130   :export:
131
132.. kernel-doc:: mm/memory.c
133   :export:
134
135.. kernel-doc:: mm/vmalloc.c
136   :export:
137
138.. kernel-doc:: mm/page_alloc.c
139   :internal:
140
141.. kernel-doc:: mm/mempool.c
142   :export:
143
144.. kernel-doc:: mm/dmapool.c
145   :export:
146
147.. kernel-doc:: mm/page-writeback.c
148   :export:
149
150.. kernel-doc:: mm/truncate.c
151   :export:
152
153Kernel IPC facilities
154=====================
155
156IPC utilities
157-------------
158
159.. kernel-doc:: ipc/util.c
160   :internal:
161
162FIFO Buffer
163===========
164
165kfifo interface
166---------------
167
168.. kernel-doc:: include/linux/kfifo.h
169   :internal:
170
171relay interface support
172=======================
173
174Relay interface support is designed to provide an efficient mechanism
175for tools and facilities to relay large amounts of data from kernel
176space to user space.
177
178relay interface
179---------------
180
181.. kernel-doc:: kernel/relay.c
182   :export:
183
184.. kernel-doc:: kernel/relay.c
185   :internal:
186
187Module Support
188==============
189
190Module Loading
191--------------
192
193.. kernel-doc:: kernel/kmod.c
194   :export:
195
196Inter Module support
197--------------------
198
199Refer to the file kernel/module.c for more information.
200
201Hardware Interfaces
202===================
203
204Interrupt Handling
205------------------
206
207.. kernel-doc:: kernel/irq/manage.c
208   :export:
209
210DMA Channels
211------------
212
213.. kernel-doc:: kernel/dma.c
214   :export:
215
216Resources Management
217--------------------
218
219.. kernel-doc:: kernel/resource.c
220   :internal:
221
222.. kernel-doc:: kernel/resource.c
223   :export:
224
225MTRR Handling
226-------------
227
228.. kernel-doc:: arch/x86/kernel/cpu/mtrr/main.c
229   :export:
230
231Security Framework
232==================
233
234.. kernel-doc:: security/security.c
235   :internal:
236
237.. kernel-doc:: security/inode.c
238   :export:
239
240Audit Interfaces
241================
242
243.. kernel-doc:: kernel/audit.c
244   :export:
245
246.. kernel-doc:: kernel/auditsc.c
247   :internal:
248
249.. kernel-doc:: kernel/auditfilter.c
250   :internal:
251
252Accounting Framework
253====================
254
255.. kernel-doc:: kernel/acct.c
256   :internal:
257
258Block Devices
259=============
260
261.. kernel-doc:: block/blk-core.c
262   :export:
263
264.. kernel-doc:: block/blk-core.c
265   :internal:
266
267.. kernel-doc:: block/blk-map.c
268   :export:
269
270.. kernel-doc:: block/blk-sysfs.c
271   :internal:
272
273.. kernel-doc:: block/blk-settings.c
274   :export:
275
276.. kernel-doc:: block/blk-exec.c
277   :export:
278
279.. kernel-doc:: block/blk-flush.c
280   :export:
281
282.. kernel-doc:: block/blk-lib.c
283   :export:
284
285.. kernel-doc:: block/blk-tag.c
286   :export:
287
288.. kernel-doc:: block/blk-tag.c
289   :internal:
290
291.. kernel-doc:: block/blk-integrity.c
292   :export:
293
294.. kernel-doc:: kernel/trace/blktrace.c
295   :internal:
296
297.. kernel-doc:: block/genhd.c
298   :internal:
299
300.. kernel-doc:: block/genhd.c
301   :export:
302
303Char devices
304============
305
306.. kernel-doc:: fs/char_dev.c
307   :export:
308
309Clock Framework
310===============
311
312The clock framework defines programming interfaces to support software
313management of the system clock tree. This framework is widely used with
314System-On-Chip (SOC) platforms to support power management and various
315devices which may need custom clock rates. Note that these "clocks"
316don't relate to timekeeping or real time clocks (RTCs), each of which
317have separate frameworks. These :c:type:`struct clk <clk>`
318instances may be used to manage for example a 96 MHz signal that is used
319to shift bits into and out of peripherals or busses, or otherwise
320trigger synchronous state machine transitions in system hardware.
321
322Power management is supported by explicit software clock gating: unused
323clocks are disabled, so the system doesn't waste power changing the
324state of transistors that aren't in active use. On some systems this may
325be backed by hardware clock gating, where clocks are gated without being
326disabled in software. Sections of chips that are powered but not clocked
327may be able to retain their last state. This low power state is often
328called a *retention mode*. This mode still incurs leakage currents,
329especially with finer circuit geometries, but for CMOS circuits power is
330mostly used by clocked state changes.
331
332Power-aware drivers only enable their clocks when the device they manage
333is in active use. Also, system sleep states often differ according to
334which clock domains are active: while a "standby" state may allow wakeup
335from several active domains, a "mem" (suspend-to-RAM) state may require
336a more wholesale shutdown of clocks derived from higher speed PLLs and
337oscillators, limiting the number of possible wakeup event sources. A
338driver's suspend method may need to be aware of system-specific clock
339constraints on the target sleep state.
340
341Some platforms support programmable clock generators. These can be used
342by external chips of various kinds, such as other CPUs, multimedia
343codecs, and devices with strict requirements for interface clocking.
344
345.. kernel-doc:: include/linux/clk.h
346   :internal:
347