kernel-api.rst 8.3 KB

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