summaryrefslogtreecommitdiffstats
path: root/shell-completion
diff options
context:
space:
mode:
authorFederico Giovanardi <federico.giovanardi@cnhind.com>2024-10-17 15:29:51 +0200
committerLennart Poettering <lennart@poettering.net>2024-12-16 15:43:52 +0100
commit7fd45eec37840036f6659fa15e73a9fd896d5613 (patch)
tree8217a73cfcebb3360525825edb6d9d72213176f6 /shell-completion
parentterminal-util: temporarily turn on nonblocking mode when waiting for ANSI seq... (diff)
downloadsystemd-7fd45eec37840036f6659fa15e73a9fd896d5613.tar.xz
systemd-7fd45eec37840036f6659fa15e73a9fd896d5613.zip
udev: add option to trigger parent devices despite filters
This commit add the `-i` option to `udevadm trigger` that force it to match parent devices even if they're excluded from filters. The rationale is that some embedded devices have a huge number of platform devices ( ~ 4k for MX8 ) they are there because they're defined in the device tree but there isn't any action or udev rules associated with them. So at boot a significant time is spend triggering and processing rules for devices that don't produce any effect and we would like to filter them by calling: ``` udevadm trigger --type=device --action=add -s block -s tty ``` instead of the normal ``` udevadm trigger --type=device --action=add ``` so we can use filter to filter out only subsystems for we we know that we have rules in place that do something useful. On the other side action / rules are not triggered until the parent is triggered ( which is part of another subsystem), so the additional option will allows udev to complete the coldplug with only the devices we care. Example on iMX8: .Without the new option ``` root@dev:~# udevadm trigger --dry-run -s block --action=add -v /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot0 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot1 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p1 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p2 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p3 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p4 ``` .With the new option ``` root@dev:~# udevadm trigger --dry-run -i -s block --action=add -v /sys/devices/platform /sys/devices/platform/bus@5b000000 /sys/devices/platform/bus@5b000000/5b010000.mmc /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot0 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot1 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p1 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p2 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p3 /sys/devices/platform/bus@5b000000/5b010000.mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p4 ``` Boot time reduction with this is place is ~ 1 second.
Diffstat (limited to 'shell-completion')
-rw-r--r--shell-completion/bash/udevadm2
-rw-r--r--shell-completion/zsh/_udevadm1
2 files changed, 2 insertions, 1 deletions
diff --git a/shell-completion/bash/udevadm b/shell-completion/bash/udevadm
index 3842d722e7..e5626c9301 100644
--- a/shell-completion/bash/udevadm
+++ b/shell-completion/bash/udevadm
@@ -58,7 +58,7 @@ _udevadm() {
--json --subsystem-match --subsystem-nomatch --attr-match --attr-nomatch --property-match
--tag-match --sysname-match --name-match --parent-match'
[TRIGGER_STANDALONE]='-v --verbose -n --dry-run -q --quiet -w --settle --wait-daemon --uuid
- --initialized-match --initialized-nomatch'
+ --initialized-match --initialized-nomatch --include-parents'
[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 9ff87d8312..5f5761cbfa 100644
--- a/shell-completion/zsh/_udevadm
+++ b/shell-completion/zsh/_udevadm
@@ -38,6 +38,7 @@ _udevadm_trigger(){
'--tag-match=[Trigger events for devices with a matching tag.]:TAG' \
'--sysname-match=[Trigger events for devices with a matching sys device name.]:NAME' \
'--parent-match=[Trigger events for all children of a given device.]:NAME' \
+ '--include-parents[Also trigger parent devices of found devices.]' \
'--initialized-match[Trigger events for devices that are already initialized.]' \
'--initialized-nomatch[Trigger events for devices that are not initialized yet.]' \
'--uuid[Print synthetic uevent UUID.]' \