linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Unloading drivers, start-up, shut-down and a rewrite (a problem)
@ 2001-10-04  3:14 Stamatis Mitrofanis
  2001-10-04  4:29 ` Keith Owens
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Stamatis Mitrofanis @ 2001-10-04  3:14 UTC (permalink / raw)
  To: linux-hotplug

Keith Owens wrote:

>On Tue, 02 Oct 2001 03:00:00 +0100, 
>stamit <ewstam@softhome.net> wrote:
>
>>Now, the final thing that remains for unloading to be complete is 
>>reference counting. I tried to do it with bash (by storing counts in 
>>*.ref files in the driver directories) and guess what I stumbled to... a 
>>race condition! Multiple hotplug events can be processed by the scripts 
>>at the same time. So I took it back. Isn't there a way to use modutils 
>>programs to play with the module's real refrence counts? It would make 
>>things a whole lot easier (and safer).
>>
>
>Without knowing exactly what you are trying to do I am guessing but it
>sounds like you need this:
>
>* kernel/module.c registers /proc/sys/kernel/mod_use_count, mode 600.
>* module.c creates a dummy module entry called mod_use_count the first
>  time that /proc/sys/kernel/mod_use_count is written to.
>* /proc/sys/kernel/mod_use_count recognises commands like
>    up module-name
>    down module-name
>  and adjusts the use counts and reference chain accordingly.  Hotplug
>  scripts use mod_use_count to bump the reference count before allowing
>  a start event to continue and after completing a stop event.
>
>If the module does not exist (already unloaded) then write fails with
>some return code.  There is no specific code for "module does not
>exist" so pick something similar, like ESRCH or ENXIO.
>
I'm trying to implement module unloading in the hotplug scripts. Aside 
that, I'm also doing a rewrite, a slight redesign and "beautification" 
of the scripts generally because thay lacked such things as readability 
and uniformity. I'm trying to make them beautiful because, hey, vendors 
might choose to release drivers with scripts for our hotplug project!

So I'm making them pretty so they'll be attractive. :-)

Of course, because, besides making scripts and framework pretty, I'm 
also implementing the ability to unload modules, I needed to have a 
method to play with the modules' reference counts(which is the only 
thing still missing from my rewrite). And since you pointed me to the 
right way, I'll try to add it and post a patch when it's ready. I didn't 
really know about that because I'm not very into the kernel's internals. 
I'm doing mostly user-space stuff so far (thus my interest for the scripts).



_______________________________________________
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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2001-10-05 15:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-04  3:14 Unloading drivers, start-up, shut-down and a rewrite (a problem) Stamatis Mitrofanis
2001-10-04  4:29 ` Keith Owens
2001-10-05  0:03 ` Stamatis Mitrofanis
2001-10-05  5:58 ` Keith Owens
2001-10-05  6:25 ` David Hinds
2001-10-05  7:13 ` David Brownell
2001-10-05  7:21 ` David Brownell
2001-10-05  7:28 ` Keith Owens
2001-10-05  8:16 ` Oliver Neukum
2001-10-05  8:53 ` David Brownell
2001-10-05 15:26 ` David Hinds

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).