chiark / gitweb /
Add man page and references to it.
[elogind.git] / man / systemd.device.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6   This file is part of systemd.
7
8   Copyright 2010 Lennart Poettering
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="systemd.device">
25   <refentryinfo>
26     <title>systemd.device</title>
27     <productname>systemd</productname>
28
29     <authorgroup>
30       <author>
31         <contrib>Developer</contrib>
32         <firstname>Lennart</firstname>
33         <surname>Poettering</surname>
34         <email>lennart@poettering.net</email>
35       </author>
36     </authorgroup>
37   </refentryinfo>
38
39   <refmeta>
40     <refentrytitle>systemd.device</refentrytitle>
41     <manvolnum>5</manvolnum>
42   </refmeta>
43
44   <refnamediv>
45     <refname>systemd.device</refname>
46     <refpurpose>Device unit configuration</refpurpose>
47   </refnamediv>
48
49   <refsynopsisdiv>
50     <para><filename><replaceable>device</replaceable>.device</filename></para>
51   </refsynopsisdiv>
52
53   <refsect1>
54     <title>Description</title>
55
56     <para>A unit configuration file whose name ends in
57     <literal>.device</literal> encodes information about a device unit
58     as exposed in the
59     sysfs/<citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
60     device tree.</para>
61
62     <para>This unit type has no specific options. See
63     <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
64     for the common options of all unit configuration files. The common
65     configuration items are configured in the generic
66     <literal>[Unit]</literal> and <literal>[Install]</literal>
67     sections. A separate <literal>[Device]</literal> section does not
68     exist, since no device-specific options may be configured.</para>
69
70     <para>systemd will dynamically create device units for all kernel
71     devices that are marked with the "systemd" udev tag (by default
72     all block and network devices, and a few others). This may be used
73     to define dependencies between devices and other units. To tag a
74     udev device, use <literal>TAG+="systemd"</literal> in the udev
75     rules file, see
76     <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
77     for details.</para>
78
79     <para>Device units are named after the <filename>/sys</filename>
80     and <filename>/dev</filename> paths they control. Example: the
81     device <filename noindex='true'>/dev/sda5</filename> is exposed in
82     systemd as <filename>dev-sda5.device</filename>. For details about
83     the escaping logic used to convert a file system path to a unit
84     name see
85     <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
86
87   </refsect1>
88
89   <refsect1>
90     <title>The udev Database</title>
91
92     <para>The settings of device units may either be configured via
93     unit files, or directly from the udev database (which is
94     recommended). The following udev device properties are understood
95     by systemd:</para>
96
97     <variablelist class='udev-directives'>
98       <varlistentry>
99         <term><varname>SYSTEMD_WANTS=</varname></term>
100         <term><varname>SYSTEMD_USER_WANTS=</varname></term>
101         <listitem><para>Adds dependencies of type
102         <varname>Wants</varname> from the device unit to all listed
103         units. The first form is used by the system systemd instance,
104         the second by user systemd instances. Those settings may be
105         used to activate arbitrary units when a specific device
106         becomes available.</para>
107
108         <para>Note that this and the other tags are not taken into
109         account unless the device is tagged with the
110         <literal>systemd</literal> string in the udev database,
111         because otherwise the device is not exposed as a systemd unit
112         (see above).</para>
113
114         <para>Note that systemd will only act on
115         <varname>Wants</varname> dependencies when a device first
116         becomes active. It will not act on them if they are added to
117         devices that are already active. Use
118         <varname>SYSTEMD_READY=</varname> (see below) to influence on
119         which udev event to trigger the dependencies.
120         </para></listitem>
121       </varlistentry>
122
123       <varlistentry>
124         <term><varname>SYSTEMD_ALIAS=</varname></term>
125         <listitem><para>Adds an additional alias name to the device
126         unit. This must be an absolute path that is automatically
127         transformed into a unit name. (See above.)</para></listitem>
128       </varlistentry>
129
130       <varlistentry>
131         <term><varname>SYSTEMD_READY=</varname></term>
132         <listitem><para>If set to 0, systemd will consider this device
133         unplugged even if it shows up in the udev tree. If this
134         property is unset or set to 1, the device will be considered
135         plugged if it is visible in the udev tree. This property has
136         no influence on the behavior when a device disappears from the
137         udev tree.</para>
138
139         <para>This option is useful to support devices that initially
140         show up in an uninitialized state in the tree, and for which a
141         <literal>changed</literal> event is generated the moment they
142         are fully set up. Note that <varname>SYSTEMD_WANTS=</varname>
143         (see above) is not acted on as long as
144         <varname>SYSTEMD_READY=0</varname> is set for a
145         device.</para></listitem>
146       </varlistentry>
147
148       <varlistentry>
149         <term><varname>ID_MODEL_FROM_DATABASE=</varname></term>
150         <term><varname>ID_MODEL=</varname></term>
151
152         <listitem><para>If set, this property is used as description
153         string for the device unit.</para></listitem>
154       </varlistentry>
155
156     </variablelist>
157
158   </refsect1>
159
160   <refsect1>
161       <title>See Also</title>
162       <para>
163         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
164         <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
165         <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
166         <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
167         <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
168       </para>
169   </refsect1>
170
171 </refentry>