[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __init question



On Sun, 4 Mar 2001, Peter Jay Salzman wrote:

> dear all,
> 
> i was going to ask what __init does, but i found the answer on this list's
> archives.   btw, the archives are /fantastic/.  any chance of making them
> searchable?

I suppose we should talk to the aims group about this one !

> 
> anyway, there was a thread on the subject, and i'd like to ask a question
> about some of the thread replies.
> 
> what exactly is the difference between __initfunc(int myfunc(void)) and
> __init int myfunc(void)?

AFAIK, the first one is simply the old-style way of declaring it. Always use
the second. Actually, you should use this :

int __init myfunc(void)

though I'm not sure it matters for 2.4 now gcc 2.7.2.3 won't compile it.

> lastly, in the example code on the kernelnewbies website, i notice the
> lines:
> 
> module_init(init_mmaptest);
> module_exit(cleanup_mmaptest);
> 
> of course, there are definitions for the functions init_mmaptest and
> cleanup_mmaptest.  is this replacing the standard "modules begin with
> init_module and exit with cleanup module"?

yes, this is the "modern" way.

> 
> if we want to retain compatibility with 2.2 and 2.0, should i stick with
> init_module/cleanup_module?
> 

not sure, do you really have a pressing need for v2.0 ? It's now two whole
stable major revisions behind :)

john


> thanks!
> 
> pete
> 
> ps- the website/list is really great.  with resources like these, linux is
> sure to have an army of module writers who'll be able to write drivers
> faster than companies can put out hardware.   ;)
> 

-- 
"History is the slaughter-bench at which the happiness of peoples, the
 wisdom of states and the virtue of individuals have been sacrificed."
	- Hegel

-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.surriel.com/kernelnewbies.shtml