]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
udev: Persistent names for cached devices
authorGabriel <g2p.code@gmail.com>
Sat, 8 Jun 2013 01:00:57 +0000 (03:00 +0200)
committerGabriel <g2p.code@gmail.com>
Sat, 8 Jun 2013 01:00:57 +0000 (03:00 +0200)
Add /dev/bcache/by-uuid/ symlinks to cached devices.

61-bcache.rules

index 7857914aac7c08c094ac99fc6464011f1d3d43e9..3a4524916213bc1cc450e2aa51509324fceef81a 100644 (file)
@@ -1,8 +1,18 @@
 # register bcache devices as they come up
 # man 7 udev for syntax
 
-SUBSYSTEM=="block", IMPORT{program}="/sbin/probe-bcache -o udev $tempnode"
+SUBSYSTEM!="block", GOTO="bcache_end"
+ACTION=="remove", GOTO="bcache_end"
+
+# Backing devices: scan, symlink, register
+IMPORT{program}="/sbin/probe-bcache -o udev $tempnode"
 ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
 SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="bcache", \
         RUN+="bcache-register $tempnode"
 
+# Cached devices: symlink
+DRIVER=="bcache", ENV{CACHED_UUID}=="?*", \
+        SYMLINK+="bcache/by-uuid/$env{CACHED_UUID}"
+
+LABEL="bcache_end"
+