From: Stamatis Mitrofanis <ewstam@softhome.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: Is there a bug in hotplug.functions w/ ${TYPE}.usermap?
Date: Sat, 29 Dec 2001 01:37:22 +0000 [thread overview]
Message-ID: <marc-linux-hotplug-100958996420476@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-100956841615955@msgid-missing>
Heath Elwayne Petersen wrote:
>I have been trying to use linux-hotplug to run a script when a device is
>recognized. However, I have been running into a problem. It seams that
>there may be an error in the hotplug.functions load_drivers function.
>...
>If this is the case, the error is that the find command does not return a
>false return code when it fails to find the file. Therefore, the modprobe will always
>be tried, and the following code, which attempts to execute
>/etc/hotplug/$TYPE/$MODULE will never be executed.
>
To be honest, I find that load_driver part of the code ugly alltogether.
More on that below...
>OUTPUT OF: diff hotplug.functions.orig hotplug.functions
>---- Cut Here ----
>128c128,129
>< elif find $MODULE_DIR -name $MODULE.o >/dev/null 2>&1 &&
>---
>
>> elif find $MODULE_DIR -name $MODULE.o 2>&1 \
>> | grep -q . >/dev/null 2>&1 &&
>>
>---- Cut Here ----
>
Firstly, that `find' line is checking that belongs in modprobe. It's
modprobe's job to see if a (abstract) "driver" is available. modprobe
has aliases, null/none drivers etc. so it's high-level.
If we're looking for a "module file" we sould be using insmod. The
_command_ insmod. Even if it's the same executable as modprobe, it has
different semantics.
load_modules is ugly because:
- code is not very unreadable (at least one error went unnoticed)
- it has many story-telling FIXMEs in it for very long (so, it may have
a bad architecture)
It's the agent's job to map requests to drivers and modutil's job to
load kernel modules. Using a load_driver function between these two is
bad because it complicates things.
Why is the requirement for either *modules or the function *_map_modules
from load_driver when the mapping can be done by the agent (possibly by
calling its helper program)? The agent can simply call modprobe which is
definitely high-level-enough. modprobe itself checks whether a driver is
already loaded.
For agents that don't map drivers or don't work with kernel drivers at
all (net, printer, xfree86) load_modules is of no use.
For driver-specific processing it is (much) better to use scripts as
/etc/hotplug/usb/xxx.agent . They should be called in place of (and not
in addition to) modprobe so that there can be greater flexibility. (the
agent script delegates to a driver script)
I am working with David Brownell for a series of patches that will ease
things in this area. I had already solved the problem by the time the
previous message was posted!
_______________________________________________
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
next prev parent reply other threads:[~2001-12-29 1:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-28 19:37 Is there a bug in hotplug.functions w/ ${TYPE}.usermap? Heath Elwayne Petersen
2001-12-29 1:37 ` Stamatis Mitrofanis [this message]
2001-12-29 4:38 ` Keith Owens
2001-12-29 18:23 ` David Brownell
2001-12-29 18:50 ` David Brownell
2001-12-30 3:22 ` Stamatis Mitrofanis
2001-12-30 7:49 ` David Brownell
2001-12-31 4:42 ` Stamatis Mitrofanis
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=marc-linux-hotplug-100958996420476@msgid-missing \
--to=ewstam@softhome.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.