Documentation/userspace-api/media/dvb/ca-fopen.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / DVB / CA

Digital TV CA open()

CA 장치 경로와 접근·blocking flags를 사용해 장치를 엽니다.

Source pathDocumentation/userspace-api/media/dvb/ca-fopen.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설, 영어 원문, 전체 번역을 구분해 실었습니다. API 이름, 코드 심벌, 소스 경로는 원문 표기를 유지합니다.

1. 요약·해설

원문의 핵심 내용을 정리하고 커널 프로그래밍에 필요한 설명을 덧붙였습니다. 아래의 전체 번역과는 별도로 작성한 해설입니다.

요약·해설

ca-fopen.rst:1-72

open()은 /dev/dvb/adapter?/ca? 장치를 열며 O_RDONLY·O_RDWR·O_NONBLOCK을 지원합니다. O_RDWR open은 한 사용자만 할 수 있고 blocking mode는 이후 fcntl로 변경할 수 있습니다.

2. 영어 원문 전체

번역에 사용한 Linux v6.18.37 원문입니다. 줄 번호는 해당 버전의 소스 파일을 기준으로 합니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: DTV.ca
3
4 .. _ca_fopen:
5
6 ====================
7 Digital TV CA open()
8 ====================
9
10 Name
11 ----
12
13 Digital TV CA open()
14
15 Synopsis
16 --------
17
18 .. c:function:: int open(const char *name, int flags)
19
20 Arguments
21 ---------
22
23 ``name``
24 Name of specific Digital TV CA device.
25
26 ``flags``
27 A bit-wise OR of the following flags:
28
29 .. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
30
31 .. flat-table::
32 :header-rows: 0
33 :stub-columns: 0
34 :widths: 1 16
35
36 - - ``O_RDONLY``
37 - read-only access
38
39 - - ``O_RDWR``
40 - read/write access
41
42 - - ``O_NONBLOCK``
43 - open in non-blocking mode
44 (blocking mode is the default)
45
46 Description
47 -----------
48
49 This system call opens a named ca device (e.g. ``/dev/dvb/adapter?/ca?``)
50 for subsequent use.
51
52 When an ``open()`` call has succeeded, the device will be ready for use. The
53 significance of blocking or non-blocking mode is described in the
54 documentation for functions where there is a difference. It does not
55 affect the semantics of the ``open()`` call itself. A device opened in
56 blocking mode can later be put into non-blocking mode (and vice versa)
57 using the ``F_SETFL`` command of the ``fcntl`` system call. This is a
58 standard system call, documented in the Linux manual page for fcntl.
59 Only one user can open the CA Device in ``O_RDWR`` mode. All other
60 attempts to open the device in this mode will fail, and an error code
61 will be returned.
62
63 Return Value
64 ------------
65
66 On success 0 is returned.
67
68 On error -1 is returned, and the ``errno`` variable is set
69 appropriately.
70
71 Generic error codes are described at the
72 :ref:`Generic Error Codes <gen-errors>` chapter.
73

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미에 맞춰 전체 내용을 번역했습니다. 코드, 함수명, 코드 심벌, 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한 값입니다.

CA open flags
항목설명
O_RDONLYread-only access
O_RDWRread/write access
O_NONBLOCKnon-blocking mode로 열기; 기본값은 blocking mode

접근 방식과 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로 여는 다른 시도는 실패하고 오류 코드를 반환합니다.

CA 장치 open 상태
장치 경로와 access flags 선택open() 호출성공하면 CA 장치 사용 가능필요하면 fcntl(F_SETFL)로 blocking mode 전환O_RDWR 중복 open은 오류 반환

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.