← Documents Documentation/ABI/testing/sysfs-uevent GitHub 원문 ↗

Linux 6.18.37 · ABI / testing

Synthetic uevent sysfs ABI

uevent 파일 쓰기로 synthetic event를 만들 때 ACTION, transaction UUID와 prefixed KEY=VALUE 환경 변수를 전달하는 확장 형식을 설명합니다.

Source pathDocumentation/ABI/testing/sysfs-uevent
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

확장 입력 형식

sysfs-uevent:1-29

필수 ACTION 뒤에 optional UUID와 KEY=VALUE pairs를 두어 synthetic event들을 transaction 단위로 식별합니다.

Environment variable 변환

sysfs-uevent:30-51

입력 pair에 SYNTH_ARG_ prefix를 붙이고 UUID를 SYNTH_UUID로 노출해 udev와 userspace listener가 소비하도록 합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 What: /sys/.../uevent
2 Date: May 2017
3 KernelVersion: 4.13
4 Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
5 Description:
6 Enable passing additional variables for synthetic uevents that
7 are generated by writing /sys/.../uevent file.
8
9 Recognized extended format is::
10
11 ACTION [UUID [KEY=VALUE ...]
12
13 The ACTION is compulsory - it is the name of the uevent
14 action (``add``, ``change``, ``remove``). There is no change
15 compared to previous functionality here. The rest of the
16 extended format is optional.
17
18 You need to pass UUID first before any KEY=VALUE pairs.
19 The UUID must be in ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx``
20 format where 'x' is a hex digit. The UUID is considered to be
21 a transaction identifier so it's possible to use the same UUID
22 value for one or more synthetic uevents in which case we
23 logically group these uevents together for any userspace
24 listeners. The UUID value appears in uevent as
25 ``SYNTH_UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`` environment
26 variable.
27
28 If UUID is not passed in, the generated synthetic uevent gains
29 ``SYNTH_UUID=0`` environment variable automatically.
30
31 The KEY=VALUE pairs can contain alphanumeric characters only.
32
33 It's possible to define zero or more pairs - each pair is then
34 delimited by a space character ' '. Each pair appears in
35 synthetic uevent as ``SYNTH_ARG_KEY=VALUE``. That means the KEY
36 name gains ``SYNTH_ARG_`` prefix to avoid possible collisions
37 with existing variables.
38
39 Example of valid sequence written to the uevent file::
40
41 add fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed A=1 B=abc
42
43 This generates synthetic uevent including these variables::
44
45 ACTION=add
46 SYNTH_ARG_A=1
47 SYNTH_ARG_B=abc
48 SYNTH_UUID=fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed
49
50 Users:
51 udev, userspace tools generating synthetic uevents
52

3. 한국어 전문 번역

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

Synthetic uevent sysfs ABI: uevent

1-51
항목한국어 전문 번역
What/sys/.../uevent
Date2017년 5월
KernelVersion4.13
Usersudev, userspace tools generating synthetic uevents
ContactLinux kernel mailing list <linux-kernel@vger.kernel.org>
Description`/sys/.../uevent` 파일에 써서 생성하는 synthetic uevent에 추가 변수를 전달할 수 있게 합니다. 인식하는 확장 형식은 `ACTION [UUID [KEY=VALUE ...]]`입니다. `ACTION`은 필수이며 uevent action 이름인 `add`, `change`, `remove` 가운데 하나입니다. 이 부분은 이전 기능과 달라지지 않았고 나머지 확장 형식은 optional입니다. `KEY=VALUE` pair를 쓰려면 먼저 UUID를 전달해야 합니다. UUID는 각 `x`가 hexadecimal digit인 `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` 형식이어야 합니다. UUID는 transaction identifier로 간주되므로 하나 이상의 synthetic uevent에 같은 UUID를 사용하면 userspace listener가 해당 event들을 논리적으로 한 group으로 묶을 수 있습니다. UUID는 uevent에 `SYNTH_UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` environment variable로 나타납니다. UUID를 전달하지 않으면 생성된 synthetic uevent에는 `SYNTH_UUID=0` environment variable이 자동으로 추가됩니다. `KEY=VALUE` pair에는 alphanumeric character만 포함할 수 있습니다. Pair는 0개 이상 정의할 수 있고 각각 space character로 구분합니다. 각 pair는 synthetic uevent에서 `SYNTH_ARG_KEY=VALUE`로 나타납니다. 기존 variable과 충돌할 가능성을 피하려고 KEY 이름에 `SYNTH_ARG_` prefix를 붙입니다. 유효한 입력 `add fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed A=1 B=abc`는 `ACTION=add`, `SYNTH_ARG_A=1`, `SYNTH_ARG_B=abc`, `SYNTH_UUID=fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed` 변수를 포함하는 synthetic uevent를 생성합니다. 이 ABI의 사용자는 udev와 synthetic uevent를 생성하는 userspace tools입니다.
Synthetic uevent 입력 해석
Write ACTIONGenerate add / change / remove eventSet SYNTH_UUID=0
Write ACTION UUIDValidate canonical UUIDSet SYNTH_UUID=<UUID>
Write ACTION UUID KEY=VALUE ...Validate alphanumeric pairsEmit SYNTH_ARG_KEY=VALUE

ACTION은 필수이고 UUID를 생략하면 KEY=VALUE pairs도 전달할 수 없습니다.

Extended uevent fields
InputRequiredGenerated environment
ACTIONYesACTION=add|change|remove
UUIDNoSYNTH_UUID=<UUID>; omitted becomes 0
KEY=VALUENo; UUID must precedeSYNTH_ARG_KEY=VALUE

입력 token과 synthetic uevent environment의 대응입니다.

add fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed A=1 B=abc

ACTION=add
SYNTH_ARG_A=1
SYNTH_ARG_B=abc
SYNTH_UUID=fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed