linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Owens <kaos@ocs.com.au>
To: linux-hotplug@vger.kernel.org
Subject: Re: Unloading drivers, start-up, shut-down and some clean-ups (a problem)
Date: Wed, 03 Oct 2001 01:41:46 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-100207341232393@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-100206809619773@msgid-missing>

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.


_______________________________________________
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-03  1:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-02  2:00 Unloading drivers, start-up, shut-down and some clean-ups (a problem) stamit
2001-10-03  1:41 ` Keith Owens [this message]

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-100207341232393@msgid-missing \
    --to=kaos@ocs.com.au \
    --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).