kernel-api.rst 8.9 KB

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