mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-03 00:00:07 +03:00
0c7a484a5b
Move the rule to run a bit later, after the standard udev rules have called blkid. Don't run blkid manually, and run probe-bcache as a fallback which can be patched out in a package that depends on util-linux 2.24+. probe-bcache: bail if libblkid finds anything Preserve our last-resort safety check here in case earlier rules fail to call blkid.
31 lines
1004 B
Plaintext
31 lines
1004 B
Plaintext
# register bcache devices as they come up
|
|
# man 7 udev for syntax
|
|
|
|
SUBSYSTEM!="block", GOTO="bcache_end"
|
|
ACTION=="remove", GOTO="bcache_end"
|
|
|
|
# blkid was run by the standard udev rules
|
|
# It recognised bcache (util-linux 2.24+)
|
|
ENV{ID_FS_TYPE}=="bcache", GOTO="bcache_backing_found"
|
|
# It recognised something else; bail
|
|
ENV{ID_FS_TYPE}=="?*", GOTO="bcache_backing_end"
|
|
|
|
# Backing devices: scan, symlink, register
|
|
IMPORT{program}="/sbin/probe-bcache -o udev $tempnode"
|
|
ENV{ID_FS_TYPE}!="bcache", GOTO="bcache_backing_end"
|
|
ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
|
|
|
|
LABEL="bcache_backing_found"
|
|
SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="bcache", \
|
|
RUN+="bcache-register $tempnode"
|
|
LABEL="bcache_backing_end"
|
|
|
|
# Cached devices: symlink
|
|
DRIVER=="bcache", ENV{CACHED_UUID}=="?*", \
|
|
SYMLINK+="bcache/by-uuid/$env{CACHED_UUID}"
|
|
DRIVER=="bcache", ENV{CACHED_LABEL}=="?*", \
|
|
SYMLINK+="bcache/by-label/$env{CACHED_LABEL}"
|
|
|
|
LABEL="bcache_end"
|
|
|