Bala, declaring the entry point as static and using the macro __init worked. The module's state didn't become 'permanent'.
Thanks, ~amit On Wed, Dec 10, 2008 at 3:05 PM, Balamurugan Subbian < [email protected]> wrote: > Even i faced the same problem. After analysis i found that > > It should not create problem in removing the mod as well if you are using > "init_module" function. > If you are using a different name for the startup function it should be > declared as static as: > > static int __init startup(void) > > module_init(startup) > > Probably if the function is not static the kernel loses its refernce to the > function and that > makes it permanent. > > --Bala > ------------------------------ > *From:* amit mehta <[email protected]> > *To:* Sandeep K Sinha <[email protected]> > *Cc:* Kernel Newbie <[email protected]> > *Sent:* Wednesday, 10 December, 2008 6:40:42 > *Subject:* Re: module state:permanent > > Thanks Sandeep, but still the question holds. > Why this module would become permanent ? > > ~amit > > On Wed, Dec 10, 2008 at 11:46 AM, Sandeep K Sinha <[email protected] > > wrote: > >> Ya that's right. >> >> On Wed, Dec 10, 2008 at 10:48 AM, amit mehta <[email protected]> wrote: >> > Hi All, >> > >> > Why would some module's state become permanent ? >> > i inserted one module and when i try to remove it, i get: >> > ERROR: Removing 'procsfs1': Device or resource busy >> > >> > <lsmod snip> >> > >> > Module Size Used by >> > procsfs1 3204 0 [permanent] <--------- >> > >> > <lsmod snip> >> > >> > The program code is here: >> > http://tldp.org/LDP/lkmpg/2.6/html/x710.html >> > >> > rmmod help shows: >> > r...@venus:/home/amit/# rmmod --h >> > Usage: rmmod [-fhswvV] modulename ... >> > -f (or --force) forces a module unload, and may crash your >> > machine. This requires the Forced Module Removal option >> > when the kernel was compiled. >> > >> > i looked into the .config file under /usr/src/linux >> > and this seem to be the reason for even the --force option in rmmod not >> > working: >> > # CONFIG_MODULE_FORCE_UNLOAD is not set >> > >> > >> You have to set that flag to enable forced unmount. >> >> >> >> > ~amit >> > >> > -- >> > "Everyone has a photographic memory. Some people just don't have film." >> > >> > — Mel Brooks >> > >> >> >> >> -- >> Regards, >> Sandeep. >> >> >> >> >> >> >> "To learn is to change. Education is a process that changes the learner." >> > > > > -- > "Everyone has a photographic memory. Some people just don't have film." > > — Mel Brooks > > -- "Everyone has a photographic memory. Some people just don't have film." — Mel Brooks
