From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Owens Date: Wed, 03 Oct 2001 01:41:46 +0000 Subject: Re: Unloading drivers, start-up, shut-down and some clean-ups (a problem) Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Tue, 02 Oct 2001 03:00:00 +0100, stamit 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