From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Sat, 26 Feb 2005 00:28:09 +0000 Subject: Re: replace dev.d/ with a rule based program execution Message-Id: <1109377689.7242.149.camel@localhost.localdomain> List-Id: References: <20050221181242.GA22891@vrfy.org> In-Reply-To: <20050221181242.GA22891@vrfy.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Fri, 2005-02-25 at 15:26 -0800, Greg KH wrote: >On Mon, Feb 21, 2005 at 07:12:42PM +0100, Kay Sievers wrote: >> Here is an experimental patch to replace the brute-force dev.d/ script >> execution by a rule based model, with the same logic we currently use to >> name a device. While searching for a rule to apply, we collect programs >> to execute after node creation/removal. >> >> This makes it possible to gain complete control of the execution of programs >> for a specific device instead of letting the programs exit if they don't >> want to handle the device. >> >> We apply the rule on device remove events too. A ACTION="" match can >> be used to write rules that are only applied on a specific action. >> >> I've replaced the following: >> [kay@pim ~]$ tree /etc/dev.d/ >> /etc/dev.d/ >> |-- default >> | |-- 00-log.dev >> | |-- 05-pam_console.dev -> ../../udev/scripts/pam_console.dev >> | `-- 10-hal.dev -> /usr/libexec/hal.dev >> |-- fd0 >> | `-- 10-MAKEDEV.dev -> ../../udev/scripts/MAKEDEV.dev >> |-- fd1 >> | `-- 10-MAKEDEV.dev -> ../../udev/scripts/MAKEDEV.dev >> |-- fd2 >> | `-- 10-MAKEDEV.dev -> ../../udev/scripts/MAKEDEV.dev >> |-- fd3 >> | `-- 10-MAKEDEV.dev -> ../../udev/scripts/MAKEDEV.dev >> `-- sound >> `-- alsa.dev >> >> With these rules: >> KERNEL="ttyUSB*", HOTPLUG="" >> SUBSYSTEM="tty", OPTIONS="no_hotplug" >> SUBSYSTEM="vc", OPTIONS="no_hotplug" >> >> ACTION="add", SUBSYSTEM="sound", HOTPLUG="/etc/dev.d/sound/alsa.dev" >> ACTION="add", KERNEL="fd*", HOTPLUG="/etc/udev/scripts/MAKEDEV.dev" >> ACTION="add", HOTPLUG="/etc/udev/scripts/pam_console.dev" >> >> HOTPLUG="/usr/libexec/hal.dev" >> HOTPLUG="/etc/dev.d/default/00-log.dev" >> >> On my box, udevstart takes 2.1 seconds instead of 8.6 seconds to run with >> my default setup. Mainly because it will not run anything for all the virtual >> tty devices. Any tty device which should be catched, needs a rule before the >> "no_hotplug" option. >> >> It is also possible to pass arguments to the scripts, which sometimes >> makes it no longer necessary to wrap a program with a shell script. > >I like the general idea, but we can't break the /etc/dev.d/ functionalty >so much. > >If we just add a udev option (like you show above) for "no_dev.d", we >could still have the massive udevstart speedups, right? So this is ok >with me. We should plug that in with a external program called by a rule. >Remember, it's easier for a package to drop a symlink into the >/etc/dev.d/ directory tree, than it is for it to modify / add a udev >rule. Packages should drop a single rules file instead. >> We could also remove all the hardcoded knowledge about sysfs in the >> wait_for_sysfs logic and replace it by a few simple ignore_device rules. > >How would that happen? We match against the SUBSYSTEM and KERNEL and request a specific sysfs value, which will wait until it appears. That is generic, nice, configurable, elegant and users can tweak it for their needs. >> The same model could easily replace the whole hotplug.d/ multiplexing and >> give use an efficient rule based event management with a single source of >> policy. > >See my previous response as to why we can't do this. Just let the users decide. We would ship a backwards compatible default setup, but the user can remove the multiplex emulation rule and has a nice, clean rule-based solution without all that crap compiled in. Thanks, Kay ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ 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