linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: replace dev.d/ with a rule based program execution
Date: Sat, 26 Feb 2005 00:28:09 +0000	[thread overview]
Message-ID: <1109377689.7242.149.camel@localhost.localdomain> (raw)
In-Reply-To: <20050221181242.GA22891@vrfy.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="<value>" 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="<usb-serial-device program>"
>>   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_id\x14396&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

  parent reply	other threads:[~2005-02-26  0:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-21 18:12 replace dev.d/ with a rule based program execution Kay Sievers
2005-02-22  8:08 ` Hannes Reinecke
2005-02-22 17:53 ` Harald Hoyer
2005-02-23  1:08 ` Marco d'Itri
2005-02-24 20:15 ` David Zeuthen
2005-02-24 20:34 ` Kay Sievers
2005-02-24 20:45 ` David Zeuthen
2005-02-24 21:04 ` Kay Sievers
2005-02-24 21:52 ` Kay Sievers
2005-02-24 22:03 ` David Zeuthen
2005-02-25 23:26 ` Greg KH
2005-02-26  0:28 ` Kay Sievers [this message]
2005-02-26  0:57 ` Marco d'Itri
2005-02-26  1:04 ` Kay Sievers
2005-02-26  1:06 ` Marco d'Itri
2005-02-26  2:22 ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1109377689.7242.149.camel@localhost.localdomain \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).