linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stamatis Mitrofanis <ewstam@softhome.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: Unloading drivers, start-up, shut-down and a rewrite (a problem)
Date: Thu, 04 Oct 2001 03:14:08 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-100216891319132@msgid-missing> (raw)

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

             reply	other threads:[~2001-10-04  3:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-04  3:14 Stamatis Mitrofanis [this message]
2001-10-04  4:29 ` Unloading drivers, start-up, shut-down and a rewrite (a problem) 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

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