← Documents Documentation/userspace-api/media/dvb/frontend_f_open.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / DVB / Frontend

Digital TV frontend open()

Frontend 장치 open mode·배타성·blocking·오류를 설명합니다.

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

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

1. 요약·해설

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

요약·해설

frontend_f_open.rst:1-104

O_RDONLY는 여러 조회자, O_RDWR는 단일 제어자 모델입니다. 원문의 무관한 ca_slot_info 성공 문장은 원문 그대로 보존하고 불일치로 표시했습니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: DTV.fe
3
4 .. _frontend_f_open:
5
6 ***************************
7 Digital TV frontend open()
8 ***************************
9
10 Name
11 ====
12
13 fe-open - Open a frontend device
14
15 Synopsis
16 ========
17
18 .. code-block:: c
19
20 #include <fcntl.h>
21
22 .. c:function:: int open( const char *device_name, int flags )
23
24 Arguments
25 =========
26
27 ``device_name``
28 Device to be opened.
29
30 ``flags``
31 Open flags. Access can either be ``O_RDWR`` or ``O_RDONLY``.
32
33 Multiple opens are allowed with ``O_RDONLY``. In this mode, only
34 query and read ioctls are allowed.
35
36 Only one open is allowed in ``O_RDWR``. In this mode, all ioctls are
37 allowed.
38
39 When the ``O_NONBLOCK`` flag is given, the system calls may return
40 ``EAGAIN`` error code when no data is available or when the device
41 driver is temporarily busy.
42
43 Other flags have no effect.
44
45 Description
46 ===========
47
48 This system call opens a named frontend device
49 (``/dev/dvb/adapter?/frontend?``) for subsequent use. Usually the first
50 thing to do after a successful open is to find out the frontend type
51 with :ref:`FE_GET_INFO`.
52
53 The device can be opened in read-only mode, which only allows monitoring
54 of device status and statistics, or read/write mode, which allows any
55 kind of use (e.g. performing tuning operations.)
56
57 In a system with multiple front-ends, it is usually the case that
58 multiple devices cannot be open in read/write mode simultaneously. As
59 long as a front-end device is opened in read/write mode, other open()
60 calls in read/write mode will either fail or block, depending on whether
61 non-blocking or blocking mode was specified. A front-end device opened
62 in blocking mode can later be put into non-blocking mode (and vice
63 versa) using the F_SETFL command of the fcntl system call. This is a
64 standard system call, documented in the Linux manual page for fcntl.
65 When an open() call has succeeded, the device will be ready for use in
66 the specified mode. This implies that the corresponding hardware is
67 powered up, and that other front-ends may have been powered down to make
68 that possible.
69
70 Return Value
71 ============
72
73 On success :c:func:`open()` returns the new file descriptor.
74 On error, -1 is returned, and the ``errno`` variable is set appropriately.
75
76 Possible error codes are:
77
78 On success 0 is returned, and :c:type:`ca_slot_info` is filled.
79
80 On error -1 is returned, and the ``errno`` variable is set
81 appropriately.
82
83 .. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
84
85 .. flat-table::
86 :header-rows: 0
87 :stub-columns: 0
88 :widths: 1 16
89
90 - - ``EPERM``
91 - The caller has no permission to access the device.
92
93 - - ``EBUSY``
94 - The device driver is already in use.
95
96 - - ``EMFILE``
97 - The process already has the maximum number of files open.
98
99 - - ``ENFILE``
100 - The limit on the total number of files open on the system has been
101 reached.
102
103 The generic error codes are described at the
104 :ref:`Generic Error Codes <gen-errors>` chapter.
105

3. 한국어 전문 번역

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

open() 선언과 접근 mode

1-44

Frontend 장치를 열려면 `<fcntl.h>`를 포함하고 `int open(const char *device_name, int flags)`를 호출합니다.

open() 인수
인수 또는 flag동작
device_name열 frontend 장치 경로
O_RDONLY여러 번 open 가능; query와 read ioctl만 허용
O_RDWR한 번만 open 가능; 모든 ioctl 허용
O_NONBLOCK데이터 부재나 driver 일시 busy 시 EAGAIN 가능
그 밖의 flag효과 없음

장치 경로와 접근·blocking flag입니다.

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.fe

.. _frontend_f_open:

***************************
Digital TV frontend open()
***************************

Name
====

fe-open - Open a frontend device

Synopsis
========

.. code-block:: c

    #include <fcntl.h>

.. c:function:: int open( const char *device_name, int flags )

Arguments
=========

``device_name``
    Device to be opened.

``flags``
    Open flags. Access can either be ``O_RDWR`` or ``O_RDONLY``.

    Multiple opens are allowed with ``O_RDONLY``. In this mode, only
    query and read ioctls are allowed.

    Only one open is allowed in ``O_RDWR``. In this mode, all ioctls are
    allowed.

    When the ``O_NONBLOCK`` flag is given, the system calls may return
    ``EAGAIN`` error code when no data is available or when the device
    driver is temporarily busy.

    Other flags have no effect.

장치 path, 배타성, 전원과 오류

45-104

`/dev/dvb/adapter?/frontend?` 형식의 이름을 가진 frontend 장치를 이후 사용을 위해 엽니다. 보통 성공 직후 `FE_GET_INFO`로 frontend 형식을 확인합니다.

Read-only mode는 장치 상태와 통계 감시만 허용하고, read/write mode는 tuning을 포함한 모든 사용을 허용합니다.

여러 frontend가 있는 system에서는 여러 장치를 동시에 read/write로 열 수 없는 경우가 일반적입니다. 한 장치가 read/write로 열려 있으면 다른 read/write `open()`은 non-blocking인지 blocking인지에 따라 실패하거나 대기합니다.

Blocking으로 연 장치는 `fcntl`의 `F_SETFL` command로 나중에 non-blocking으로 바꿀 수 있고 반대 전환도 가능합니다.

`open()`이 성공하면 지정 mode로 장치를 사용할 준비가 됩니다. 해당 하드웨어가 켜지고, 이를 위해 다른 frontend의 전원이 꺼질 수도 있습니다.

정상 성공 시 `open()`은 새 file descriptor를 반환하고 오류 시 -1과 `errno`를 반환합니다. 원문에는 이어서 `성공 시 0을 반환하고 ca_slot_info를 채운다`는 이 API와 맞지 않는 문장이 있으므로 영어 원문은 보존하되 실제 `open()` 계약으로 해석하지 않습니다.

frontend open 전용 오류
오류조건
EPERM호출자에게 장치 접근 권한이 없음
EBUSYDevice driver가 이미 사용 중임
EMFILE현재 process가 열 수 있는 최대 file 수에 도달
ENFILESystem 전체 open file 수 한도에 도달

원문 flat-table에 열거된 오류입니다.

Frontend open mode 선택
장치 path /dev/dvb/adapter?/frontend? 선택감시만 하면 O_RDONLY, tuning하면 O_RDWR 선택즉시 반환이 필요하면 O_NONBLOCK 추가open 성공 후 FE_GET_INFO 호출필요하면 fcntl F_SETFL로 blocking mode 변경

조회 전용과 tuning 가능 mode의 배타성을 구분합니다.

그 밖의 일반 오류는 `Generic Error Codes <gen-errors>` 절을 따릅니다.

Description
===========

This system call opens a named frontend device
(``/dev/dvb/adapter?/frontend?``) for subsequent use. Usually the first
thing to do after a successful open is to find out the frontend type
with :ref:`FE_GET_INFO`.

The device can be opened in read-only mode, which only allows monitoring
of device status and statistics, or read/write mode, which allows any
kind of use (e.g. performing tuning operations.)

In a system with multiple front-ends, it is usually the case that
multiple devices cannot be open in read/write mode simultaneously. As
long as a front-end device is opened in read/write mode, other open()
calls in read/write mode will either fail or block, depending on whether
non-blocking or blocking mode was specified. A front-end 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.
When an open() call has succeeded, the device will be ready for use in
the specified mode. This implies that the corresponding hardware is
powered up, and that other front-ends may have been powered down to make
that possible.

Return Value
============

On success :c:func:`open()` returns the new file descriptor.
On error, -1 is returned, and the ``errno`` variable is set appropriately.

Possible error codes are:

On success 0 is returned, and :c:type:`ca_slot_info` is filled.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|

.. flat-table::
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 16

    -  - ``EPERM``
       -  The caller has no permission to access the device.

    -  - ``EBUSY``
       -  The device driver is already in use.

    -  - ``EMFILE``
       -  The process already has the maximum number of files open.

    -  - ``ENFILE``
       -  The limit on the total number of files open on the system has been
	  reached.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.