Skip to contentSkip to conversation

Udev 100: Inconsistency in 60-persistent-storage.rules?

DISCUSSION Alexander E. Patrakov 2 participants 2 messages Sep 22, 2006

lore
Share & tools
lore
#0 lore raw

Hello,

the 60-persistent-storage.rules file contains the following rules:

# never access non-cdrom removable ide devices, the drivers are causing 
event loops on open()
KERNEL="hd*[!0-9]", ATTRS{removable}="1", 
DRIVERS="ide-cs|ide-floppy", GOTO="persistent_storage_end"
KERNEL="hd*[0-9]", ATTRS{removable}="1", GOTO="persistent_storage_end"

# <snip>

# by-label/by-uuid (filesystem properties)
KERNEL="*[!0-9]", ATTR{removable}="1", GOTO="persistent_storage_end"

# <snip>

LABEL="persistent_storage_end"

What's the reason for the ATTRS vs ATTR difference? Where exactly does the "removable" attribute live in sysfs?

Signature · 11 lines
Alexander E. Patrakov

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw
Quoted 15 lines · Alexander E. Patrakov

Hello,

the 60-persistent-storage.rules file contains the following rules:

# never access non-cdrom removable ide devices, the drivers are causing 
event loops on open()
KERNEL="hd*[!0-9]", ATTRS{removable}="1", 
DRIVERS="ide-cs|ide-floppy", GOTO="persistent_storage_end"
KERNEL="hd*[0-9]", ATTRS{removable}="1", GOTO="persistent_storage_end"

# <snip>

# by-label/by-uuid (filesystem properties)
KERNEL="*[!0-9]", ATTR{removable}="1", GOTO="persistent_storage_end"
Quoted 6 lines

# <snip>

LABEL="persistent_storage_end"

What's the reason for the ATTRS vs ATTR difference? Where exactly does the "removable" attribute live in sysfs?

The "removable" attribute is a disk, not a partition attribute.

ATTR matches only on the device we receive the event for, ATTRS searches up the chain of parents for a match. ATTRS, like all other *S keys is usually more expensive, cause we may need to walk up the parent devices to see that nothing matches.

KERNEL="*[!0-9]", ATTR{removable}="1" matches only the disk device here, where the attribute is expected.

KERNEL="hd*[0-9]", ATTRS{removable}="1" will find the "removable" attribute of the disk, which is the parent of the partition we match on with KERNEL.

KERNEL="hd*[!0-9]", ATTRS{removable}="1" could be ATTR I think, cause it will not run for a partition anyway cause of the KERNEL match.

Kay

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel