Samuel Mendoza-Jonas | d939857 | 2017-06-05 13:22:05 +1000 | [diff] [blame] | 1 | # Copyright (C) 2009 Red Hat, Inc. All rights reserved. |
| 2 | # |
| 3 | # This file is part of LVM2. |
| 4 | |
| 5 | # Udev rules for device-mapper devices. |
| 6 | # |
| 7 | # These rules create symlinks in /dev/disk directory. |
| 8 | # Symlinks that depend on probing filesystem type, |
| 9 | # label and uuid are created only if the device is not |
| 10 | # suspended. |
| 11 | |
| 12 | # "add" event is processed on coldplug only! |
| 13 | ACTION!="add|change", GOTO="dm_end" |
| 14 | ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end" |
| 15 | ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_end" |
| 16 | |
| 17 | SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" |
| 18 | ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" |
| 19 | |
| 20 | ENV{DM_SUSPENDED}=="1", GOTO="dm_end" |
| 21 | ENV{DM_NOSCAN}=="1", GOTO="dm_watch" |
| 22 | |
| 23 | IMPORT{builtin}="blkid" |
| 24 | ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS="link_priority=-100" |
| 25 | ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" |
| 26 | ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" |
| 27 | |
| 28 | # Add inotify watch to track changes on this device. |
| 29 | # Using the watch rule is not optimal - it generates a lot of spurious |
| 30 | # and useless events whenever the device opened for read-write is closed. |
| 31 | # The best would be to generete the event directly in the tool changing |
| 32 | # relevant information so only relevant events will be processed |
| 33 | # (like creating a filesystem, changing filesystem label etc.). |
| 34 | # |
| 35 | # But let's use this until we have something better... |
| 36 | LABEL="dm_watch" |
| 37 | OPTIONS+="watch" |
| 38 | |
| 39 | LABEL="dm_end" |