1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-27 01:55:32 +03:00

document udev escaped string in udev(7)

This commit is contained in:
Yu, Li-Yu 2020-10-29 20:58:16 +08:00
parent c32d562da5
commit bc117ec359

View File

@ -23,7 +23,8 @@
<refpurpose>Dynamic device management</refpurpose>
</refnamediv>
<refsect1><title>Description</title>
<refsect1>
<title>Description</title>
<para>udev supplies the system software with device events, manages permissions
of device nodes and may create additional symlinks in the <filename>/dev/</filename>
directory, or renames network interfaces. The kernel usually just assigns unpredictable
@ -44,7 +45,8 @@
sources is provided by the library libudev.</para>
</refsect1>
<refsect1><title>Rules Files</title>
<refsect1>
<title>Rules Files</title>
<para>The udev rules are read from the files located in the system rules directories
<filename>/usr/lib/udev/rules.d</filename> and <filename>/usr/local/lib/udev/rules.d</filename>, the
volatile runtime directory <filename>/run/udev/rules.d</filename> and the local administration
@ -68,9 +70,11 @@
pointing to the device node, or run a specified program as part of
the event handling.</para>
<para>A rule consists of a comma-separated list of one or more key-value pairs.
Each key has a distinct operation, depending on the used operator. Valid
operators are:</para>
<para>A rule consists of a comma-separated list of one or more key-operator-value expressions.
Each expression has a distinct effect, depending on the key and operator used.</para>
<refsect2>
<title>Operators</title>
<variablelist>
<varlistentry>
<term><literal>==</literal></term>
@ -115,7 +119,26 @@
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2>
<title>Values</title>
<para>Values are written as double quoted strings, such as ("string").
To include a quotation mark (") in the value, precede it by a backslash (\").
Any other occurrences of a character followed by a backslash are not further unescaped.
That is, "\t\n" is treated as four characters:
backslash, lowercase t, backslash, lowercase n.</para>
<para>The string can be prefixed with a lowercase e (e"string\n") to mark the string as
<ulink url="https://en.wikipedia.org/wiki/Escape_sequences_in_C#Table_of_escape_sequences">C-style escaped</ulink>.
For example, e"string\n" is parsed as 7 characters: 6 lowercase letters and a newline.
This can be useful for writting special characters when a kernel driver requires them.</para>
<para>Please note that <constant>NUL</constant> is not allowed in either string variant.</para>
</refsect2>
<refsect2>
<title>Keys</title>
<para>The following key names can be used to match against device properties.
Some of the keys also match against properties of the parent devices in sysfs,
not only the device that has generated the event. If multiple keys that match
@ -789,6 +812,7 @@
</listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>
<refsect1>