]>
Commit | Line | Data |
---|---|---|
eec575d8 | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
eec575d8 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
eec575d8 LP |
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 | |
5430f7f2 LP |
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 | |
eec575d8 LP |
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 | |
5430f7f2 | 18 | Lesser General Public License for more details. |
eec575d8 | 19 | |
5430f7f2 | 20 | You should have received a copy of the GNU Lesser General Public License |
eec575d8 LP |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
22 | --> | |
23 | ||
24 | <refentry id="systemd.device"> | |
798d3a52 ZJS |
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> | |
0ffddc6e JR |
86 | |
87 | <para>Device units will be reloaded by systemd whenever the | |
88 | corresponding device generates a <literal>changed</literal> event. | |
89 | Other units can use <varname>ReloadPropagatedFrom=</varname> to react | |
90 | to that event</para> | |
91 | ||
c129bd5d | 92 | </refsect1> |
798d3a52 | 93 | |
c129bd5d | 94 | <refsect1> |
45f09f93 | 95 | <title>Implicit Dependencies</title> |
c129bd5d LP |
96 | |
97 | <para>Many unit types automatically acquire dependencies on device | |
98 | units of devices they require. For example, | |
99 | <filename>.socket</filename> unit acquire dependencies on the | |
100 | device units of the network interface specified in | |
101 | <varname>BindToDevice=</varname>. Similar, swap and mount units | |
102 | acquire dependencies on the units encapsulating their backing | |
103 | block devices.</para> | |
798d3a52 ZJS |
104 | </refsect1> |
105 | ||
45f09f93 JL |
106 | <refsect1> |
107 | <title>Default Dependencies</title> | |
108 | ||
109 | <para>There are no default dependencies for device units.</para> | |
110 | </refsect1> | |
111 | ||
798d3a52 ZJS |
112 | <refsect1> |
113 | <title>The udev Database</title> | |
114 | ||
115 | <para>The settings of device units may either be configured via | |
116 | unit files, or directly from the udev database (which is | |
117 | recommended). The following udev device properties are understood | |
118 | by systemd:</para> | |
119 | ||
120 | <variablelist class='udev-directives'> | |
121 | <varlistentry> | |
122 | <term><varname>SYSTEMD_WANTS=</varname></term> | |
123 | <term><varname>SYSTEMD_USER_WANTS=</varname></term> | |
124 | <listitem><para>Adds dependencies of type | |
125 | <varname>Wants</varname> from the device unit to all listed | |
126 | units. The first form is used by the system systemd instance, | |
127 | the second by user systemd instances. Those settings may be | |
128 | used to activate arbitrary units when a specific device | |
129 | becomes available.</para> | |
130 | ||
131 | <para>Note that this and the other tags are not taken into | |
132 | account unless the device is tagged with the | |
133 | <literal>systemd</literal> string in the udev database, | |
134 | because otherwise the device is not exposed as a systemd unit | |
135 | (see above).</para> | |
136 | ||
137 | <para>Note that systemd will only act on | |
138 | <varname>Wants</varname> dependencies when a device first | |
139 | becomes active. It will not act on them if they are added to | |
140 | devices that are already active. Use | |
141 | <varname>SYSTEMD_READY=</varname> (see below) to influence on | |
142 | which udev event to trigger the dependencies. | |
143 | </para></listitem> | |
144 | </varlistentry> | |
145 | ||
146 | <varlistentry> | |
147 | <term><varname>SYSTEMD_ALIAS=</varname></term> | |
148 | <listitem><para>Adds an additional alias name to the device | |
149 | unit. This must be an absolute path that is automatically | |
150 | transformed into a unit name. (See above.)</para></listitem> | |
151 | </varlistentry> | |
152 | ||
153 | <varlistentry> | |
154 | <term><varname>SYSTEMD_READY=</varname></term> | |
155 | <listitem><para>If set to 0, systemd will consider this device | |
156 | unplugged even if it shows up in the udev tree. If this | |
157 | property is unset or set to 1, the device will be considered | |
158 | plugged if it is visible in the udev tree. This property has | |
159 | no influence on the behavior when a device disappears from the | |
160 | udev tree.</para> | |
161 | ||
162 | <para>This option is useful to support devices that initially | |
163 | show up in an uninitialized state in the tree, and for which a | |
164 | <literal>changed</literal> event is generated the moment they | |
165 | are fully set up. Note that <varname>SYSTEMD_WANTS=</varname> | |
166 | (see above) is not acted on as long as | |
167 | <varname>SYSTEMD_READY=0</varname> is set for a | |
168 | device.</para></listitem> | |
169 | </varlistentry> | |
170 | ||
171 | <varlistentry> | |
172 | <term><varname>ID_MODEL_FROM_DATABASE=</varname></term> | |
173 | <term><varname>ID_MODEL=</varname></term> | |
174 | ||
175 | <listitem><para>If set, this property is used as description | |
176 | string for the device unit.</para></listitem> | |
177 | </varlistentry> | |
178 | ||
179 | </variablelist> | |
180 | ||
181 | </refsect1> | |
182 | ||
183 | <refsect1> | |
184 | <title>See Also</title> | |
185 | <para> | |
186 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
187 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
188 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
189 | <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>, | |
190 | <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
191 | </para> | |
192 | </refsect1> | |
eec575d8 LP |
193 | |
194 | </refentry> |