kernel-api.rst 7.9 KB

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