From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stamatis Mitrofanis Date: Fri, 05 Oct 2001 00:03:19 +0000 Subject: Re: Unloading drivers, start-up, shut-down and a rewrite (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 > > >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