mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
udevadm: trigger: implement --initialized-match/nomatch arguments
systemd-udev-trigger.service by default triggeres all devices regardless of whether they were already recognized by systemd-udevd. There are machines (especially in embedded environments) where systemd-udev-trigger.service is configured to run at a later stage of the boot sequence, which can lead to quite a lot of devices being triggered although they were already recognized by systemd-udevd. Re-triggering a lot of devices is a relatively expensive operation and therefore should be avoided if unnecessary. Therefore this patch introduces --initialized-nomatch, which filters out devices that are already present in the udev database. For consistance reasons --initialized-match is implemented as well, which filters out devices that are *not* already present in the udev database. Replaces #19949.
This commit is contained in:
committed by
Yu Watanabe
parent
d8b50e5df7
commit
678f2b1667
@@ -395,6 +395,35 @@
|
||||
then each matching result is ORed, that is, all children of each specified device are triggered.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--initialized-match</option></term>
|
||||
<term><option>--initialized-nomatch</option></term>
|
||||
<listitem>
|
||||
<para>When <option>--initialized-match</option> is specified, trigger events for devices
|
||||
that are already initialized by <command>systemd-udevd</command>, and skip devices that
|
||||
are not initialized yet.</para>
|
||||
<para>When <option>--initialized-nomatch</option> is specified, trigger events for devices
|
||||
that are not initialized by <command>systemd-udevd</command> yet, and skip devices that
|
||||
are already initialized.</para>
|
||||
<para>Here, initialized devices are those for which at least one udev rule already
|
||||
completed execution – for any action but <literal>remove</literal> — that set a property
|
||||
or other device setting (and thus has an entry in the udev device database). Devices are
|
||||
no longer considered initialized if a <literal>remove</literal> action is seen for them
|
||||
(which removes their entry in the udev device database). Note that devices that have no
|
||||
udev rules are never considered initialized, but might still be announced via the sd-device
|
||||
API (or similar). Typically, it is thus essential that applications which intend to use
|
||||
such a match, make sure a suitable udev rule is installed that sets at least one property
|
||||
on devices that shall be matched.</para>
|
||||
<para>WARNING: <option>--initialized-nomatch</option> can potentially save a significant
|
||||
amount of time compared to re-triggering all devices in the system and e.g. can be used to
|
||||
optimize boot time. However, this is not safe to be used in a boot sequence in general.
|
||||
Especially, when udev rules for a device depend on its parent devices (e.g.
|
||||
<literal>ATTRS</literal> or <literal>IMPORT{parent}</literal> keys, see
|
||||
<citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
|
||||
for more details), the final state of the device becomes easily unstable with this option.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-w</option></term>
|
||||
<term><option>--settle</option></term>
|
||||
|
||||
Reference in New Issue
Block a user