systemd: implement --initialized-match/nomatch arguments
PATCH 1/2 systemd: 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.
--- ...-initialized-match-nomatch-arguments.patch | 156 ++++++++++++++++++ meta/recipes-core/systemd/systemd_244.5.bb | 1 + 2 files changed, 157 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0001-udevadm-trigger-implement-initialized-match-nomatch-arguments.patch
meta/recipes-core/systemd/systemd/0001-udevadm-trigger-implement-initialized-match-nomatch-arguments.patch new file +156 -0
@@ -0,0 +1,156 @@ +From 678f2b16676cd566c50bdec78350f732a9a3ee41 Mon Sep 17 00:00:00 2001 +From: Danilo Krummrich <[email protected]> +Date: Mon, 14 Jun 2021 17:46:00 +0200 +Subject: [PATCH] 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. + +Upstream-Status: Backport [https://github.com/systemd/systemd/commit/678f2b16676cd566c50bdec78350f732a9a3ee41.patch] +Comment: Refreshed hunk from udevadm, _udevadm and udevadm-trigger.c +Signed-off-by: Pawan Badganchi <[email protected]> +--- + man/udevadm.xml | 29 +++++++++++++++++++++++++++++ + shell-completion/bash/udevadm | 3 ++- + shell-completion/zsh/_udevadm | 2 ++ + src/udev/udevadm-trigger.c | 13 +++++++++++++ + 4 files changed, 46 insertions(+), 1 deletion(-) + +diff --git a/man/udevadm.xml b/man/udevadm.xml +index 24ed4a29c71d..af485711222e 100644 +--- a/man/udevadm.xml ++++ b/man/udevadm.xml +@@ -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> +diff --git a/shell-completion/bash/udevadm b/shell-completion/bash/udevadm +index 4d52597cbfdf..23ce02365c7f 100644 +--- a/shell-completion/bash/udevadm ++++ b/shell-completion/bash/udevadm +@@ -51,7 +51,8 @@ + [INFO_STANDALONE]='-r --root -a --attribute-walk -x --export -e --export-db -c --cleanup-db + -w --wait-for-initialization' + [INFO_ARG]='-q --query -p --path -n --name -P --export-prefix -d --device-id-of-file' +- [TRIGGER_STANDALONE]='-v --verbose -n --dry-run -w --settle --wait-daemon' ++ [TRIGGER_STANDALONE]='-v --verbose -n --dry-run -w --settle --wait-daemon ++ --initialized-match --initialized-nomatch' + [TRIGGER_ARG]='-t --type -c --action -s --subsystem-match -S --subsystem-nomatch + -a --attr-match -A --attr-nomatch -p --property-match + -g --tag-match -y --sysname-match --name-match -b --parent-match' +diff --git a/shell-completion/zsh/_udevadm b/shell-completion/zsh/_udevadm +index 8a10237e3d66..63df8b7c9ecc 100644 +--- a/shell-completion/zsh/_udevadm ++++ b/shell-completion/zsh/_udevadm +@@ -30,7 +30,9 @@ + '--property-match=[Trigger events for devices with a matching property value.]' \ + '--tag-match=property[Trigger events for devices with a matching tag.]' \ + '--sysname-match=[Trigger events for devices with a matching sys device name.]' \ +- '--parent-match=[Trigger events for all children of a given device.]' ++ '--parent-match=[Trigger events for all children of a given device.]' \ ++ '--initialized-match[Trigger events for devices that are already initialized.]' \ ++ '--initialized-nomatch[Trigger events for devices that are not initialized yet.]' + } + + (( $+functions[_udevadm_settle] )) || +diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c +index e4b3150e6039..56921e2cc62e 100644 +--- a/src/udev/udevadm-trigger.c ++++ b/src/udev/udevadm-trigger.c +@@ -10,6 +10,7 @@ + #include "device-private.h" + #include "fd-util.h" + #include "fileio.h" ++#include "parse-util.h" + #include "path-util.h" + #include "process-util.h" + #include "set.h" +@@ -130,6 +131,8 @@ + " -y --sysname-match=NAME Trigger devices with this /sys path\n" + " --name-match=NAME Trigger devices with this /dev name\n" + " -b --parent-match=NAME Trigger devices with that parent device\n" ++ " --initialized-match Trigger devices that are already initialized\n" ++ " --initialized-nomatch Trigger devices that are not initialized yet\n" + " -w --settle Wait for the triggered events to complete\n" + " --wait-daemon[=SECONDS] Wait for udevd daemon to be initialized\n" + " before triggering uevents\n" +@@ -142,6 +145,8 @@ + enum { + ARG_NAME = 0x100, + ARG_PING, ++ ARG_INITIALIZED_MATCH, ++ ARG_INITIALIZED_NOMATCH, + }; + + static const struct option options[] = { +@@ -158,6 +163,8 @@ + { "sysname-match", required_argument, NULL, 'y' }, + { "name-match", required_argument, NULL, ARG_NAME }, + { "parent-match", required_argument, NULL, 'b' }, ++ { "initialized-match", no_argument, NULL, ARG_INITIALIZED_MATCH }, ++ { "initialized-nomatch", no_argument, NULL, ARG_INITIALIZED_NOMATCH }, + { "settle", no_argument, NULL, 'w' }, + { "wait-daemon", optional_argument, NULL, ARG_PING }, + { "version", no_argument, NULL, 'V' }, +@@ -301,7 +308,12 @@ + } + break; + } +- ++ case ARG_INITIALIZED_MATCH: ++ case ARG_INITIALIZED_NOMATCH: ++ r = device_enumerator_add_match_is_initialized(e, c == ARG_INITIALIZED_MATCH ? MATCH_INITIALIZED_YES : MATCH_INITIALIZED_NO); ++ if (r < 0) ++ return log_error_errno(r, "Failed to set initialized filter: %m"); ++ break; + case 'V': + return print_version(); + case 'h':
meta/recipes-core/systemd/systemd_244.5.bb +1 -0
@@ -39,6 +39,7 @@ SRC_URI += "file://touchscreen.rules \ file://CVE-2023-26604-2.patch \ file://CVE-2023-26604-3.patch \ file://CVE-2023-26604-4.patch \ + file://0001-udevadm-trigger-implement-initialized-match-nomatch-arguments.patch \ " # patches needed by musl
Signature · 1 line
2.38.1
PATCH 2/2 systemd: support to list only initialized/uninitialized devices
This patch filter devices by properties and return a sorted list only initialized/uninitialized devices.
--- ...initialized-or-uninitialized-devices.patch | 192 ++++++++++++++++++ meta/recipes-core/systemd/systemd_244.5.bb | 1 + 2 files changed, 193 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0001-sd-device-enumerator-support-to-list-only-initialized-or-uninitialized-devices.patch
meta/recipes-core/systemd/systemd/0001-sd-device-enumerator-support-to-list-only-initialized-or-uninitialized-devices.patch new file +192 -0
@@ -0,0 +1,192 @@ +From d8b50e5df7e01983279e70c6d970fb60d053df97 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe <[email protected]> +Date: Tue, 8 Mar 2022 13:58:02 +0900 +Subject: [PATCH] sd-device-enumerator: support to list only initialized or + uninitialized devices + +Upstream-Status: Backport [https://github.com/systemd/systemd/commit/d8b50e5df7e01983279e70c6d970fb60d053df97.patch] +Comment: Refreshed hunk from device-enumerator-private.h and device-enumerator.c +Add "errno.h" header file to fix below compiler error. +error: 'EINVAL' undeclared here (not in a function) +12 _MATCH_INITIALIZED_INVALID = -EINVAL +Signed-off-by: Pawan Badganchi <[email protected]> +--- + .../sd-device/device-enumerator-private.h | 11 ++- + src/libsystemd/sd-device/device-enumerator.c | 71 +++++++++++-------- + src/libudev/libudev-enumerate.c | 2 +- + 3 files changed, 54 insertions(+), 30 deletions(-) + +diff --git a/src/libsystemd/sd-device/device-enumerator-private.h b/src/libsystemd/sd-device/device-enumerator-private.h +index d74198822ca3..54fc13c43b22 100644 +--- a/src/libsystemd/sd-device/device-enumerator-private.h ++++ b/src/libsystemd/sd-device/device-enumerator-private.h +@@ -1,12 +1,23 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + #pragma once + ++#include <errno.h> ++ + #include "sd-device.h" + ++typedef enum MatchInitializedType { ++ MATCH_INITIALIZED_NO, /* only devices without a db entry */ ++ MATCH_INITIALIZED_YES, /* only devices with a db entry */ ++ MATCH_INITIALIZED_ALL, /* all devices */ ++ MATCH_INITIALIZED_COMPAT, /* only devices that have no devnode/ifindex or have a db entry */ ++ _MATCH_INITIALIZED_MAX, ++ _MATCH_INITIALIZED_INVALID = -EINVAL, ++} MatchInitializedType; ++ + int device_enumerator_scan_devices(sd_device_enumerator *enumeartor); + int device_enumerator_scan_subsystems(sd_device_enumerator *enumeartor); + int device_enumerator_add_device(sd_device_enumerator *enumerator, sd_device *device); +-int device_enumerator_add_match_is_initialized(sd_device_enumerator *enumerator); ++int device_enumerator_add_match_is_initialized(sd_device_enumerator *enumerator, MatchInitializedType type); + int device_enumerator_add_match_parent_incremental(sd_device_enumerator *enumerator, sd_device *parent); + sd_device *device_enumerator_get_first(sd_device_enumerator *enumerator); + sd_device *device_enumerator_get_next(sd_device_enumerator *enumerator); +diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c +index df8753dec9b4..1379764156ee 100644 +--- a/src/libsystemd/sd-device/device-enumerator.c ++++ b/src/libsystemd/sd-device/device-enumerator.c +@@ -44,7 +44,7 @@ struct sd_device_enumerator { + Set *match_sysname; + Set *match_tag; + Set *match_parent; +- bool match_allow_uninitialized; ++ MatchInitializedType match_initialized; + }; + + _public_ int sd_device_enumerator_new(sd_device_enumerator **ret) { +@@ -59,6 +59,7 @@ _public_ int sd_device_enumerator_new(sd_device_enumerator **ret) { + *enumerator = (sd_device_enumerator) { + .n_ref = 1, + .type = _DEVICE_ENUMERATION_TYPE_INVALID, ++ .match_initialized = MATCH_INITIALIZED_COMPAT, + }; + + *ret = TAKE_PTR(enumerator); +@@ -259,17 +259,18 @@ + _public_ int sd_device_enumerator_allow_uninitialized(sd_device_enumerator *enumerator) { + assert_return(enumerator, -EINVAL); + +- enumerator->match_allow_uninitialized = true; ++ enumerator->match_initialized = MATCH_INITIALIZED_ALL; + + enumerator->scan_uptodate = false; + + return 0; + } + +-int device_enumerator_add_match_is_initialized(sd_device_enumerator *enumerator) { ++int device_enumerator_add_match_is_initialized(sd_device_enumerator *enumerator, MatchInitializedType type) { + assert_return(enumerator, -EINVAL); ++ assert_return(type >= 0 && type < _MATCH_INITIALIZED_MAX, -EINVAL); + +- enumerator->match_allow_uninitialized = false; ++ enumerator->match_initialized = type; + + enumerator->scan_uptodate = false; + +@@ -461,11 +461,44 @@ + return false; + } + ++static int match_initialized(sd_device_enumerator *enumerator, sd_device *device) { ++ int r; ++ ++ assert(enumerator); ++ assert(device); ++ ++ if (enumerator->match_initialized == MATCH_INITIALIZED_ALL) ++ return true; ++ ++ r = sd_device_get_is_initialized(device); ++ if (r == -ENOENT) /* this is necessarily racey, so ignore missing devices */ ++ return false; ++ if (r < 0) ++ return r; ++ ++ if (enumerator->match_initialized == MATCH_INITIALIZED_COMPAT) { ++ /* only devices that have no devnode/ifindex or have a db entry are accepted. */ ++ if (r > 0) ++ return true; ++ ++ if (sd_device_get_devnum(device, NULL) >= 0) ++ return true; ++ ++ if (sd_device_get_ifindex(device, NULL) >= 0) ++ return true; ++ ++ return false; ++ } ++ ++ return (enumerator->match_initialized == MATCH_INITIALIZED_NO) == (r == 0); ++} ++ ++ + static int enumerator_scan_dir_and_add_devices(sd_device_enumerator *enumerator, const char *basedir, const char *subdir1, const char *subdir2) { + _cleanup_closedir_ DIR *dir = NULL; + char *path; + struct dirent *dent; +- int r = 0; ++ int k, r = 0; + + assert(enumerator); + assert(basedir); +@@ -485,7 +519,6 @@ + FOREACH_DIRENT_ALL(dent, dir, return -errno) { + _cleanup_(sd_device_unrefp) sd_device *device = NULL; + char syspath[strlen(path) + 1 + strlen(dent->d_name) + 1]; +- int initialized, k; + + if (dent->d_name[0] == '.') + continue; +@@ -504,31 +537,13 @@ + continue; + } + +- initialized = sd_device_get_is_initialized(device); +- if (initialized < 0) { +- if (initialized != -ENOENT) +- /* this is necessarily racey, so ignore missing devices */ +- r = initialized; +- ++ k = match_initialized(enumerator, device); ++ if (k <= 0) { ++ if (k < 0) ++ r = k; + continue; + } + +- /* +- * All devices with a device node or network interfaces +- * possibly need udev to adjust the device node permission +- * or context, or rename the interface before it can be +- * reliably used from other processes. +- * +- * For now, we can only check these types of devices, we +- * might not store a database, and have no way to find out +- * for all other types of devices. +- */ +- if (!enumerator->match_allow_uninitialized && +- !initialized && +- (sd_device_get_devnum(device, NULL) >= 0 || +- sd_device_get_ifindex(device, NULL) >= 0)) +- continue; +- + if (!match_parent(enumerator, device)) + continue; + +diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c +index 2dc695bd03f9..d71a31c566a7 100644 +--- a/src/libudev/libudev-enumerate.c ++++ b/src/libudev/libudev-enumerate.c +@@ -365,7 +365,7 @@ _public_ int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev + + assert_return(udev_enumerate, -EINVAL); + +- r = device_enumerator_add_match_is_initialized(udev_enumerate->enumerator); ++ r = device_enumerator_add_match_is_initialized(udev_enumerate->enumerator, MATCH_INITIALIZED_COMPAT); + if (r < 0) + return r;
meta/recipes-core/systemd/systemd_244.5.bb +1 -0
@@ -40,6 +40,7 @@ SRC_URI += "file://touchscreen.rules \ file://CVE-2023-26604-3.patch \ file://CVE-2023-26604-4.patch \ file://0001-udevadm-trigger-implement-initialized-match-nomatch-arguments.patch \ + file://0001-sd-device-enumerator-support-to-list-only-initialized-or-uninitialized-devices.patch \ " # patches needed by musl
Signature · 1 line
2.38.1
Feedback request: Re: [OE-core][dunfell][PATCH 1/2] systemd: implement --initialized-match/nomatch arguments
In reply to pawanThis patch series adds a feature to systemd, which is typically not allowed in a stable branch.
However I can see that there might be an argument that this is actually fixing a bug (needless re-triggering of devices)
I'd love to get feedback from others as to whether I should take this patch.
Steve
Quoted 210 lines · Pawan Badganchi
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.
Signed-off-by Pawan Badganchi <[email protected]>--- ...-initialized-match-nomatch-arguments.patch | 156 ++++++++++++++++++ meta/recipes-core/systemd/systemd_244.5.bb | 1 + 2 files changed, 157 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0001-udevadm-trigger-implement-initialized-match-nomatch-arguments.patchmeta/recipes-core/systemd/systemd/0001-udevadm-trigger-implement-initialized-match-nomatch-arguments.patch new file +156
-0@@ -0,0 +1,156 @@ +From 678f2b16676cd566c50bdec78350f732a9a3ee41 Mon Sep 17 00:00:00 2001 +From: Danilo Krummrich <[email protected]> +Date: Mon, 14 Jun 2021 17:46:00 +0200 +Subject: [PATCH] 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. + +Upstream-Status: Backport [https://github.com/systemd/systemd/commit/678f2b16676cd566c50bdec78350f732a9a3ee41.patch] +Comment: Refreshed hunk from udevadm, _udevadm and udevadm-trigger.c +Signed-off-by: Pawan Badganchi <[email protected]> +--- + man/udevadm.xml | 29 +++++++++++++++++++++++++++++ + shell-completion/bash/udevadm | 3 ++- + shell-completion/zsh/_udevadm | 2 ++ + src/udev/udevadm-trigger.c | 13 +++++++++++++ + 4 files changed, 46 insertions(+), 1 deletion(-) + +diff --git a/man/udevadm.xml b/man/udevadm.xml +index 24ed4a29c71d..af485711222e 100644 +--- a/man/udevadm.xml ++++ b/man/udevadm.xml +@@ -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> +diff --git a/shell-completion/bash/udevadm b/shell-completion/bash/udevadm +index 4d52597cbfdf..23ce02365c7f 100644 +--- a/shell-completion/bash/udevadm ++++ b/shell-completion/bash/udevadm +@@ -51,7 +51,8 @@ + [INFO_STANDALONE]='-r --root -a --attribute-walk -x --export -e --export-db -c --cleanup-db + -w --wait-for-initialization' + [INFO_ARG]='-q --query -p --path -n --name -P --export-prefix -d --device-id-of-file' +- [TRIGGER_STANDALONE]='-v --verbose -n --dry-run -w --settle --wait-daemon' ++ [TRIGGER_STANDALONE]='-v --verbose -n --dry-run -w --settle --wait-daemon ++ --initialized-match --initialized-nomatch' + [TRIGGER_ARG]='-t --type -c --action -s --subsystem-match -S --subsystem-nomatch + -a --attr-match -A --attr-nomatch -p --property-match + -g --tag-match -y --sysname-match --name-match -b --parent-match' +diff --git a/shell-completion/zsh/_udevadm b/shell-completion/zsh/_udevadm +index 8a10237e3d66..63df8b7c9ecc 100644 +--- a/shell-completion/zsh/_udevadm ++++ b/shell-completion/zsh/_udevadm +@@ -30,7 +30,9 @@ + '--property-match=[Trigger events for devices with a matching property value.]' \ + '--tag-match=property[Trigger events for devices with a matching tag.]' \ + '--sysname-match=[Trigger events for devices with a matching sys device name.]' \ +- '--parent-match=[Trigger events for all children of a given device.]' ++ '--parent-match=[Trigger events for all children of a given device.]' \ ++ '--initialized-match[Trigger events for devices that are already initialized.]' \ ++ '--initialized-nomatch[Trigger events for devices that are not initialized yet.]' + } + + (( $+functions[_udevadm_settle] )) || +diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c +index e4b3150e6039..56921e2cc62e 100644 +--- a/src/udev/udevadm-trigger.c ++++ b/src/udev/udevadm-trigger.c +@@ -10,6 +10,7 @@ + #include "device-private.h" + #include "fd-util.h" + #include "fileio.h" ++#include "parse-util.h" + #include "path-util.h" + #include "process-util.h" + #include "set.h" +@@ -130,6 +131,8 @@ + " -y --sysname-match=NAME Trigger devices with this /sys path\n" + " --name-match=NAME Trigger devices with this /dev name\n" + " -b --parent-match=NAME Trigger devices with that parent device\n" ++ " --initialized-match Trigger devices that are already initialized\n" ++ " --initialized-nomatch Trigger devices that are not initialized yet\n" + " -w --settle Wait for the triggered events to complete\n" + " --wait-daemon[=SECONDS] Wait for udevd daemon to be initialized\n" + " before triggering uevents\n" +@@ -142,6 +145,8 @@ + enum { + ARG_NAME = 0x100, + ARG_PING, ++ ARG_INITIALIZED_MATCH, ++ ARG_INITIALIZED_NOMATCH, + }; + + static const struct option options[] = { +@@ -158,6 +163,8 @@ + { "sysname-match", required_argument, NULL, 'y' }, + { "name-match", required_argument, NULL, ARG_NAME }, + { "parent-match", required_argument, NULL, 'b' }, ++ { "initialized-match", no_argument, NULL, ARG_INITIALIZED_MATCH }, ++ { "initialized-nomatch", no_argument, NULL, ARG_INITIALIZED_NOMATCH }, + { "settle", no_argument, NULL, 'w' }, + { "wait-daemon", optional_argument, NULL, ARG_PING }, + { "version", no_argument, NULL, 'V' }, +@@ -301,7 +308,12 @@ + } + break; + } +- ++ case ARG_INITIALIZED_MATCH: ++ case ARG_INITIALIZED_NOMATCH: ++ r = device_enumerator_add_match_is_initialized(e, c == ARG_INITIALIZED_MATCH ? MATCH_INITIALIZED_YES : MATCH_INITIALIZED_NO); ++ if (r < 0) ++ return log_error_errno(r, "Failed to set initialized filter: %m"); ++ break; + case 'V': + return print_version(); + case 'h':meta/recipes-core/systemd/systemd_244.5.bb +1
-1@@ -39,6 +39,7 @@ SRC_URI += "file://touchscreen.rules \ file://CVE-2023-26604-2.patch \ file://CVE-2023-26604-3.patch \ file://CVE-2023-26604-4.patch \ + file://0001-udevadm-trigger-implement-initialized-match-nomatch-arguments.patch \ " # patches needed by musl --2.38.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#182500): https://lists.openembedded.org/g/openembedded-core/message/182500
Mute This Topic: https://lists.openembedded.org/mt/99403398/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hi,
Could you please take this patch
Re: [dunfell][PATCH 2/2] systemd: support to list only initialized/uninitialized devices
In reply to pawanHi,
Could you please take this patch
Quoted 4 lines · Pawan Badganchi
Hi,
Could you please take this patch
Sorry, this seried is a feature change and not a candidate for a stable release.
Steve
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#191135): https://lists.openembedded.org/g/openembedded-core/message/191135
Mute This Topic: https://lists.openembedded.org/mt/99403398/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-