Documentation/driver-api/tty/tty_struct.rst GitHub 원문 ↗

Linux 6.18.37 · Driver API

TTY Struct

struct tty_struct의 할당·해제 수명주기, reference, 설치, I/O 제어, hangup, flags와 구조체 reference를 설명하는 한국어 전문 번역입니다.

Source pathDocumentation/driver-api/tty/tty_struct.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

tty_struct.rst:1-81

`struct tty_struct`는 TTY device의 첫 open부터 마지막 close까지 유지되는 핵심 상태입니다. 이 페이지는 수명주기와 주요 helper를 `tty_struct_flags`, `tty_struct` reference까지 이어서 설명합니다.

문서 구성
원문 줄핵심 내용
1-12구조체 수명주기
13-24초기화와 이름
25-39reference와 설치
40-57I/O control과 wakeup
58-69hangup과 misc
70-81flags와 구조체 reference

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 ==========
4 TTY Struct
5 ==========
6
7 .. contents:: :local:
8
9 struct tty_struct is allocated by the TTY layer upon the first open of the TTY
10 device and released after the last close. The TTY layer passes this structure
11 to most of struct tty_operation's hooks. Members of tty_struct are documented
12 in `TTY Struct Reference`_ at the bottom.
13
14 Initialization
15 ==============
16
17 .. kernel-doc:: drivers/tty/tty_io.c
18 :identifiers: tty_init_termios
19
20 Name
21 ====
22
23 .. kernel-doc:: drivers/tty/tty_io.c
24 :identifiers: tty_name
25
26 Reference counting
27 ==================
28
29 .. kernel-doc:: include/linux/tty.h
30 :identifiers: tty_kref_get
31
32 .. kernel-doc:: drivers/tty/tty_io.c
33 :identifiers: tty_kref_put
34
35 Install
36 =======
37
38 .. kernel-doc:: drivers/tty/tty_io.c
39 :identifiers: tty_standard_install
40
41 Read & Write
42 ============
43
44 .. kernel-doc:: drivers/tty/tty_io.c
45 :identifiers: tty_put_char
46
47 Start & Stop
48 ============
49
50 .. kernel-doc:: drivers/tty/tty_io.c
51 :identifiers: start_tty stop_tty
52
53 Wakeup
54 ======
55
56 .. kernel-doc:: drivers/tty/tty_io.c
57 :identifiers: tty_wakeup
58
59 Hangup
60 ======
61
62 .. kernel-doc:: drivers/tty/tty_io.c
63 :identifiers: tty_hangup tty_vhangup tty_hung_up_p
64
65 Misc
66 ====
67
68 .. kernel-doc:: drivers/tty/tty_io.c
69 :identifiers: tty_do_resize
70
71 TTY Struct Flags
72 ================
73
74 .. kernel-doc:: include/linux/tty.h
75 :identifiers: tty_struct_flags
76
77 TTY Struct Reference
78 ====================
79
80 .. kernel-doc:: include/linux/tty.h
81 :identifiers: tty_struct
82

3. 한국어 전문 번역

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

TTY 구조체 수명주기

1-12

`struct tty_struct`는 TTY device를 처음 open할 때 TTY layer가 할당하고 마지막 close 뒤에 해제합니다. TTY layer는 이 구조체를 `struct tty_operation`의 대부분 hook에 전달합니다.

`tty_struct` member에 관한 상세 계약은 페이지 아래의 TTY Struct Reference 절에서 설명합니다.

`tty_struct` 수명주기
TTY device 첫 open`struct tty_struct` 할당
TTY operation hooks구조체 전달·사용
마지막 close구조체 해제

첫 open부터 마지막 close까지 TTY layer가 구조체를 관리합니다.

.. SPDX-License-Identifier: GPL-2.0

==========
TTY Struct
==========

.. contents:: :local:

struct tty_struct is allocated by the TTY layer upon the first open of the TTY
device and released after the last close. The TTY layer passes this structure
to most of struct tty_operation's hooks. Members of tty_struct are documented
in `TTY Struct Reference`_ at the bottom.

초기화와 이름

13-24

Initialization 절은 `drivers/tty/tty_io.c`의 `tty_init_termios`를 문서화합니다. Name 절은 같은 source의 `tty_name`을 포함합니다.

초기화와 이름 helper
identifiersource path범주
`tty_init_termios``drivers/tty/tty_io.c`초기 termios 설정
`tty_name``drivers/tty/tty_io.c`TTY 이름 조회·표현


Initialization
==============

.. kernel-doc:: drivers/tty/tty_io.c
   :identifiers: tty_init_termios

Name
====

.. kernel-doc:: drivers/tty/tty_io.c
   :identifiers: tty_name

Reference counting과 설치

25-39

Reference counting은 `include/linux/tty.h`의 `tty_kref_get`과 `drivers/tty/tty_io.c`의 `tty_kref_put`을 함께 설명합니다. Reference를 얻고 반납하는 양쪽 경로의 상세 조건은 각 kernel-doc에 정의됩니다.

Install 절은 `drivers/tty/tty_io.c`의 `tty_standard_install`을 문서화합니다.

Reference와 설치
identifiersource path
`tty_kref_get``include/linux/tty.h`
`tty_kref_put``drivers/tty/tty_io.c`
`tty_standard_install``drivers/tty/tty_io.c`


Reference counting
==================

.. kernel-doc:: include/linux/tty.h
   :identifiers: tty_kref_get

.. kernel-doc:: drivers/tty/tty_io.c
   :identifiers: tty_kref_put

Install
=======

.. kernel-doc:: drivers/tty/tty_io.c
   :identifiers: tty_standard_install

Read·write, start·stop과 wakeup

40-57

Read & Write 절은 `tty_put_char`를, Start & Stop 절은 `start_tty`와 `stop_tty`를, Wakeup 절은 `tty_wakeup`을 설명합니다. 모두 `drivers/tty/tty_io.c`의 kernel-doc에서 생성됩니다.

TTY I/O control helper
범주identifier
read·write`tty_put_char`
start·stop`start_tty`, `stop_tty`
wakeup`tty_wakeup`


Read & Write
============

.. kernel-doc:: drivers/tty/tty_io.c
   :identifiers: tty_put_char

Start & Stop
============

.. kernel-doc:: drivers/tty/tty_io.c
   :identifiers: start_tty stop_tty

Wakeup
======

.. kernel-doc:: drivers/tty/tty_io.c
   :identifiers: tty_wakeup

Hangup과 기타 helper

58-69

Hangup 절은 `tty_hangup`, `tty_vhangup`, `tty_hung_up_p`를 포함합니다. Misc 절은 TTY 크기 변경을 다루는 `tty_do_resize`를 문서화합니다. 이 함수들은 모두 `drivers/tty/tty_io.c`에서 가져옵니다.

Hangup과 misc
범주identifier
hangup`tty_hangup`, `tty_vhangup`, `tty_hung_up_p`
resize`tty_do_resize`


Hangup
======

.. kernel-doc:: drivers/tty/tty_io.c
   :identifiers: tty_hangup tty_vhangup tty_hung_up_p

Misc
====

.. kernel-doc:: drivers/tty/tty_io.c
   :identifiers: tty_do_resize

TTY flags와 구조체 reference

70-81

TTY Struct Flags 절은 `include/linux/tty.h`의 `tty_struct_flags`를 문서화합니다. 마지막 TTY Struct Reference 절은 같은 header의 `tty_struct` 전체 member 계약을 제공합니다.

TTY 구조체 reference
identifiersource path내용
`tty_struct_flags``include/linux/tty.h`TTY 상태 flag
`tty_struct``include/linux/tty.h`TTY 핵심 구조체와 member


TTY Struct Flags
================

.. kernel-doc:: include/linux/tty.h
   :identifiers: tty_struct_flags

TTY Struct Reference
====================

.. kernel-doc:: include/linux/tty.h
   :identifiers: tty_struct