From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Alexander E. Patrakov" Date: Wed, 02 Aug 2006 12:54:08 +0000 Subject: Re: udev - that famouse obsolete %e option Message-Id: <44D0A070.2000807@ums.usu.ru> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org VMiklos wrote: > 2006/8/1, Kay Sievers : >> If you want to work on this, please start with one of the several >> solutions to name optical drives persistently by writing udev rules. I'm >> sure at some point we will include one of them in the udev tree. >=20 > here cames my first try: >=20 > http://frugalware.org/~vmiklos/patches/udev-096-optical_gen.diff >=20 > comments? :) (I have not fully read that, but can still identify missing pieces) The interaction with the boot scripts must be documented. The problem is that udev rules that are needed to generate cdrom rules are triggered when the root filesystem is read-only, and thus the generated rules cannot be saved without additional efforts. Debian works around this by saving the generated rules to /dev/shm and copying them to /etc/udev/rules.d in a separate bootscript. LFS in the past (until the Debian-based generator was completely dropped due to cries of some people about too much automation, and because of mails like http://archives.linuxfromscratch.org/mail-archives/lfs-dev/2006-May/057166.= html)=20 did the following: # /etc/udev/rules.d/81-cdrom.rules: Set CD-ROM permissions and get device capabilities ACTION=3D"add", SUBSYSTEM=3D"block", ENV{ID_TYPE}=3D"cd", IMPORT{program}=3D"cdrom_id --export $tempnode", GROUP=3D"cdrom" # /etc/udev/rules.d/82-persistent-cd.rules: generated file ACTION=3D"add", SUBSYSTEM=3D"block", BUS=3D"ide", ID=3D"0.1", ENV{ID_CDROM}=3D"1", SYMLINK+=3D"cdrom", ENV{GENERATED}=3D"1" # /etc/udev/rules.d/83-cdrom-symlinks.rules: Determine CD drive capability. ACTION!=3D"add", GOTO=3D"cd_aliases_generator_end" SUBSYSTEM!=3D"block", GOTO=3D"cd_aliases_generator_end" ENV{GENERATED}=3D"?*", GOTO=3D"cd_aliases_generator_end" # Fail the uevent if the autogenerated rules cannot be saved ENV{ID_CDROM}=3D"?*", PROGRAM=3D"/bin/grep -c ' / [^[:space:]]* rw' /proc/mounts", RESULT!=3D"2", RUN+=3D"/bin/false", GOTO=3D"cd_aliases_generator_end" ENV{ID_CDROM}=3D"?*", PROGRAM=3D"write_cd_aliases", SYMLINK+=3D"%c" LABEL=3D"cd_aliases_generator_end" The idea is that the rule with grep fails the entire uevent when the root filesystem is read-only. Udev will then add a symlink to the relevant directory in sysfs to /dev/.udev/failed, and a separate bootscript will retrigger all failed uevents again after mounting all filesystems. --=20 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=3Djoin.php&p=3Dsourceforge&CID=DEVD= EV _______________________________________________ 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