mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
udev: introduce ID_BLOCK_SUBSYSTEM property
Virtual block devices are a bit weird: they have no parent device, and thus cannot be related to the subsystem they belong to, except by pattern matching their name. This is OK to do if one knows what to look for. However for tools that do not want to carry a list of known subsystems with their appropriate matching patters this sucks. Let's introduce a new ID_BLOCK_SUBSYSTEM property we can set on block devices that carries an explicit string for this. Do so for a small number of key subsystems: DM, loopback and zram.
This commit is contained in:
@@ -14,3 +14,11 @@ ACTION!="remove", SUBSYSTEM=="block", \
|
||||
|
||||
# Reset access rights to each loopback device once it gets detached.
|
||||
ACTION=="change", SUBSYSTEM=="block", KERNEL=="loop*", ENV{DISK_MEDIA_CHANGE}=="1", TEST!="loop/backing_file", GROUP="disk", MODE="660"
|
||||
|
||||
# Provide a somewhat cleaned up field indicating the subsystem various
|
||||
# 'virtual' block devices belong too, in order to avoid replicating name based
|
||||
# pattern matching in every consumer
|
||||
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="dm-*", ENV{ID_BLOCK_SUBSYSTEM}="dm"
|
||||
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="loop*", ENV{ID_BLOCK_SUBSYSTEM}="loop"
|
||||
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="md*", ENV{ID_BLOCK_SUBSYSTEM}="md"
|
||||
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="zram*", ENV{ID_BLOCK_SUBSYSTEM}="zram"
|
||||
|
||||
Reference in New Issue
Block a user