summaryrefslogtreecommitdiff
path: root/69-bcache.rules
diff options
context:
space:
mode:
Diffstat (limited to '69-bcache.rules')
-rw-r--r--69-bcache.rules30
1 files changed, 30 insertions, 0 deletions
diff --git a/69-bcache.rules b/69-bcache.rules
new file mode 100644
index 0000000..3f89b12
--- /dev/null
+++ b/69-bcache.rules
@@ -0,0 +1,30 @@
+# 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"
+