← Documents Documentation/core-api/kernel-api.rst GitHub 원문 ↗

Linux 6.18.37 · Core API

The Linux Kernel API

문자열·비트맵·수학·IPC·모듈·하드웨어·보안·블록 장치·클록·RCU 등 범용 커널 API의 자동 생성 참조 문서를 모은 색인입니다.

Source pathDocumentation/core-api/kernel-api.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

kernel-api.rst:1-430

이 페이지는 여러 하위 시스템에서 공통으로 사용하는 Linux 커널 API를 한곳에 모은 참조 색인입니다. 각 kernel-doc 지시문은 해당 source path의 공개 함수, 내부 함수 또는 특정 문서 블록을 가져옵니다.

앞부분은 C 라이브러리를 대신하는 문자열·비트·비트맵·정렬·검색 함수와 CRC 및 정수 수학을 다룹니다. 이어서 IPC, FIFO, relay, 모듈, DMA와 resource, 보안·감사·회계, 블록 및 문자 장치 API를 연결합니다.

clock framework는 SoC 장치의 clock tree와 전력 상태를 관리하며 timekeeping이나 RTC와는 별개입니다. 마지막 RCU 절은 read-copy update와 SRCU, list helper, 동기화 및 stall 진단 관련 kernel-doc을 모읍니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 ====================
2 The Linux Kernel API
3 ====================
4
5
6 Basic C Library Functions
7 =========================
8
9 When writing drivers, you cannot in general use routines which are from
10 the C Library. Some of the functions have been found generally useful
11 and they are listed below. The behaviour of these functions may vary
12 slightly from those defined by ANSI, and these deviations are noted in
13 the text.
14
15 String Conversions
16 ------------------
17
18 .. kernel-doc:: lib/vsprintf.c
19 :export:
20
21 .. kernel-doc:: include/linux/kstrtox.h
22 :functions: kstrtol kstrtoul
23
24 .. kernel-doc:: lib/kstrtox.c
25 :export:
26
27 .. kernel-doc:: lib/string_helpers.c
28 :export:
29
30 String Manipulation
31 -------------------
32
33 .. kernel-doc:: include/linux/fortify-string.h
34 :internal:
35
36 .. kernel-doc:: lib/string.c
37 :export:
38
39 .. kernel-doc:: include/linux/string.h
40 :internal:
41
42 .. kernel-doc:: mm/util.c
43 :functions: kstrdup kstrdup_const kstrndup kmemdup kmemdup_nul memdup_user
44 vmemdup_user strndup_user memdup_user_nul
45
46 Basic Kernel Library Functions
47 ==============================
48
49 The Linux kernel provides more basic utility functions.
50
51 Bit Operations
52 --------------
53
54 .. kernel-doc:: include/asm-generic/bitops/instrumented-atomic.h
55 :internal:
56
57 .. kernel-doc:: include/asm-generic/bitops/instrumented-non-atomic.h
58 :internal:
59
60 .. kernel-doc:: include/asm-generic/bitops/instrumented-lock.h
61 :internal:
62
63 Bitmap Operations
64 -----------------
65
66 .. kernel-doc:: lib/bitmap.c
67 :doc: bitmap introduction
68
69 .. kernel-doc:: include/linux/bitmap.h
70 :doc: declare bitmap
71
72 .. kernel-doc:: include/linux/bitmap.h
73 :doc: bitmap overview
74
75 .. kernel-doc:: include/linux/bitmap.h
76 :doc: bitmap bitops
77
78 .. kernel-doc:: lib/bitmap.c
79 :export:
80
81 .. kernel-doc:: lib/bitmap.c
82 :internal:
83
84 .. kernel-doc:: include/linux/bitmap.h
85 :internal:
86
87 Command-line Parsing
88 --------------------
89
90 .. kernel-doc:: lib/cmdline.c
91 :export:
92
93 Error Pointers
94 --------------
95
96 .. kernel-doc:: include/linux/err.h
97 :internal:
98
99 Sorting
100 -------
101
102 .. kernel-doc:: lib/sort.c
103 :export:
104
105 .. kernel-doc:: lib/list_sort.c
106 :export:
107
108 Text Searching
109 --------------
110
111 .. kernel-doc:: lib/textsearch.c
112 :doc: ts_intro
113
114 .. kernel-doc:: lib/textsearch.c
115 :export:
116
117 .. kernel-doc:: include/linux/textsearch.h
118 :functions: textsearch_find textsearch_next \
119 textsearch_get_pattern textsearch_get_pattern_len
120
121 CRC and Math Functions in Linux
122 ===============================
123
124 Arithmetic Overflow Checking
125 ----------------------------
126
127 .. kernel-doc:: include/linux/overflow.h
128 :internal:
129
130 CRC Functions
131 -------------
132
133 .. kernel-doc:: lib/crc/crc4.c
134 :export:
135
136 .. kernel-doc:: lib/crc/crc7.c
137 :export:
138
139 .. kernel-doc:: lib/crc/crc8.c
140 :export:
141
142 .. kernel-doc:: lib/crc/crc16.c
143 :export:
144
145 .. kernel-doc:: lib/crc/crc-ccitt.c
146 :export:
147
148 .. kernel-doc:: lib/crc/crc-itu-t.c
149 :export:
150
151 .. kernel-doc:: include/linux/crc32.h
152
153 .. kernel-doc:: include/linux/crc64.h
154
155 Base 2 log and power Functions
156 ------------------------------
157
158 .. kernel-doc:: include/linux/log2.h
159 :internal:
160
161 Integer log and power Functions
162 -------------------------------
163
164 .. kernel-doc:: include/linux/int_log.h
165
166 .. kernel-doc:: lib/math/int_pow.c
167 :export:
168
169 .. kernel-doc:: lib/math/int_sqrt.c
170 :export:
171
172 Division Functions
173 ------------------
174
175 .. kernel-doc:: include/asm-generic/div64.h
176 :functions: do_div
177
178 .. kernel-doc:: include/linux/math64.h
179 :internal:
180
181 .. kernel-doc:: lib/math/gcd.c
182 :export:
183
184 UUID/GUID
185 ---------
186
187 .. kernel-doc:: lib/uuid.c
188 :export:
189
190 Kernel IPC facilities
191 =====================
192
193 IPC utilities
194 -------------
195
196 .. kernel-doc:: ipc/util.c
197 :internal:
198
199 FIFO Buffer
200 ===========
201
202 kfifo interface
203 ---------------
204
205 .. kernel-doc:: include/linux/kfifo.h
206 :internal:
207
208 relay interface support
209 =======================
210
211 Relay interface support is designed to provide an efficient mechanism
212 for tools and facilities to relay large amounts of data from kernel
213 space to user space.
214
215 relay interface
216 ---------------
217
218 .. kernel-doc:: kernel/relay.c
219 :export:
220
221 .. kernel-doc:: kernel/relay.c
222 :internal:
223
224 Module Support
225 ==============
226
227 Kernel module auto-loading
228 --------------------------
229
230 .. kernel-doc:: kernel/module/kmod.c
231 :export:
232
233 Module debugging
234 ----------------
235
236 .. kernel-doc:: kernel/module/stats.c
237 :doc: module debugging statistics overview
238
239 dup_failed_modules - tracks duplicate failed modules
240 ****************************************************
241
242 .. kernel-doc:: kernel/module/stats.c
243 :doc: dup_failed_modules - tracks duplicate failed modules
244
245 module statistics debugfs counters
246 **********************************
247
248 .. kernel-doc:: kernel/module/stats.c
249 :doc: module statistics debugfs counters
250
251 Inter Module support
252 --------------------
253
254 Refer to the files in kernel/module/ for more information.
255
256 Hardware Interfaces
257 ===================
258
259 DMA Channels
260 ------------
261
262 .. kernel-doc:: kernel/dma.c
263 :export:
264
265 Resources Management
266 --------------------
267
268 .. kernel-doc:: kernel/resource.c
269 :internal:
270
271 .. kernel-doc:: kernel/resource.c
272 :export:
273
274 MTRR Handling
275 -------------
276
277 .. kernel-doc:: arch/x86/kernel/cpu/mtrr/mtrr.c
278 :export:
279
280 Security Framework
281 ==================
282
283 .. kernel-doc:: security/security.c
284 :internal:
285
286 .. kernel-doc:: security/inode.c
287 :export:
288
289 Audit Interfaces
290 ================
291
292 .. kernel-doc:: kernel/audit.c
293 :export:
294
295 .. kernel-doc:: kernel/auditsc.c
296 :internal:
297
298 .. kernel-doc:: kernel/auditfilter.c
299 :internal:
300
301 Accounting Framework
302 ====================
303
304 .. kernel-doc:: kernel/acct.c
305 :internal:
306
307 Block Devices
308 =============
309
310 .. kernel-doc:: include/linux/bio.h
311 .. kernel-doc:: block/blk-core.c
312 :export:
313
314 .. kernel-doc:: block/blk-core.c
315 :internal:
316
317 .. kernel-doc:: block/blk-map.c
318 :export:
319
320 .. kernel-doc:: block/blk-sysfs.c
321 :internal:
322
323 .. kernel-doc:: block/blk-settings.c
324 :export:
325
326 .. kernel-doc:: block/blk-flush.c
327 :export:
328
329 .. kernel-doc:: block/blk-lib.c
330 :export:
331
332 .. kernel-doc:: block/blk-integrity.c
333 :export:
334
335 .. kernel-doc:: kernel/trace/blktrace.c
336 :internal:
337
338 .. kernel-doc:: block/genhd.c
339 :internal:
340
341 .. kernel-doc:: block/genhd.c
342 :export:
343
344 .. kernel-doc:: block/bdev.c
345 :export:
346
347 Char devices
348 ============
349
350 .. kernel-doc:: fs/char_dev.c
351 :export:
352
353 Clock Framework
354 ===============
355
356 The clock framework defines programming interfaces to support software
357 management of the system clock tree. This framework is widely used with
358 System-On-Chip (SOC) platforms to support power management and various
359 devices which may need custom clock rates. Note that these "clocks"
360 don't relate to timekeeping or real time clocks (RTCs), each of which
361 have separate frameworks. These :c:type:`struct clk <clk>`
362 instances may be used to manage for example a 96 MHz signal that is used
363 to shift bits into and out of peripherals or busses, or otherwise
364 trigger synchronous state machine transitions in system hardware.
365
366 Power management is supported by explicit software clock gating: unused
367 clocks are disabled, so the system doesn't waste power changing the
368 state of transistors that aren't in active use. On some systems this may
369 be backed by hardware clock gating, where clocks are gated without being
370 disabled in software. Sections of chips that are powered but not clocked
371 may be able to retain their last state. This low power state is often
372 called a *retention mode*. This mode still incurs leakage currents,
373 especially with finer circuit geometries, but for CMOS circuits power is
374 mostly used by clocked state changes.
375
376 Power-aware drivers only enable their clocks when the device they manage
377 is in active use. Also, system sleep states often differ according to
378 which clock domains are active: while a "standby" state may allow wakeup
379 from several active domains, a "mem" (suspend-to-RAM) state may require
380 a more wholesale shutdown of clocks derived from higher speed PLLs and
381 oscillators, limiting the number of possible wakeup event sources. A
382 driver's suspend method may need to be aware of system-specific clock
383 constraints on the target sleep state.
384
385 Some platforms support programmable clock generators. These can be used
386 by external chips of various kinds, such as other CPUs, multimedia
387 codecs, and devices with strict requirements for interface clocking.
388
389 .. kernel-doc:: include/linux/clk.h
390 :internal:
391
392 Synchronization Primitives
393 ==========================
394
395 Read-Copy Update (RCU)
396 ----------------------
397
398 .. kernel-doc:: include/linux/rcupdate.h
399
400 .. kernel-doc:: kernel/rcu/tree.c
401
402 .. kernel-doc:: kernel/rcu/tree_exp.h
403
404 .. kernel-doc:: kernel/rcu/update.c
405
406 .. kernel-doc:: include/linux/srcu.h
407
408 .. kernel-doc:: kernel/rcu/srcutree.c
409
410 .. kernel-doc:: include/linux/rculist_bl.h
411
412 .. kernel-doc:: include/linux/rculist.h
413
414 .. kernel-doc:: include/linux/rculist_nulls.h
415
416 .. kernel-doc:: include/linux/rcu_sync.h
417
418 .. kernel-doc:: kernel/rcu/sync.c
419
420 .. kernel-doc:: kernel/rcu/tasks.h
421
422 .. kernel-doc:: kernel/rcu/tree_stall.h
423
424 .. kernel-doc:: include/linux/rcupdate_trace.h
425
426 .. kernel-doc:: include/linux/rcupdate_wait.h
427
428 .. kernel-doc:: include/linux/rcuref.h
429
430 .. kernel-doc:: include/linux/rcutree.h
431

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Linux 커널 API

1-5

Linux 커널 API (The Linux Kernel API)

기본 C 라이브러리 함수

6-14

드라이버를 작성할 때는 일반적으로 C Library의 루틴을 사용할 수 없습니다. 그중 널리 유용한 것으로 확인된 일부 함수가 아래에 나열되어 있습니다. 이 함수의 동작은 ANSI가 정의한 동작과 조금 다를 수 있으며, 그런 차이는 본문에 명시합니다.

문자열 변환

15-29
.. kernel-doc:: lib/vsprintf.c
   :export:

.. kernel-doc:: include/linux/kstrtox.h
   :functions: kstrtol kstrtoul

.. kernel-doc:: lib/kstrtox.c
   :export:

.. kernel-doc:: lib/string_helpers.c
   :export:

문자열 조작

30-45
.. kernel-doc:: include/linux/fortify-string.h
   :internal:

.. kernel-doc:: lib/string.c
   :export:

.. kernel-doc:: include/linux/string.h
   :internal:

.. kernel-doc:: mm/util.c
   :functions: kstrdup kstrdup_const kstrndup kmemdup kmemdup_nul memdup_user
               vmemdup_user strndup_user memdup_user_nul

기본 커널 라이브러리 함수

46-50

Linux 커널은 더 많은 기본 유틸리티 함수를 제공합니다.

비트 연산

51-62
.. kernel-doc:: include/asm-generic/bitops/instrumented-atomic.h
   :internal:

.. kernel-doc:: include/asm-generic/bitops/instrumented-non-atomic.h
   :internal:

.. kernel-doc:: include/asm-generic/bitops/instrumented-lock.h
   :internal:

비트맵 연산

63-86
.. kernel-doc:: lib/bitmap.c
   :doc: bitmap introduction

.. kernel-doc:: include/linux/bitmap.h
   :doc: declare bitmap

.. kernel-doc:: include/linux/bitmap.h
   :doc: bitmap overview

.. kernel-doc:: include/linux/bitmap.h
   :doc: bitmap bitops

.. kernel-doc:: lib/bitmap.c
   :export:

.. kernel-doc:: lib/bitmap.c
   :internal:

.. kernel-doc:: include/linux/bitmap.h
   :internal:

명령행 파싱

87-92
.. kernel-doc:: lib/cmdline.c
   :export:

오류 포인터

93-98
.. kernel-doc:: include/linux/err.h
   :internal:

정렬

99-107
.. kernel-doc:: lib/sort.c
   :export:

.. kernel-doc:: lib/list_sort.c
   :export:

CRC와 수학 함수 및 산술 오버플로 검사

121-129
.. kernel-doc:: include/linux/overflow.h
   :internal:

CRC 함수

130-154
.. kernel-doc:: lib/crc/crc4.c
   :export:

.. kernel-doc:: lib/crc/crc7.c
   :export:

.. kernel-doc:: lib/crc/crc8.c
   :export:

.. kernel-doc:: lib/crc/crc16.c
   :export:

.. kernel-doc:: lib/crc/crc-ccitt.c
   :export:

.. kernel-doc:: lib/crc/crc-itu-t.c
   :export:

.. kernel-doc:: include/linux/crc32.h

.. kernel-doc:: include/linux/crc64.h

밑이 2인 로그와 거듭제곱 함수

155-160
.. kernel-doc:: include/linux/log2.h
   :internal:

정수 로그와 거듭제곱 함수

161-171
.. kernel-doc:: include/linux/int_log.h

.. kernel-doc:: lib/math/int_pow.c
   :export:

.. kernel-doc:: lib/math/int_sqrt.c
   :export:

나눗셈 함수

172-183
.. kernel-doc:: include/asm-generic/div64.h
   :functions: do_div

.. kernel-doc:: include/linux/math64.h
   :internal:

.. kernel-doc:: lib/math/gcd.c
   :export:

UUID와 GUID

184-189
.. kernel-doc:: lib/uuid.c
   :export:

커널 IPC 기능과 유틸리티

190-198
.. kernel-doc:: ipc/util.c
   :internal:

FIFO 버퍼와 kfifo 인터페이스

199-207
.. kernel-doc:: include/linux/kfifo.h
   :internal:

relay 인터페이스 지원

208-223

relay 인터페이스 지원은 도구와 기능이 커널 공간에서 사용자 공간으로 많은 양의 데이터를 효율적으로 전달할 수 있게 설계되었습니다.

.. kernel-doc:: kernel/relay.c
   :export:

.. kernel-doc:: kernel/relay.c
   :internal:

모듈 지원과 자동 로딩

224-232
.. kernel-doc:: kernel/module/kmod.c
   :export:

모듈 디버깅

233-250
.. kernel-doc:: kernel/module/stats.c
   :doc: module debugging statistics overview

dup_failed_modules - tracks duplicate failed modules
****************************************************

.. kernel-doc:: kernel/module/stats.c
   :doc: dup_failed_modules - tracks duplicate failed modules

module statistics debugfs counters
**********************************

.. kernel-doc:: kernel/module/stats.c
   :doc: module statistics debugfs counters

모듈 간 지원

251-255

자세한 내용은 `kernel/module/` 아래의 파일을 참조하십시오.

하드웨어 인터페이스와 DMA 채널

256-264
.. kernel-doc:: kernel/dma.c
   :export:

리소스 관리

265-273
.. kernel-doc:: kernel/resource.c
   :internal:

.. kernel-doc:: kernel/resource.c
   :export:

MTRR 처리

274-279
.. kernel-doc:: arch/x86/kernel/cpu/mtrr/mtrr.c
   :export:

보안 프레임워크

280-288
.. kernel-doc:: security/security.c
   :internal:

.. kernel-doc:: security/inode.c
   :export:

감사 인터페이스

289-300
.. kernel-doc:: kernel/audit.c
   :export:

.. kernel-doc:: kernel/auditsc.c
   :internal:

.. kernel-doc:: kernel/auditfilter.c
   :internal:

회계 프레임워크

301-306
.. kernel-doc:: kernel/acct.c
   :internal:

블록 장치

307-346
.. kernel-doc:: include/linux/bio.h
.. kernel-doc:: block/blk-core.c
   :export:

.. kernel-doc:: block/blk-core.c
   :internal:

.. kernel-doc:: block/blk-map.c
   :export:

.. kernel-doc:: block/blk-sysfs.c
   :internal:

.. kernel-doc:: block/blk-settings.c
   :export:

.. kernel-doc:: block/blk-flush.c
   :export:

.. kernel-doc:: block/blk-lib.c
   :export:

.. kernel-doc:: block/blk-integrity.c
   :export:

.. kernel-doc:: kernel/trace/blktrace.c
   :internal:

.. kernel-doc:: block/genhd.c
   :internal:

.. kernel-doc:: block/genhd.c
   :export:

.. kernel-doc:: block/bdev.c
   :export:

문자 장치

347-352
.. kernel-doc:: fs/char_dev.c
   :export:

클록 프레임워크

353-391

clock framework는 시스템 clock tree를 소프트웨어로 관리하기 위한 프로그래밍 인터페이스를 정의합니다. 이 프레임워크는 전력 관리와 사용자 지정 clock rate가 필요한 여러 장치를 지원하기 위해 System-On-Chip(SOC) 플랫폼에서 널리 사용됩니다. 여기서 말하는 "clock"은 별도의 프레임워크가 있는 timekeeping 또는 real time clock(RTC)과 관계가 없습니다. `struct clk` 인스턴스는 예를 들어 peripheral이나 bus로 비트를 넣고 빼는 96 MHz 신호 또는 시스템 하드웨어의 동기식 state machine 전환을 일으키는 신호를 관리할 수 있습니다.

전력 관리는 명시적인 software clock gating으로 지원합니다. 사용하지 않는 clock을 비활성화하여 활성 상태가 아닌 transistor의 상태 전환에 전력을 낭비하지 않습니다. 일부 시스템은 software에서 clock을 끄지 않고 hardware clock gating으로 이를 뒷받침합니다. 전원은 공급되지만 clock이 들어오지 않는 chip 영역은 마지막 상태를 유지할 수 있으며, 이런 저전력 상태를 흔히 retention mode라고 합니다. 이 모드도 특히 미세 공정에서는 leakage current가 발생하지만 CMOS 회로의 전력은 대부분 clock에 따른 상태 전환에서 소비됩니다.

전력을 고려하는 드라이버는 관리 대상 장치를 실제로 사용할 때만 clock을 활성화합니다. 또한 system sleep state는 활성 clock domain에 따라 달라질 수 있습니다. "standby" 상태는 여러 활성 domain에서 wakeup을 허용할 수 있지만 "mem" 또는 suspend-to-RAM 상태는 고속 PLL과 oscillator에서 파생된 clock을 더 광범위하게 끄도록 요구하여 가능한 wakeup event source 수를 제한할 수 있습니다. 드라이버의 suspend method는 목표 sleep state에 적용되는 시스템별 clock 제약을 알아야 할 수 있습니다.

일부 플랫폼은 programmable clock generator를 지원합니다. 다른 CPU, multimedia codec, interface clocking 요구 사항이 엄격한 장치 등 여러 외부 chip이 이를 사용할 수 있습니다.

.. kernel-doc:: include/linux/clk.h
   :internal:

동기화 기본 요소와 RCU

392-430
.. kernel-doc:: include/linux/rcupdate.h

.. kernel-doc:: kernel/rcu/tree.c

.. kernel-doc:: kernel/rcu/tree_exp.h

.. kernel-doc:: kernel/rcu/update.c

.. kernel-doc:: include/linux/srcu.h

.. kernel-doc:: kernel/rcu/srcutree.c

.. kernel-doc:: include/linux/rculist_bl.h

.. kernel-doc:: include/linux/rculist.h

.. kernel-doc:: include/linux/rculist_nulls.h

.. kernel-doc:: include/linux/rcu_sync.h

.. kernel-doc:: kernel/rcu/sync.c

.. kernel-doc:: kernel/rcu/tasks.h

.. kernel-doc:: kernel/rcu/tree_stall.h

.. kernel-doc:: include/linux/rcupdate_trace.h

.. kernel-doc:: include/linux/rcupdate_wait.h

.. kernel-doc:: include/linux/rcuref.h

.. kernel-doc:: include/linux/rcutree.h