요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.ca
.. _ca_fopen:
====================
Digital TV CA open()
====================
Name
----
Digital TV CA open()
Synopsis
--------
.. c:function:: int open(const char *name, int flags)
Arguments
---------
``name``
Name of specific Digital TV CA device.
``flags``
A bit-wise OR of the following flags:
.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 16
- - ``O_RDONLY``
- read-only access
- - ``O_RDWR``
- read/write access
- - ``O_NONBLOCK``
- open in non-blocking mode
(blocking mode is the default)
Description
-----------
This system call opens a named ca device (e.g. ``/dev/dvb/adapter?/ca?``)
for subsequent use.
When an ``open()`` call has succeeded, the device will be ready for use. The
significance of blocking or non-blocking mode is described in the
documentation for functions where there is a difference. It does not
affect the semantics of the ``open()`` call itself. A device opened in
blocking mode can later be put into non-blocking mode (and vice versa)
using the ``F_SETFL`` command of the ``fcntl`` system call. This is a
standard system call, documented in the Linux manual page for fcntl.
Only one user can open the CA Device in ``O_RDWR`` mode. All other
attempts to open the device in this mode will fail, and an error code
will be returned.
Return Value
------------
On success 0 is returned.
On error -1 is returned, and the ``errno`` variable is set
appropriately.
Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
이름과 원형
1-18이 문서는 GFDL-1.1-no-invariants-or-later 라이선스와 `DTV.ca` C namespace를 사용하며 `ca_fopen` 앵커에서 Digital TV CA `open()`을 설명합니다.
함수 원형은 `int open(const char *name, int flags)`입니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.ca
.. _ca_fopen:
====================
Digital TV CA open()
====================
Name
----
Digital TV CA open()
Synopsis
--------
.. c:function:: int open(const char *name, int flags)
장치 이름과 flags
19-45`name`은 특정 Digital TV CA 장치의 이름입니다. `flags`는 다음 flag를 bitwise OR한 값입니다.
접근 방식과 blocking 동작을 선택합니다.
Arguments
---------
``name``
Name of specific Digital TV CA device.
``flags``
A bit-wise OR of the following flags:
.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 16
- - ``O_RDONLY``
- read-only access
- - ``O_RDWR``
- read/write access
- - ``O_NONBLOCK``
- open in non-blocking mode
(blocking mode is the default)
장치 열기와 모드 전환
46-61이 시스템 호출은 이후 사용을 위해 이름이 지정된 CA 장치, 예를 들어 `/dev/dvb/adapter?/ca?`를 엽니다.
`open()`이 성공하면 장치를 사용할 준비가 됩니다. blocking과 non-blocking의 의미는 차이가 있는 각 함수 문서에서 설명하며, `open()` 호출 자체의 의미에는 영향을 주지 않습니다.
blocking mode로 연 장치는 나중에 `fcntl` 시스템 호출의 `F_SETFL` 명령으로 non-blocking mode로 바꿀 수 있고 그 반대도 가능합니다. `fcntl`은 Linux manual page에 설명된 표준 시스템 호출입니다.
CA 장치를 `O_RDWR` mode로 열 수 있는 사용자는 한 명뿐입니다. 같은 mode로 여는 다른 시도는 실패하고 오류 코드를 반환합니다.
open 뒤에도 fcntl로 blocking mode를 바꿀 수 있습니다.
Description
-----------
This system call opens a named ca device (e.g. ``/dev/dvb/adapter?/ca?``)
for subsequent use.
When an ``open()`` call has succeeded, the device will be ready for use. The
significance of blocking or non-blocking mode is described in the
documentation for functions where there is a difference. It does not
affect the semantics of the ``open()`` call itself. A device opened in
blocking mode can later be put into non-blocking mode (and vice versa)
using the ``F_SETFL`` command of the ``fcntl`` system call. This is a
standard system call, documented in the Linux manual page for fcntl.
Only one user can open the CA Device in ``O_RDWR`` mode. All other
attempts to open the device in this mode will fail, and an error code
will be returned.
반환값
62-72원문은 성공 시 0을 반환한다고 명시합니다. 오류이면 -1을 반환하고 `errno`를 알맞게 설정합니다.
일반 오류 코드는 `Generic Error Codes <gen-errors>` 장에서 설명합니다.
Return Value
------------
On success 0 is returned.
On error -1 is returned, and the ``errno`` variable is set
appropriately.
Generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.
요약·해설
ca-fopen.rst:1-72open()은 /dev/dvb/adapter?/ca? 장치를 열며 O_RDONLY·O_RDWR·O_NONBLOCK을 지원합니다. O_RDWR open은 한 사용자만 가능하고 blocking mode는 이후 fcntl로 변경할 수 있습니다.