kernel-api.rst 7.4 KB

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