요약·해설과 원문, 전문 번역을 서로 분리했습니다. 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.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.
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.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
open() 선언과 접근 mode
1-44Frontend 장치를 열려면 `<fcntl.h>`를 포함하고 `int open(const char *device_name, int flags)`를 호출합니다.
장치 경로와 접근·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()` 계약으로 해석하지 않습니다.
원문 flat-table에 열거된 오류입니다.
조회 전용과 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.
요약·해설
frontend_f_open.rst:1-104O_RDONLY는 여러 조회자, O_RDWR는 단일 제어자 모델입니다. 원문의 무관한 ca_slot_info 성공 문장은 원문 그대로 보존하고 불일치로 표시했습니다.