Skip to contentSkip to conversation

add an option for rules to be run after a device is created

DISCUSSION Stefanos Harhalakis 2 participants 3 messages Jan 4, 2006

lore
Share & tools
lore
#0 lore raw

Hi there,

I'm using udev and I'd like to make a suggestion. I have these rules:

BUS="ide", KERNEL="*[!0-9]", PROGRAM="/etc/udev/scripts/get_serial %k", RESULT="WD-WMAEH1157379", SYMLINK="disk/root"
BUS="ide", KERNEL="*[0-9]", PROGRAM="/etc/udev/scripts/get_serial %k", RESULT="WD-WMAEH1157379", SYMLINK="disk/root%n"

which call a script that return the hard disk serial number using hdparm. I'm using this rule to find the root disk and enable its swap partition without knowing the device name.

The problem is that the get_serial script is run before (for
example) /dev/hda is created and hdparm cannot find the device (/dev is a tmpfs). This can be solved by running udevstart twice but I believe that there can be a better solution.

I suggest you add an option that would mark rules to be examined *after* the
device is created. This can be thought as a class of 'second pass' rules. Another solution is to delay the symlink rules but this may produce incompatibilities or other problems.

I'm using udev 0.79, kernel 2.6.15.

Thanks in advace,

<<V13>>

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
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 9 lines · Stefanos Harhalakis

Hi there,

I'm using udev and I'd like to make a suggestion. I have these rules:

BUS="ide", KERNEL="*[!0-9]", PROGRAM="/etc/udev/scripts/get_serial %k", RESULT="WD-WMAEH1157379", SYMLINK="disk/root"
BUS="ide", KERNEL="*[0-9]", PROGRAM="/etc/udev/scripts/get_serial %k", RESULT="WD-WMAEH1157379", SYMLINK="disk/root%n"

Quoted 8 lines

which call a script that return the hard disk serial number using hdparm. I'm using this rule to find the root disk and enable its swap partition without knowing the device name.

The problem is that the get_serial script is run before (for
example) /dev/hda is created and hdparm cannot find the device (/dev is a tmpfs). This can be solved by running udevstart twice but I believe that there can be a better solution.

Use the persistent disk links in /dev/disk/, they will just work.

Kay

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Stefanos Harhalakis
Quoted 14 lines · Kay Sievers
Quoted 13 lines · Stefanos Harhalakis

Hi there,

I'm using udev and I'd like to make a suggestion. I have these rules:

BUS="ide", KERNEL="*[!0-9]", PROGRAM="/etc/udev/scripts/get_serial %k", RESULT="WD-WMAEH1157379", SYMLINK="disk/root"
BUS="ide", KERNEL="*[0-9]", PROGRAM="/etc/udev/scripts/get_serial %k", RESULT="WD-WMAEH1157379", SYMLINK="disk/root%n"

which call a script that return the hard disk serial number using hdparm. I'm using this rule to find the root disk and enable its swap partition without knowing the device name.

Quoted 6 lines
Quoted 4 lines

The problem is that the get_serial script is run before (for
example) /dev/hda is created and hdparm cannot find the device (/dev is a tmpfs). This can be solved by running udevstart twice but I believe that there can be a better solution.

Use the persistent disk links in /dev/disk/, they will just work.

I'm sorry about this. It seems that all I wanted was the %N ($tempnode), which I just found because of your reply.

Thanks a lot for your time!

<<V13>>

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel