summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2020-06-03 10:41:28 +0200
committerJonathan Bauer2020-06-03 10:42:05 +0200
commit7892cd42da53ee39bc5de8d9cbeb248f11907ee4 (patch)
tree73884ea870c7b79aaf0c08214834e94e1e8bd375
parentNoted kernel version support in README.md (diff)
downloadxloop-7892cd42da53ee39bc5de8d9cbeb248f11907ee4.tar.gz
xloop-7892cd42da53ee39bc5de8d9cbeb248f11907ee4.tar.xz
xloop-7892cd42da53ee39bc5de8d9cbeb248f11907ee4.zip
udev rule for /dev/xloop*
-rw-r--r--udev/50-xloop.rules37
1 files changed, 37 insertions, 0 deletions
diff --git a/udev/50-xloop.rules b/udev/50-xloop.rules
new file mode 100644
index 0000000..5d727bf
--- /dev/null
+++ b/udev/50-xloop.rules
@@ -0,0 +1,37 @@
+# Adapted from /usr/lib/udev/rules.d/60-persistent-storage.rules
+# Only handle /dev/xloop* devices.
+#
+# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path}
+# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
+
+ACTION=="remove", GOTO="xloop_storage_end"
+
+SUBSYSTEM!="block", GOTO="xloop_storage_end"
+KERNEL!="xloop*", GOTO="xloop_storage_end"
+
+# ignore partitions that span the entire disk
+TEST=="whole_disk", GOTO="xloop_storage_end"
+
+# for partitions import parent information
+ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
+
+# by-path
+ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
+
+# probe filesystem metadata of disks
+IMPORT{builtin}="blkid"
+
+# by-label/by-uuid links (filesystem metadata)
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+# by-id (World Wide Name)
+ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}"
+ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n"
+
+# by-partlabel/by-partuuid links (partition metadata)
+ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}"
+ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}"
+
+LABEL="xloop_storage_end"