요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
==========
TTY Buffer
==========
.. contents:: :local:
Here, we document functions for taking care of tty buffer and their flipping.
Drivers are supposed to fill the buffer by one of those functions below and
then flip the buffer, so that the data are passed to :doc:`line discipline
<tty_ldisc>` for further processing.
Flip Buffer Management
======================
.. kernel-doc:: drivers/tty/tty_buffer.c
:identifiers: tty_prepare_flip_string
tty_flip_buffer_push tty_ldisc_receive_buf
.. kernel-doc:: include/linux/tty_flip.h
:identifiers: tty_insert_flip_string_fixed_flag tty_insert_flip_string_flags
tty_insert_flip_char
----
Other Functions
===============
.. kernel-doc:: drivers/tty/tty_buffer.c
:identifiers: tty_buffer_space_avail tty_buffer_set_limit
----
Buffer Locking
==============
These are used only in special circumstances. Avoid them.
.. kernel-doc:: drivers/tty/tty_buffer.c
:identifiers: tty_buffer_lock_exclusive tty_buffer_unlock_exclusive
----
Internal Functions
==================
.. kernel-doc:: drivers/tty/tty_buffer.c
:internal:
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
TTY flip buffer 개요
1-13이 문서는 TTY buffer를 관리하고 flip하는 함수들을 설명합니다. 드라이버는 아래 함수 중 하나로 buffer를 채운 다음 buffer를 flip해야 합니다.
flip이 수행되면 데이터가 추가 처리를 위해 `line discipline <tty_ldisc>`으로 전달됩니다. 따라서 이 buffer는 하드웨어·드라이버의 수신 데이터와 line discipline 사이의 전달 단계입니다.
드라이버가 문자를 적재한 뒤 flip하여 line discipline으로 넘기는 흐름입니다.
.. SPDX-License-Identifier: GPL-2.0
==========
TTY Buffer
==========
.. contents:: :local:
Here, we document functions for taking care of tty buffer and their flipping.
Drivers are supposed to fill the buffer by one of those functions below and
then flip the buffer, so that the data are passed to :doc:`line discipline
<tty_ldisc>` for further processing.
Flip Buffer Management
14-26`drivers/tty/tty_buffer.c`에서는 `tty_prepare_flip_string`, `tty_flip_buffer_push`, `tty_ldisc_receive_buf`의 kernel-doc을 가져옵니다. 이들은 buffer 공간 준비, 채운 buffer의 전달 시작, line discipline 수신 경로를 문서화합니다.
`include/linux/tty_flip.h`에서는 문자 삽입 도우미인 `tty_insert_flip_string_fixed_flag`, `tty_insert_flip_string_flags`, `tty_insert_flip_char`를 문서화합니다. 이름과 source path는 호출자가 사용할 정확한 커널 API를 식별하도록 원문 그대로 유지합니다.
Flip Buffer Management
======================
.. kernel-doc:: drivers/tty/tty_buffer.c
:identifiers: tty_prepare_flip_string
tty_flip_buffer_push tty_ldisc_receive_buf
.. kernel-doc:: include/linux/tty_flip.h
:identifiers: tty_insert_flip_string_fixed_flag tty_insert_flip_string_flags
tty_insert_flip_char
----
공간 조회와 제한 설정
27-34Other Functions 절은 `drivers/tty/tty_buffer.c`의 `tty_buffer_space_avail`과 `tty_buffer_set_limit`을 문서화합니다. 전자는 사용 가능한 buffer 공간을 다루고, 후자는 buffer limit을 설정하는 API입니다.
Other Functions
===============
.. kernel-doc:: drivers/tty/tty_buffer.c
:identifiers: tty_buffer_space_avail tty_buffer_set_limit
----
Buffer Locking
35-44`tty_buffer_lock_exclusive`와 `tty_buffer_unlock_exclusive`는 특별한 상황에서만 사용하는 exclusive locking 함수입니다. 원문은 일반 경로에서 이 함수들을 피하라고 명시합니다.
반드시 필요한 특수 상황에서만 짝을 맞춰 사용합니다.
Buffer Locking
==============
These are used only in special circumstances. Avoid them.
.. kernel-doc:: drivers/tty/tty_buffer.c
:identifiers: tty_buffer_lock_exclusive tty_buffer_unlock_exclusive
----
내부 함수
45-49마지막 절은 `drivers/tty/tty_buffer.c`의 `:internal:` kernel-doc 항목을 포함합니다. flip buffer 구현 내부에서만 사용하는 함수들의 설명이 생성됩니다.
Internal Functions
==================
.. kernel-doc:: drivers/tty/tty_buffer.c
:internal:
요약·해설
tty_buffer.rst:1-49TTY driver는 수신 문자를 flip buffer에 넣고 `tty_flip_buffer_push` 계열 경로로 line discipline에 전달합니다. 이 문서는 삽입·전달 API, 공간 조회와 제한, 예외적인 exclusive locking, 내부 함수를 구분합니다.