# Slackware permission rules
#
# These rules are here instead of 40-slackware.rules because
# many of them need to run after the block section in
# 50-udev.default.rules
#
# Remember, in any upgrade, this file will be overwritten.
# Put your custom rules somewhere else (90-local.rules is 
# a good idea).
#

# all disks with group disk
SUBSYSTEM=="block",             GROUP="disk"

# permissions for IDE floppy devices
KERNEL=="hd*[!0-9]", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", \
			SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove"
KERNEL=="hd*[0-9]", ATTRS{media}=="floppy", ATTRS{removable}=="1", \
			SYMLINK+="floppy-%k", OPTIONS+="ignore_remove"

# loopback devices
KERNEL=="loop[0-9]*",	NAME="loop/%n", SYMLINK+="%k"

# md block devices
KERNEL=="md[0-9]*",	NAME="md/%n", SYMLINK+="%k"

# aoe char devices (OK, this isn't a "block" device, but is a disk)
SUBSYSTEM=="aoe", KERNEL=="discover", \
			NAME="etherd/%k", GROUP="disk", MODE="0220"
SUBSYSTEM=="aoe", KERNEL=="err", \
			NAME="etherd/%k", GROUP="disk", MODE="0440"
SUBSYSTEM=="aoe", KERNEL=="interfaces", \
			NAME="etherd/%k", GROUP="disk", MODE="0220"

# ramdisk devices
KERNEL=="ram[0-9]*",	NAME="rd/%n", GROUP="disk", SYMLINK+="%k"

# put all removable devices in group "plugdev"
KERNEL=="hd*[!0-9]", ATTR{removable}=="1", GROUP="plugdev"
KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GROUP="plugdev"
KERNEL=="sd*[!0-9]", ATTR{removable}=="1", GROUP="plugdev"
KERNEL=="sd*[0-9]", ATTRS{removable}=="1", GROUP="plugdev"

# Many hot-pluggable devices (ZIP, Jazz, LS-120, etc...)
# need to be in plugdev, too.
KERNEL=="diskonkey*",	GROUP="plugdev"
KERNEL=="jaz*",		GROUP="plugdev"
KERNEL=="pocketzip*",	GROUP="plugdev"
KERNEL=="zip*",		GROUP="plugdev"
KERNEL=="ls120",	GROUP="plugdev"
KERNEL=="microdrive*",	GROUP="plugdev"

# LVM2 dmsetup
KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c"

# CD group and permissions 
ENV{ID_CDROM}=="?*", 		GROUP="cdrom", MODE="0660"
KERNEL=="pktcdvd",		GROUP="cdrom", MODE="0660"
KERNEL=="pktcdvd[0-9]*",	GROUP="cdrom", MODE="0660"
# permissions for SCSI sg devices
SUBSYSTEMS=="scsi", KERNEL=="s[gt][0-9]*", ATTRS{type}=="5", \
				GROUP="cdrom", MODE="0660"

# alsa devices
SUBSYSTEM=="sound", GROUP="audio"
