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: Fri, 05 Oct 2001 00:03:19 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-100224386105892@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-100216891319132@msgid-missing>

>
>
>More details please.  Why do you need to externally adjust a module's
>use count?  All other modules handle their use counts internally, what
>is different about hotplug?
>
>I will do the patch to kernel/module.c, once I understand exactly what
>the requirements are.
>
It's when you have many hotpluggable devices of the same type (handled 
by the same driver). Managing a reference (device) count for each driver 
from the hotpug scripts is necessary for unloading the driver _only_ 
after the last such device is unplugged.

It might be a bad idea to play with the modules' real reference counts 
though, but there must be at least some form of mutual exclusion for 
accessing this driver-specific device count. Therefore, it was wrong for 
me to try to implement this device count by making the scripts 
read/write"*.ref" files in the hotplug directory (possible race 
condition which would mess up the count).

If it should be implemented in the kernel then the functionality should 
be exposed through modprobe. I'm sorry, but I have no idea about the 
actual details of (un)loading modules so you'll have to do everything 
behind modprobe.

The requirement is just that modprobe gets a new command-line paremeter 
which, when given in a call to load/unload a module, will also 
increment/decrement the module's reference count. I.e. if  the parameter 
is "--ref" and the module ABC is not loaded, then the following should 
result in module ABC being in memory with a reference count of 1:
# modprobe --ref ABC
# modprobe --ref ABC
# modprobe --ref -r ABC
The first command will load the module and set its reference count to 1. 
The second command will increment the ABC's reference count to 2 and the 
third should decrement the reference count to 1 without, of course, 
unloading the module.



_______________________________________________
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:[~2001-10-05  0:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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-100224386105892@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).