From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hannes Reinecke Date: Tue, 22 Feb 2005 08:08:40 +0000 Subject: Re: replace dev.d/ with a rule based program execution Message-Id: <421AE888.5060702@suse.de> List-Id: References: <20050221181242.GA22891@vrfy.org> In-Reply-To: <20050221181242.GA22891@vrfy.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org 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. >=20 > This makes it possible to gain complete control of the execution of progr= ams > for a specific device instead of letting the programs exit if they don't > want to handle the device. >=20 > We apply the rule on device remove events too. A ACTION=3D"" match= can > be used to write rules that are only applied on a specific action. >=20 > 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 >=20 > With these rules: > KERNEL=3D"ttyUSB*", HOTPLUG=3D"" > SUBSYSTEM=3D"tty", OPTIONS=3D"no_hotplug" > SUBSYSTEM=3D"vc", OPTIONS=3D"no_hotplug" >=20 > ACTION=3D"add", SUBSYSTEM=3D"sound", HOTPLUG=3D"/etc/dev.d/sound/alsa.d= ev" > ACTION=3D"add", KERNEL=3D"fd*", HOTPLUG=3D"/etc/udev/scripts/MAKEDEV.de= v" > ACTION=3D"add", HOTPLUG=3D"/etc/udev/scripts/pam_console.dev" >=20 > HOTPLUG=3D"/usr/libexec/hal.dev" > HOTPLUG=3D"/etc/dev.d/default/00-log.dev" >=20 > 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 vir= tual > tty devices. Any tty device which should be catched, needs a rule before = the > "no_hotplug" option. >=20 > 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. >=20 > 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. >=20 > 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. >=20 > What do you think? >=20 YES. This is a Good Thing (tm). Go for it. Otherwise udevstart performance is basically killed by tty events. And vc events, but this is another story. Too sad we've already entered feature freeze ... Cheers, Hannes --=20 Dr. Hannes Reinecke hare@suse.de SuSE Linux AG S390 & zSeries Maxfeldstra=DFe 5 +49 911 74053 688 90409 N=FCrnberg http://www.suse.de ------------------------------------------------------- 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_id=14396&op=CCk _______________________________________________ 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