linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* persistent.rules
@ 2005-08-05 18:55 Marco d'Itri
  2005-08-09 10:50 ` persistent.rules Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Marco d'Itri @ 2005-08-05 18:55 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 131 bytes --]

For the debian directory. I cleaned up the gentoo rules, it's not widely
tested but looks like it's working fine.

-- 
ciao,
Marco

[-- Attachment #2: persistent.rules --]
[-- Type: text/plain, Size: 1980 bytes --]

# This file contains the rules needed to create persistent device names.

# we are only interested in add actions for block devices
ACTION!="add",		GOTO="no_volume_id"
SUBSYSTEM!="block",	GOTO="no_volume_id"

# and we can safely ignore these kinds of devices
KERNEL=="ram*|loop*|fd*|sr*", GOTO="no_volume_id"

# skip removable ide devices, because the IDE drivers are horrible broken
BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id"

# disk id
KERNEL=="hd*[!0-9]",	IMPORT="/sbin/ata_id --export $tempnode"
KERNEL=="hd*[!0-9]",	ENV{ID_SERIAL}=="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"

KERNEL=="hd*[0-9]",	IMPORT{parent}="ID_*"
KERNEL=="hd*[0-9]",	ENV{ID_SERIAL}=="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"

KERNEL=="sd*[!0-9]",	SYSFS{ieee1394_id}=="*", \
	IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'"
KERNEL=="sd*[!0-9]",	ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x"
KERNEL=="sd*[!0-9]",	ENV{ID_SERIAL}=="", \
	IMPORT="/sbin/scsi_id -g -x -a -s %p"
KERNEL=="sd*[!0-9]",	ENV{ID_SERIAL}=="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}"

KERNEL=="sd*[0-9]",	IMPORT{parent}="ID_*"
KERNEL=="sd*[0-9]",	ENV{ID_SERIAL}=="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"

# path
KERNEL=="*[!0-9]",	ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", \
	SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}"

KERNEL=="*[0-9]",	IMPORT{parent}="ID_*"
KERNEL=="*[0-9]",	ENV{ID_PATH}=="?*", \
	SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n"

# volume label and uuid
KERNEL=="*[!0-9]",	SYSFS{removable}=="1", GOTO="no_volume_id"
KERNEL=="*[0-9]",	IMPORT="/sbin/vol_id --export $tempnode"
KERNEL=="*[0-9]",	ENV{ID_FS_UUID}=="?*", \
	SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
KERNEL=="*[0-9]",	ENV{ID_FS_LABEL_SAFE}=="?*", \
	SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"

# end of processing
SUBSYSTEM=="block", LABEL="no_volume_id"


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: persistent.rules
  2005-08-05 18:55 persistent.rules Marco d'Itri
@ 2005-08-09 10:50 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2005-08-09 10:50 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Aug 05, 2005 at 08:55:04PM +0200, Marco d'Itri wrote:
> For the debian directory. I cleaned up the gentoo rules, it's not widely
> tested but looks like it's working fine.

Nice, I like the skip on ACTION!="add". :)
You may want to add:
  SUBSYSTEM="block", BUS="ide", SYSFS{removable}="1", GOTO="no_volume_id"

cause removable IDE devices causes hotplug events on open()/close(),
which gives a nice infinite loop.

Kay


> # This file contains the rules needed to create persistent device names.
> 
> # we are only interested in add actions for block devices
> ACTION!="add",		GOTO="no_volume_id"
> SUBSYSTEM!="block",	GOTO="no_volume_id"
> 
> # and we can safely ignore these kinds of devices
> KERNEL="ram*|loop*|fd*|sr*", GOTO="no_volume_id"
> 
> # skip removable ide devices, because the IDE drivers are horrible broken
> BUS="ide", SYSFS{removable}="1", GOTO="no_volume_id"
> 
> # disk id
> KERNEL="hd*[!0-9]",	IMPORT="/sbin/ata_id --export $tempnode"
> KERNEL="hd*[!0-9]",	ENV{ID_SERIAL}="?*", \
> 	SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
> 
> KERNEL="hd*[0-9]",	IMPORT{parent}="ID_*"
> KERNEL="hd*[0-9]",	ENV{ID_SERIAL}="?*", \
> 	SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
> 
> KERNEL="sd*[!0-9]",	SYSFS{ieee1394_id}="*", \
> 	IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'"
> KERNEL="sd*[!0-9]",	ENV{ID_SERIAL}="", IMPORT="/sbin/usb_id -x"
> KERNEL="sd*[!0-9]",	ENV{ID_SERIAL}="", \
> 	IMPORT="/sbin/scsi_id -g -x -a -s %p"
> KERNEL="sd*[!0-9]",	ENV{ID_SERIAL}="?*", \
> 	SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
> 
> KERNEL="sd*[0-9]",	IMPORT{parent}="ID_*"
> KERNEL="sd*[0-9]",	ENV{ID_SERIAL}="?*", \
> 	SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
> 
> # path
> KERNEL="*[!0-9]",	ENV{ID_TYPE}="?*", IMPORT="/sbin/path_id %p", \
> 	SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}"
> 
> KERNEL="*[0-9]",	IMPORT{parent}="ID_*"
> KERNEL="*[0-9]",	ENV{ID_PATH}="?*", \
> 	SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n"
> 
> # volume label and uuid
> KERNEL="*[!0-9]",	SYSFS{removable}="1", GOTO="no_volume_id"
> KERNEL="*[0-9]",	IMPORT="/sbin/vol_id --export $tempnode"
> KERNEL="*[0-9]",	ENV{ID_FS_UUID}="?*", \
> 	SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
> KERNEL="*[0-9]",	ENV{ID_FS_LABEL_SAFE}="?*", \
> 	SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"
> 
> # end of processing
> SUBSYSTEM="block", LABEL="no_volume_id"


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-09 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-05 18:55 persistent.rules Marco d'Itri
2005-08-09 10:50 ` persistent.rules Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).