linux/Documentation/core-api/kernel-api.rst
<<
>>
Prefs
   1====================
   2The Linux Kernel API
   3====================
   4
   5
   6List Management Functions
   7=========================
   8
   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
  36.. kernel-doc:: lib/string_helpers.c
  37   :export:
  38
  39String Manipulation
  40-------------------
  41
  42.. kernel-doc:: lib/string.c
  43   :export:
  44
  45.. kernel-doc:: include/linux/string.h
  46   :internal:
  47
  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
  52Basic Kernel Library Functions
  53==============================
  54
  55The Linux kernel provides more basic utility functions.
  56
  57Bit Operations
  58--------------
  59
  60.. kernel-doc:: include/asm-generic/bitops-instrumented.h
  61   :internal:
  62
  63Bitmap Operations
  64-----------------
  65
  66.. kernel-doc:: lib/bitmap.c
  67   :doc: bitmap introduction
  68
  69.. kernel-doc:: include/linux/bitmap.h
  70   :doc: declare bitmap
  71
  72.. kernel-doc:: include/linux/bitmap.h
  73   :doc: bitmap overview
  74
  75.. kernel-doc:: include/linux/bitmap.h
  76   :doc: bitmap bitops
  77
  78.. kernel-doc:: lib/bitmap.c
  79   :export:
  80
  81.. kernel-doc:: lib/bitmap.c
  82   :internal:
  83
  84.. kernel-doc:: include/linux/bitmap.h
  85   :internal:
  86
  87Command-line Parsing
  88--------------------
  89
  90.. kernel-doc:: lib/cmdline.c
  91   :export:
  92
  93Sorting
  94-------
  95
  96.. kernel-doc:: lib/sort.c
  97   :export:
  98
  99.. kernel-doc:: lib/list_sort.c
 100   :export:
 101
 102Text Searching
 103--------------
 104
 105.. kernel-doc:: lib/textsearch.c
 106   :doc: ts_intro
 107
 108.. kernel-doc:: lib/textsearch.c
 109   :export:
 110
 111.. kernel-doc:: include/linux/textsearch.h
 112   :functions: textsearch_find textsearch_next \
 113               textsearch_get_pattern textsearch_get_pattern_len
 114
 115CRC and Math Functions in Linux
 116===============================
 117
 118CRC Functions
 119-------------
 120
 121.. kernel-doc:: lib/crc4.c
 122   :export:
 123
 124.. kernel-doc:: lib/crc7.c
 125   :export:
 126
 127.. kernel-doc:: lib/crc8.c
 128   :export:
 129
 130.. kernel-doc:: lib/crc16.c
 131   :export:
 132
 133.. kernel-doc:: lib/crc32.c
 134
 135.. kernel-doc:: lib/crc-ccitt.c
 136   :export:
 137
 138.. kernel-doc:: lib/crc-itu-t.c
 139   :export:
 140
 141Base 2 log and power Functions
 142------------------------------
 143
 144.. kernel-doc:: include/linux/log2.h
 145   :internal:
 146
 147Integer power Functions
 148-----------------------
 149
 150.. kernel-doc:: lib/math/int_pow.c
 151   :export:
 152
 153.. kernel-doc:: lib/math/int_sqrt.c
 154   :export:
 155
 156Division Functions
 157------------------
 158
 159.. kernel-doc:: include/asm-generic/div64.h
 160   :functions: do_div
 161
 162.. kernel-doc:: include/linux/math64.h
 163   :internal:
 164
 165.. kernel-doc:: lib/math/div64.c
 166   :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64
 167
 168.. kernel-doc:: lib/math/gcd.c
 169   :export:
 170
 171UUID/GUID
 172---------
 173
 174.. kernel-doc:: lib/uuid.c
 175   :export:
 176
 177Kernel IPC facilities
 178=====================
 179
 180IPC utilities
 181-------------
 182
 183.. kernel-doc:: ipc/util.c
 184   :internal:
 185
 186FIFO Buffer
 187===========
 188
 189kfifo interface
 190---------------
 191
 192.. kernel-doc:: include/linux/kfifo.h
 193   :internal:
 194
 195relay interface support
 196=======================
 197
 198Relay interface support is designed to provide an efficient mechanism
 199for tools and facilities to relay large amounts of data from kernel
 200space to user space.
 201
 202relay interface
 203---------------
 204
 205.. kernel-doc:: kernel/relay.c
 206   :export:
 207
 208.. kernel-doc:: kernel/relay.c
 209   :internal:
 210
 211Module Support
 212==============
 213
 214Module Loading
 215--------------
 216
 217.. kernel-doc:: kernel/kmod.c
 218   :export:
 219
 220Inter Module support
 221--------------------
 222
 223Refer to the file kernel/module.c for more information.
 224
 225Hardware Interfaces
 226===================
 227
 228Interrupt Handling
 229------------------
 230
 231.. kernel-doc:: kernel/irq/manage.c
 232   :export:
 233
 234DMA Channels
 235------------
 236
 237.. kernel-doc:: kernel/dma.c
 238   :export:
 239
 240Resources Management
 241--------------------
 242
 243.. kernel-doc:: kernel/resource.c
 244   :internal:
 245
 246.. kernel-doc:: kernel/resource.c
 247   :export:
 248
 249MTRR Handling
 250-------------
 251
 252.. kernel-doc:: arch/x86/kernel/cpu/mtrr/mtrr.c
 253   :export:
 254
 255Security Framework
 256==================
 257
 258.. kernel-doc:: security/security.c
 259   :internal:
 260
 261.. kernel-doc:: security/inode.c
 262   :export:
 263
 264Audit 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
 276Accounting Framework
 277====================
 278
 279.. kernel-doc:: kernel/acct.c
 280   :internal:
 281
 282Block 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
 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
 321Char devices
 322============
 323
 324.. kernel-doc:: fs/char_dev.c
 325   :export:
 326
 327Clock Framework
 328===============
 329
 330The clock framework defines programming interfaces to support software
 331management of the system clock tree. This framework is widely used with
 332System-On-Chip (SOC) platforms to support power management and various
 333devices which may need custom clock rates. Note that these "clocks"
 334don't relate to timekeeping or real time clocks (RTCs), each of which
 335have separate frameworks. These :c:type:`struct clk <clk>`
 336instances may be used to manage for example a 96 MHz signal that is used
 337to shift bits into and out of peripherals or busses, or otherwise
 338trigger synchronous state machine transitions in system hardware.
 339
 340Power management is supported by explicit software clock gating: unused
 341clocks are disabled, so the system doesn't waste power changing the
 342state of transistors that aren't in active use. On some systems this may
 343be backed by hardware clock gating, where clocks are gated without being
 344disabled in software. Sections of chips that are powered but not clocked
 345may be able to retain their last state. This low power state is often
 346called a *retention mode*. This mode still incurs leakage currents,
 347especially with finer circuit geometries, but for CMOS circuits power is
 348mostly used by clocked state changes.
 349
 350Power-aware drivers only enable their clocks when the device they manage
 351is in active use. Also, system sleep states often differ according to
 352which clock domains are active: while a "standby" state may allow wakeup
 353from several active domains, a "mem" (suspend-to-RAM) state may require
 354a more wholesale shutdown of clocks derived from higher speed PLLs and
 355oscillators, limiting the number of possible wakeup event sources. A
 356driver's suspend method may need to be aware of system-specific clock
 357constraints on the target sleep state.
 358
 359Some platforms support programmable clock generators. These can be used
 360by external chips of various kinds, such as other CPUs, multimedia
 361codecs, and devices with strict requirements for interface clocking.
 362
 363.. kernel-doc:: include/linux/clk.h
 364   :internal:
 365
 366Synchronization Primitives
 367==========================
 368
 369Read-Copy Update (RCU)
 370----------------------
 371
 372.. kernel-doc:: include/linux/rcupdate.h
 373
 374.. kernel-doc:: kernel/rcu/tree.c
 375
 376.. kernel-doc:: kernel/rcu/tree_exp.h
 377
 378.. kernel-doc:: kernel/rcu/update.c
 379
 380.. kernel-doc:: include/linux/srcu.h
 381
 382.. kernel-doc:: kernel/rcu/srcutree.c
 383
 384.. kernel-doc:: include/linux/rculist_bl.h
 385
 386.. kernel-doc:: include/linux/rculist.h
 387
 388.. kernel-doc:: include/linux/rculist_nulls.h
 389
 390.. kernel-doc:: include/linux/rcu_sync.h
 391
 392.. kernel-doc:: kernel/rcu/sync.c
 393