Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 1 | ==================== |
| 2 | The Linux Kernel API |
| 3 | ==================== |
| 4 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 5 | |
Randy Dunlap | 416c751 | 2017-09-17 15:19:10 -0700 | [diff] [blame] | 6 | List Management Functions |
| 7 | ========================= |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 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 | |
Andy Shevchenko | b422124 | 2019-06-05 19:39:44 +0300 | [diff] [blame] | 36 | .. kernel-doc:: lib/string_helpers.c |
| 37 | :export: |
| 38 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 39 | String Manipulation |
| 40 | ------------------- |
| 41 | |
| 42 | .. kernel-doc:: lib/string.c |
| 43 | :export: |
| 44 | |
Joe Perches | 917cda2 | 2019-09-25 16:46:13 -0700 | [diff] [blame] | 45 | .. kernel-doc:: include/linux/string.h |
| 46 | :internal: |
| 47 | |
Mike Rapoport | 1595617 | 2018-08-23 17:01:09 -0700 | [diff] [blame] | 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 | |
Randy Dunlap | eacc670 | 2018-04-26 18:11:02 -0700 | [diff] [blame] | 52 | Basic Kernel Library Functions |
| 53 | ============================== |
| 54 | |
| 55 | The Linux kernel provides more basic utility functions. |
| 56 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 57 | Bit Operations |
| 58 | -------------- |
| 59 | |
Daniel Axtens | 81d2c6f | 2019-08-20 12:49:40 +1000 | [diff] [blame] | 60 | .. kernel-doc:: include/asm-generic/bitops/instrumented-atomic.h |
| 61 | :internal: |
| 62 | |
Daniel Axtens | 81d2c6f | 2019-08-20 12:49:40 +1000 | [diff] [blame] | 63 | .. kernel-doc:: include/asm-generic/bitops/instrumented-non-atomic.h |
| 64 | :internal: |
| 65 | |
Daniel Axtens | 81d2c6f | 2019-08-20 12:49:40 +1000 | [diff] [blame] | 66 | .. kernel-doc:: include/asm-generic/bitops/instrumented-lock.h |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 67 | :internal: |
| 68 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 69 | Bitmap Operations |
| 70 | ----------------- |
| 71 | |
| 72 | .. kernel-doc:: lib/bitmap.c |
Randy Dunlap | 7d7363e | 2017-10-16 16:32:51 -0700 | [diff] [blame] | 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 |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 85 | :export: |
| 86 | |
| 87 | .. kernel-doc:: lib/bitmap.c |
| 88 | :internal: |
| 89 | |
Randy Dunlap | 404376a | 2017-09-17 19:07:10 -0700 | [diff] [blame] | 90 | .. kernel-doc:: include/linux/bitmap.h |
| 91 | :internal: |
| 92 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 93 | Command-line Parsing |
| 94 | -------------------- |
| 95 | |
| 96 | .. kernel-doc:: lib/cmdline.c |
| 97 | :export: |
| 98 | |
Randy Dunlap | eacc670 | 2018-04-26 18:11:02 -0700 | [diff] [blame] | 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 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 124 | CRC Functions |
| 125 | ------------- |
| 126 | |
Randy Dunlap | 8a29896 | 2017-09-08 16:35:55 -0700 | [diff] [blame] | 127 | .. kernel-doc:: lib/crc4.c |
| 128 | :export: |
| 129 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 130 | .. kernel-doc:: lib/crc7.c |
| 131 | :export: |
| 132 | |
Randy Dunlap | 8a29896 | 2017-09-08 16:35:55 -0700 | [diff] [blame] | 133 | .. kernel-doc:: lib/crc8.c |
| 134 | :export: |
| 135 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 136 | .. kernel-doc:: lib/crc16.c |
| 137 | :export: |
| 138 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 139 | .. kernel-doc:: lib/crc32.c |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 140 | |
| 141 | .. kernel-doc:: lib/crc-ccitt.c |
| 142 | :export: |
| 143 | |
Randy Dunlap | 8a29896 | 2017-09-08 16:35:55 -0700 | [diff] [blame] | 144 | .. kernel-doc:: lib/crc-itu-t.c |
| 145 | :export: |
| 146 | |
Randy Dunlap | 68e5125 | 2017-09-30 08:43:53 -0700 | [diff] [blame] | 147 | Base 2 log and power Functions |
| 148 | ------------------------------ |
| 149 | |
| 150 | .. kernel-doc:: include/linux/log2.h |
| 151 | :internal: |
| 152 | |
Andy Shevchenko | 58d4946 | 2019-06-05 19:51:13 +0300 | [diff] [blame] | 153 | Integer power Functions |
| 154 | ----------------------- |
| 155 | |
| 156 | .. kernel-doc:: lib/math/int_pow.c |
| 157 | :export: |
| 158 | |
| 159 | .. kernel-doc:: lib/math/int_sqrt.c |
| 160 | :export: |
| 161 | |
Randy Dunlap | 68e5125 | 2017-09-30 08:43:53 -0700 | [diff] [blame] | 162 | Division Functions |
| 163 | ------------------ |
| 164 | |
| 165 | .. kernel-doc:: include/asm-generic/div64.h |
| 166 | :functions: do_div |
| 167 | |
| 168 | .. kernel-doc:: include/linux/math64.h |
| 169 | :internal: |
| 170 | |
Andy Shevchenko | 2c64e9c | 2019-05-14 15:43:05 -0700 | [diff] [blame] | 171 | .. kernel-doc:: lib/math/div64.c |
Randy Dunlap | 68e5125 | 2017-09-30 08:43:53 -0700 | [diff] [blame] | 172 | :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64 |
| 173 | |
Andy Shevchenko | 2c64e9c | 2019-05-14 15:43:05 -0700 | [diff] [blame] | 174 | .. kernel-doc:: lib/math/gcd.c |
Randy Dunlap | 68e5125 | 2017-09-30 08:43:53 -0700 | [diff] [blame] | 175 | :export: |
| 176 | |
Randy Dunlap | d063623 | 2017-11-29 12:32:42 -0800 | [diff] [blame] | 177 | UUID/GUID |
| 178 | --------- |
| 179 | |
| 180 | .. kernel-doc:: lib/uuid.c |
| 181 | :export: |
| 182 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 183 | Kernel IPC facilities |
| 184 | ===================== |
| 185 | |
| 186 | IPC utilities |
| 187 | ------------- |
| 188 | |
| 189 | .. kernel-doc:: ipc/util.c |
| 190 | :internal: |
| 191 | |
| 192 | FIFO Buffer |
| 193 | =========== |
| 194 | |
| 195 | kfifo interface |
| 196 | --------------- |
| 197 | |
| 198 | .. kernel-doc:: include/linux/kfifo.h |
| 199 | :internal: |
| 200 | |
| 201 | relay interface support |
| 202 | ======================= |
| 203 | |
| 204 | Relay interface support is designed to provide an efficient mechanism |
| 205 | for tools and facilities to relay large amounts of data from kernel |
| 206 | space to user space. |
| 207 | |
| 208 | relay interface |
| 209 | --------------- |
| 210 | |
| 211 | .. kernel-doc:: kernel/relay.c |
| 212 | :export: |
| 213 | |
| 214 | .. kernel-doc:: kernel/relay.c |
| 215 | :internal: |
| 216 | |
| 217 | Module Support |
| 218 | ============== |
| 219 | |
| 220 | Module Loading |
| 221 | -------------- |
| 222 | |
| 223 | .. kernel-doc:: kernel/kmod.c |
| 224 | :export: |
| 225 | |
| 226 | Inter Module support |
| 227 | -------------------- |
| 228 | |
| 229 | Refer to the file kernel/module.c for more information. |
| 230 | |
| 231 | Hardware Interfaces |
| 232 | =================== |
| 233 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 234 | DMA Channels |
| 235 | ------------ |
| 236 | |
| 237 | .. kernel-doc:: kernel/dma.c |
| 238 | :export: |
| 239 | |
| 240 | Resources Management |
| 241 | -------------------- |
| 242 | |
| 243 | .. kernel-doc:: kernel/resource.c |
| 244 | :internal: |
| 245 | |
| 246 | .. kernel-doc:: kernel/resource.c |
| 247 | :export: |
| 248 | |
| 249 | MTRR Handling |
| 250 | ------------- |
| 251 | |
Randy Dunlap | 3ed1d01 | 2018-06-16 17:09:41 -0700 | [diff] [blame] | 252 | .. kernel-doc:: arch/x86/kernel/cpu/mtrr/mtrr.c |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 253 | :export: |
| 254 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 255 | Security Framework |
| 256 | ================== |
| 257 | |
| 258 | .. kernel-doc:: security/security.c |
| 259 | :internal: |
| 260 | |
| 261 | .. kernel-doc:: security/inode.c |
| 262 | :export: |
| 263 | |
| 264 | Audit Interfaces |
| 265 | ================ |
| 266 | |
| 267 | .. kernel-doc:: kernel/audit.c |
| 268 | :export: |
| 269 | |
| 270 | .. kernel-doc:: kernel/auditsc.c |
| 271 | :internal: |
| 272 | |
| 273 | .. kernel-doc:: kernel/auditfilter.c |
| 274 | :internal: |
| 275 | |
| 276 | Accounting Framework |
| 277 | ==================== |
| 278 | |
| 279 | .. kernel-doc:: kernel/acct.c |
| 280 | :internal: |
| 281 | |
| 282 | Block Devices |
| 283 | ============= |
| 284 | |
| 285 | .. kernel-doc:: block/blk-core.c |
| 286 | :export: |
| 287 | |
| 288 | .. kernel-doc:: block/blk-core.c |
| 289 | :internal: |
| 290 | |
| 291 | .. kernel-doc:: block/blk-map.c |
| 292 | :export: |
| 293 | |
| 294 | .. kernel-doc:: block/blk-sysfs.c |
| 295 | :internal: |
| 296 | |
| 297 | .. kernel-doc:: block/blk-settings.c |
| 298 | :export: |
| 299 | |
| 300 | .. kernel-doc:: block/blk-exec.c |
| 301 | :export: |
| 302 | |
| 303 | .. kernel-doc:: block/blk-flush.c |
| 304 | :export: |
| 305 | |
| 306 | .. kernel-doc:: block/blk-lib.c |
| 307 | :export: |
| 308 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 309 | .. kernel-doc:: block/blk-integrity.c |
| 310 | :export: |
| 311 | |
| 312 | .. kernel-doc:: kernel/trace/blktrace.c |
| 313 | :internal: |
| 314 | |
| 315 | .. kernel-doc:: block/genhd.c |
| 316 | :internal: |
| 317 | |
| 318 | .. kernel-doc:: block/genhd.c |
| 319 | :export: |
| 320 | |
| 321 | Char devices |
| 322 | ============ |
| 323 | |
| 324 | .. kernel-doc:: fs/char_dev.c |
| 325 | :export: |
| 326 | |
Mauro Carvalho Chehab | baca8a0 | 2017-03-30 17:11:32 -0300 | [diff] [blame] | 327 | Clock Framework |
| 328 | =============== |
| 329 | |
| 330 | The clock framework defines programming interfaces to support software |
| 331 | management of the system clock tree. This framework is widely used with |
| 332 | System-On-Chip (SOC) platforms to support power management and various |
| 333 | devices which may need custom clock rates. Note that these "clocks" |
| 334 | don't relate to timekeeping or real time clocks (RTCs), each of which |
| 335 | have separate frameworks. These :c:type:`struct clk <clk>` |
| 336 | instances may be used to manage for example a 96 MHz signal that is used |
| 337 | to shift bits into and out of peripherals or busses, or otherwise |
| 338 | trigger synchronous state machine transitions in system hardware. |
| 339 | |
| 340 | Power management is supported by explicit software clock gating: unused |
| 341 | clocks are disabled, so the system doesn't waste power changing the |
| 342 | state of transistors that aren't in active use. On some systems this may |
| 343 | be backed by hardware clock gating, where clocks are gated without being |
| 344 | disabled in software. Sections of chips that are powered but not clocked |
| 345 | may be able to retain their last state. This low power state is often |
| 346 | called a *retention mode*. This mode still incurs leakage currents, |
| 347 | especially with finer circuit geometries, but for CMOS circuits power is |
| 348 | mostly used by clocked state changes. |
| 349 | |
| 350 | Power-aware drivers only enable their clocks when the device they manage |
| 351 | is in active use. Also, system sleep states often differ according to |
| 352 | which clock domains are active: while a "standby" state may allow wakeup |
| 353 | from several active domains, a "mem" (suspend-to-RAM) state may require |
| 354 | a more wholesale shutdown of clocks derived from higher speed PLLs and |
| 355 | oscillators, limiting the number of possible wakeup event sources. A |
| 356 | driver's suspend method may need to be aware of system-specific clock |
| 357 | constraints on the target sleep state. |
| 358 | |
| 359 | Some platforms support programmable clock generators. These can be used |
| 360 | by external chips of various kinds, such as other CPUs, multimedia |
| 361 | codecs, and devices with strict requirements for interface clocking. |
| 362 | |
| 363 | .. kernel-doc:: include/linux/clk.h |
| 364 | :internal: |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 365 | |
| 366 | Synchronization Primitives |
| 367 | ========================== |
| 368 | |
| 369 | Read-Copy Update (RCU) |
| 370 | ---------------------- |
| 371 | |
| 372 | .. kernel-doc:: include/linux/rcupdate.h |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 373 | |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 374 | .. kernel-doc:: kernel/rcu/tree.c |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 375 | |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 376 | .. kernel-doc:: kernel/rcu/tree_exp.h |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 377 | |
| 378 | .. kernel-doc:: kernel/rcu/update.c |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 379 | |
| 380 | .. kernel-doc:: include/linux/srcu.h |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 381 | |
| 382 | .. kernel-doc:: kernel/rcu/srcutree.c |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 383 | |
| 384 | .. kernel-doc:: include/linux/rculist_bl.h |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 385 | |
| 386 | .. kernel-doc:: include/linux/rculist.h |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 387 | |
| 388 | .. kernel-doc:: include/linux/rculist_nulls.h |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 389 | |
| 390 | .. kernel-doc:: include/linux/rcu_sync.h |
Paul E. McKenney | 764f807 | 2017-07-04 14:42:20 -0700 | [diff] [blame] | 391 | |
| 392 | .. kernel-doc:: kernel/rcu/sync.c |