From 1cd1fdb12e5af503e2d1953acc6385fbbc197044 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Wed, 13 Jun 2007 19:01:10 +0000 Subject: [PATCH] * imported suse rules from udev-112 as the base for our own udev rules git-svn-id: svn://svn.opensde.net/opensde/package/branches/udev@21338 10447126-35f2-4685-b0cf-6dd780d3921f --- filesystem/udev/rules/50-udev-default.rules | 126 +++++++++++++++++++ filesystem/udev/rules/64-device-mapper.rules | 19 +++ filesystem/udev/rules/64-md-raid.rules | 18 +++ 3 files changed, 163 insertions(+) create mode 100644 filesystem/udev/rules/50-udev-default.rules create mode 100644 filesystem/udev/rules/64-device-mapper.rules create mode 100644 filesystem/udev/rules/64-md-raid.rules diff --git a/filesystem/udev/rules/50-udev-default.rules b/filesystem/udev/rules/50-udev-default.rules new file mode 100644 index 000000000..3017634f1 --- /dev/null +++ b/filesystem/udev/rules/50-udev-default.rules @@ -0,0 +1,126 @@ +# console +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty[0-9]*|vcs*", GROUP="tty", MODE="0620", OPTIONS="last_rule" +KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="console", MODE="0600", OPTIONS="last_rule" + +# serial devices +KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" +KERNEL=="hvc*|hvsi*", GROUP="uucp" +KERNEL=="iseries/vtty*", GROUP="uucp" +KERNEL=="mwave", NAME="modems/%k", GROUP="uucp" +KERNEL=="ttyUSB*", ATTRS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" +KERNEL=="ttyUSB*", ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*", SYMLINK+="pilot" + +# video/graphics +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="graphics" GROUP="video" +KERNEL=="vtx*|vbi*", GROUP="video" +KERNEL=="winradio*", GROUP="video" +KERNEL=="vttuner*", GROUP="video" +KERNEL=="nvidia*|nvidiactl*", GROUP="video" +KERNEL=="video0", SYMLINK+="video" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="vbi0", SYMLINK+="vbi" +KERNEL=="pmu", GROUP="video" + +# dvb +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" + +# input devices +KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" +KERNEL=="js*", NAME="input/%k", MODE="0644" +KERNEL=="ts*|uinput", NAME="input/%k", MODE="0600" +KERNEL=="lirc0", SYMLINK+="lirc" + +# printer +SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" +KERNEL=="irlpt*", GROUP="lp" + +# cpu devices +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + +# IEEE1394 devices +KERNEL=="raw1394*", GROUP="video" +KERNEL=="dv1394*", SYMLINK+="dv1394/%n", GROUP="video" +KERNEL=="video1394*", SYMLINK+="video1394/%n", GROUP="video" + +KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" +KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" +KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" + +# network +KERNEL=="tun", NAME="net/%k", MODE="0666" + +# misc devices +KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" +KERNEL=="nvram", GROUP="kmem", MODE="0600" +KERNEL=="null|zero|random", MODE="0666" +KERNEL=="full", MODE="0622" +KERNEL=="urandom", MODE="0644" +KERNEL=="rtc", MODE="0600" +KERNEL=="fuse", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", MODE="0600", GROUP="video" +KERNEL=="djs*", MODE="0644" +KERNEL=="sgi_*", MODE="0666" +KERNEL=="rrom*", MODE="0400" +KERNEL=="rflash*", MODE="0400" +KERNEL=="usbscanner*", MODE="0644" +KERNEL=="3270/ttycons*", MODE="0600" +KERNEL=="3270/tub*", MODE="0666" +KERNEL=="3270/tubcons*", MODE="0600" +KERNEL=="ica", MODE="0666" +KERNEL=="z90crypt", MODE="0666" +KERNEL=="mmtimer", MODE="0644" +KERNEL=="auer[0-9]*" NAME="usb/%k" + +# packet writing interface +KERNEL=="pktcdvd", NAME="pktcdvd/control" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" + +# additional floppy devices (no sysfs entries) +KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G disk $root/%k" + +# block devices +SUBSYSTEM=="block", GROUP="disk", MODE="0640" + +# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC +# sr: 4 TYPE_WORM, 5 TYPE_ROM +# st/osst: 1 TYPE_TAPE +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" +SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="1", ATTR{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" +KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" +SUBSYSTEM=="ide", ACTION=="add", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" +SUBSYSTEM=="mmc", ACTION=="add", RUN+="/sbin/modprobe mmc_block" + +# misc storage devices (non-block) +KERNEL=="sg*", GROUP="disk", MODE="0640" +KERNEL=="st*|nst*", GROUP="disk" +KERNEL=="qft*|nqft*|zqft*|nzqft*|rawqft*|nrawqft", GROUP="disk" +KERNEL=="ht*|nht*", GROUP="disk" +KERNEL=="pf*", GROUP="disk" +KERNEL=="sch*", GROUP="disk" +KERNEL=="pt*|npt*", GROUP="disk" +KERNEL=="pg*", GROUP="disk" +KERNEL=="evms/block_device*", GROUP="disk" +KERNEL=="rawctl*", NAME="raw/%k", GROUP="disk" +SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL=="osst*|nosst*", NAME="%k", GROUP="disk" +KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" + +# libusb device access +SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" + +# kernel firmware loader +SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" + diff --git a/filesystem/udev/rules/64-device-mapper.rules b/filesystem/udev/rules/64-device-mapper.rules new file mode 100644 index 000000000..9555e9799 --- /dev/null +++ b/filesystem/udev/rules/64-device-mapper.rules @@ -0,0 +1,19 @@ +KERNEL=="device-mapper", SYMLINK+="mapper/control" + +KERNEL!="dm-*", GOTO="device_mapper_end" +ACTION!="add|change", GOTO="device_mapper_end" + +IMPORT{program}="/sbin/dmsetup export -j%M -m%m" +ENV{DM_NAME}!="?*", GOTO="device_mapper_end" + +SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" +ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" + +ENV{DM_STATE}!="ACTIVE", GOTO="device_mapper_end" +ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" +IMPORT{program}="vol_id --export $tempnode" +OPTIONS="link_priority=-100" +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", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="device_mapper_end" diff --git a/filesystem/udev/rules/64-md-raid.rules b/filesystem/udev/rules/64-md-raid.rules new file mode 100644 index 000000000..6bbfd126d --- /dev/null +++ b/filesystem/udev/rules/64-md-raid.rules @@ -0,0 +1,18 @@ +# md links hook into "change" events, when the array becomes available + +SUBSYSTEM!="block", GOTO="md_end" +KERNEL!="md[0-9]*", GOTO="md_end" +ACTION!="add|change", GOTO="md_end" + +ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" + +IMPORT{program}="/sbin/mdadm --detail --export $tempnode" +ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" +ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" + +IMPORT{program}="vol_id --export $tempnode" +OPTIONS="link_priority=100" +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", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="md_end"