kernel-api.rst 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. ====================
  2. The Linux Kernel API
  3. ====================
  4. List Management Functions
  5. =========================
  6. .. kernel-doc:: include/linux/list.h
  7. :internal:
  8. Basic C Library Functions
  9. =========================
  10. When writing drivers, you cannot in general use routines which are from
  11. the C Library. Some of the functions have been found generally useful
  12. and they are listed below. The behaviour of these functions may vary
  13. slightly from those defined by ANSI, and these deviations are noted in
  14. the text.
  15. String Conversions
  16. ------------------
  17. .. kernel-doc:: lib/vsprintf.c
  18. :export:
  19. .. kernel-doc:: include/linux/kstrtox.h
  20. :functions: kstrtol kstrtoul
  21. .. kernel-doc:: lib/kstrtox.c
  22. :export:
  23. .. kernel-doc:: lib/string_helpers.c
  24. :export:
  25. String Manipulation
  26. -------------------
  27. .. kernel-doc:: lib/string.c
  28. :export:
  29. .. kernel-doc:: include/linux/string.h
  30. :internal:
  31. .. kernel-doc:: mm/util.c
  32. :functions: kstrdup kstrdup_const kstrndup kmemdup kmemdup_nul memdup_user
  33. vmemdup_user strndup_user memdup_user_nul
  34. Basic Kernel Library Functions
  35. ==============================
  36. The Linux kernel provides more basic utility functions.
  37. Bit Operations
  38. --------------
  39. .. kernel-doc:: include/asm-generic/bitops/instrumented-atomic.h
  40. :internal:
  41. .. kernel-doc:: include/asm-generic/bitops/instrumented-non-atomic.h
  42. :internal:
  43. .. kernel-doc:: include/asm-generic/bitops/instrumented-lock.h
  44. :internal:
  45. Bitmap Operations
  46. -----------------
  47. .. kernel-doc:: lib/bitmap.c
  48. :doc: bitmap introduction
  49. .. kernel-doc:: include/linux/bitmap.h
  50. :doc: declare bitmap
  51. .. kernel-doc:: include/linux/bitmap.h
  52. :doc: bitmap overview
  53. .. kernel-doc:: include/linux/bitmap.h
  54. :doc: bitmap bitops
  55. .. kernel-doc:: lib/bitmap.c
  56. :export:
  57. .. kernel-doc:: lib/bitmap.c
  58. :internal:
  59. .. kernel-doc:: include/linux/bitmap.h
  60. :internal:
  61. Command-line Parsing
  62. --------------------
  63. .. kernel-doc:: lib/cmdline.c
  64. :export:
  65. Sorting
  66. -------
  67. .. kernel-doc:: lib/sort.c
  68. :export:
  69. .. kernel-doc:: lib/list_sort.c
  70. :export:
  71. Text Searching
  72. --------------
  73. .. kernel-doc:: lib/textsearch.c
  74. :doc: ts_intro
  75. .. kernel-doc:: lib/textsearch.c
  76. :export:
  77. .. kernel-doc:: include/linux/textsearch.h
  78. :functions: textsearch_find textsearch_next \
  79. textsearch_get_pattern textsearch_get_pattern_len
  80. CRC and Math Functions in Linux
  81. ===============================
  82. Arithmetic Overflow Checking
  83. ----------------------------
  84. .. kernel-doc:: include/linux/overflow.h
  85. :internal:
  86. CRC Functions
  87. -------------
  88. .. kernel-doc:: lib/crc4.c
  89. :export:
  90. .. kernel-doc:: lib/crc7.c
  91. :export:
  92. .. kernel-doc:: lib/crc8.c
  93. :export:
  94. .. kernel-doc:: lib/crc16.c
  95. :export:
  96. .. kernel-doc:: lib/crc32.c
  97. .. kernel-doc:: lib/crc-ccitt.c
  98. :export:
  99. .. kernel-doc:: lib/crc-itu-t.c
  100. :export:
  101. Base 2 log and power Functions
  102. ------------------------------
  103. .. kernel-doc:: include/linux/log2.h
  104. :internal:
  105. Integer power Functions
  106. -----------------------
  107. .. kernel-doc:: lib/math/int_pow.c
  108. :export:
  109. .. kernel-doc:: lib/math/int_sqrt.c
  110. :export:
  111. Division Functions
  112. ------------------
  113. .. kernel-doc:: include/asm-generic/div64.h
  114. :functions: do_div
  115. .. kernel-doc:: include/linux/math64.h
  116. :internal:
  117. .. kernel-doc:: lib/math/div64.c
  118. :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64
  119. .. kernel-doc:: lib/math/gcd.c
  120. :export:
  121. UUID/GUID
  122. ---------
  123. .. kernel-doc:: lib/uuid.c
  124. :export:
  125. Kernel IPC facilities
  126. =====================
  127. IPC utilities
  128. -------------
  129. .. kernel-doc:: ipc/util.c
  130. :internal:
  131. FIFO Buffer
  132. ===========
  133. kfifo interface
  134. ---------------
  135. .. kernel-doc:: include/linux/kfifo.h
  136. :internal:
  137. relay interface support
  138. =======================
  139. Relay interface support is designed to provide an efficient mechanism
  140. for tools and facilities to relay large amounts of data from kernel
  141. space to user space.
  142. relay interface
  143. ---------------
  144. .. kernel-doc:: kernel/relay.c
  145. :export:
  146. .. kernel-doc:: kernel/relay.c
  147. :internal:
  148. Module Support
  149. ==============
  150. Module Loading
  151. --------------
  152. .. kernel-doc:: kernel/kmod.c
  153. :export:
  154. Inter Module support
  155. --------------------
  156. Refer to the files in kernel/module/ for more information.
  157. Hardware Interfaces
  158. ===================
  159. DMA Channels
  160. ------------
  161. .. kernel-doc:: kernel/dma.c
  162. :export:
  163. Resources Management
  164. --------------------
  165. .. kernel-doc:: kernel/resource.c
  166. :internal:
  167. .. kernel-doc:: kernel/resource.c
  168. :export:
  169. MTRR Handling
  170. -------------
  171. .. kernel-doc:: arch/x86/kernel/cpu/mtrr/mtrr.c
  172. :export:
  173. Security Framework
  174. ==================
  175. .. kernel-doc:: security/security.c
  176. :internal:
  177. .. kernel-doc:: security/inode.c
  178. :export:
  179. Audit Interfaces
  180. ================
  181. .. kernel-doc:: kernel/audit.c
  182. :export:
  183. .. kernel-doc:: kernel/auditsc.c
  184. :internal:
  185. .. kernel-doc:: kernel/auditfilter.c
  186. :internal:
  187. Accounting Framework
  188. ====================
  189. .. kernel-doc:: kernel/acct.c
  190. :internal:
  191. Block Devices
  192. =============
  193. .. kernel-doc:: include/linux/bio.h
  194. .. kernel-doc:: block/blk-core.c
  195. :export:
  196. .. kernel-doc:: block/blk-core.c
  197. :internal:
  198. .. kernel-doc:: block/blk-map.c
  199. :export:
  200. .. kernel-doc:: block/blk-sysfs.c
  201. :internal:
  202. .. kernel-doc:: block/blk-settings.c
  203. :export:
  204. .. kernel-doc:: block/blk-flush.c
  205. :export:
  206. .. kernel-doc:: block/blk-lib.c
  207. :export:
  208. .. kernel-doc:: block/blk-integrity.c
  209. :export:
  210. .. kernel-doc:: kernel/trace/blktrace.c
  211. :internal:
  212. .. kernel-doc:: block/genhd.c
  213. :internal:
  214. .. kernel-doc:: block/genhd.c
  215. :export:
  216. .. kernel-doc:: block/bdev.c
  217. :export:
  218. Char devices
  219. ============
  220. .. kernel-doc:: fs/char_dev.c
  221. :export:
  222. Clock Framework
  223. ===============
  224. The clock framework defines programming interfaces to support software
  225. management of the system clock tree. This framework is widely used with
  226. System-On-Chip (SOC) platforms to support power management and various
  227. devices which may need custom clock rates. Note that these "clocks"
  228. don't relate to timekeeping or real time clocks (RTCs), each of which
  229. have separate frameworks. These :c:type:`struct clk <clk>`
  230. instances may be used to manage for example a 96 MHz signal that is used
  231. to shift bits into and out of peripherals or busses, or otherwise
  232. trigger synchronous state machine transitions in system hardware.
  233. Power management is supported by explicit software clock gating: unused
  234. clocks are disabled, so the system doesn't waste power changing the
  235. state of transistors that aren't in active use. On some systems this may
  236. be backed by hardware clock gating, where clocks are gated without being
  237. disabled in software. Sections of chips that are powered but not clocked
  238. may be able to retain their last state. This low power state is often
  239. called a *retention mode*. This mode still incurs leakage currents,
  240. especially with finer circuit geometries, but for CMOS circuits power is
  241. mostly used by clocked state changes.
  242. Power-aware drivers only enable their clocks when the device they manage
  243. is in active use. Also, system sleep states often differ according to
  244. which clock domains are active: while a "standby" state may allow wakeup
  245. from several active domains, a "mem" (suspend-to-RAM) state may require
  246. a more wholesale shutdown of clocks derived from higher speed PLLs and
  247. oscillators, limiting the number of possible wakeup event sources. A
  248. driver's suspend method may need to be aware of system-specific clock
  249. constraints on the target sleep state.
  250. Some platforms support programmable clock generators. These can be used
  251. by external chips of various kinds, such as other CPUs, multimedia
  252. codecs, and devices with strict requirements for interface clocking.
  253. .. kernel-doc:: include/linux/clk.h
  254. :internal:
  255. Synchronization Primitives
  256. ==========================
  257. Read-Copy Update (RCU)
  258. ----------------------
  259. .. kernel-doc:: include/linux/rcupdate.h
  260. .. kernel-doc:: kernel/rcu/tree.c
  261. .. kernel-doc:: kernel/rcu/tree_exp.h
  262. .. kernel-doc:: kernel/rcu/update.c
  263. .. kernel-doc:: include/linux/srcu.h
  264. .. kernel-doc:: kernel/rcu/srcutree.c
  265. .. kernel-doc:: include/linux/rculist_bl.h
  266. .. kernel-doc:: include/linux/rculist.h
  267. .. kernel-doc:: include/linux/rculist_nulls.h
  268. .. kernel-doc:: include/linux/rcu_sync.h
  269. .. kernel-doc:: kernel/rcu/sync.c