kernel-api.rst 8.5 KB

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