All of lore.kernel.org
 help / color / mirror / Atom feed
* specifying the order of calling kernel functions (or modules)
@ 2006-09-28 10:17 Seongsu Lee
  2006-09-28 15:47 ` Valdis.Kletnieks
  0 siblings, 1 reply; 7+ messages in thread
From: Seongsu Lee @ 2006-09-28 10:17 UTC (permalink / raw)
  To: linux-kernel

Hello,

I am a beginner of kernel module programming. I want to
specify the order of calling functions that I registered
by EXPORT_SYMBOL(). (or modules)

Thank you for your help.

-- 
Seongsu Lee - http://www.senux.com/
Buck-passing usually turns out to be a boomerang.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: specifying the order of calling kernel functions (or modules)
  2006-09-28 10:17 specifying the order of calling kernel functions (or modules) Seongsu Lee
@ 2006-09-28 15:47 ` Valdis.Kletnieks
  2006-09-30 10:42   ` Seongsu Lee
  0 siblings, 1 reply; 7+ messages in thread
From: Valdis.Kletnieks @ 2006-09-28 15:47 UTC (permalink / raw)
  To: Seongsu Lee; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 318 bytes --]

On Thu, 28 Sep 2006 19:17:24 +0900, Seongsu Lee said:
> I am a beginner of kernel module programming. I want to
> specify the order of calling functions that I registered
> by EXPORT_SYMBOL(). (or modules)

What problem did you expect to solve by specifying the order?  Phrased
differently, why does the order matter?

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: specifying the order of calling kernel functions (or modules)
  2006-09-28 15:47 ` Valdis.Kletnieks
@ 2006-09-30 10:42   ` Seongsu Lee
  2006-09-30 16:47     ` Randy Dunlap
  0 siblings, 1 reply; 7+ messages in thread
From: Seongsu Lee @ 2006-09-30 10:42 UTC (permalink / raw)
  To: linux-kernel

On Thu, Sep 28, 2006 at 11:47:02AM -0400, Valdis.Kletnieks@vt.edu wrote:
> On Thu, 28 Sep 2006 19:17:24 +0900, Seongsu Lee said:
> > I am a beginner of kernel module programming. I want to
> > specify the order of calling functions that I registered
> > by EXPORT_SYMBOL(). (or modules)
> 
> What problem did you expect to solve by specifying the order?  Phrased
> differently, why does the order matter?

I am playing with mtdconcat in MTD (Memory Technology Device).

For example:
  mtdconcat must be called after initializing the lower device and
  partitions. So, the order of calling functions must be decided
  always.

Actuall, the functions in Linux kernel are called in a order. I want
to know how to specify these orders.

Sorry for short English. Thank you for your help.

-- 
Seongsu Lee - http://www.senux.com/
"I don't think so," said Ren'\be Descartes. Just then,
he vanished.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: specifying the order of calling kernel functions (or modules)
  2006-09-30 10:42   ` Seongsu Lee
@ 2006-09-30 16:47     ` Randy Dunlap
  2006-10-07 14:41       ` Seongsu Lee
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2006-09-30 16:47 UTC (permalink / raw)
  To: Seongsu Lee; +Cc: linux-kernel

On Sat, 30 Sep 2006 19:42:05 +0900 Seongsu Lee wrote:

> On Thu, Sep 28, 2006 at 11:47:02AM -0400, Valdis.Kletnieks@vt.edu wrote:
> > On Thu, 28 Sep 2006 19:17:24 +0900, Seongsu Lee said:
> > > I am a beginner of kernel module programming. I want to
> > > specify the order of calling functions that I registered
> > > by EXPORT_SYMBOL(). (or modules)
> > 
> > What problem did you expect to solve by specifying the order?  Phrased
> > differently, why does the order matter?
> 
> I am playing with mtdconcat in MTD (Memory Technology Device).
> 
> For example:
>   mtdconcat must be called after initializing the lower device and
>   partitions. So, the order of calling functions must be decided
>   always.
> 
> Actuall, the functions in Linux kernel are called in a order. I want
> to know how to specify these orders.
> 
> Sorry for short English. Thank you for your help.

a.  linker order matters (order in Makefiles)

b.  initcall order matters.  See include/linux/init.h, especially
this part:

/* initcalls are now grouped by functionality into separate 
 * subsections. Ordering inside the subsections is determined
 * by link order. 
 * For backwards compatibility, initcall() puts the call in 
 * the device init subsection.
 */

#define __define_initcall(level,fn) \
	static initcall_t __initcall_##fn __attribute_used__ \
	__attribute__((__section__(".initcall" level ".init"))) = fn

#define core_initcall(fn)		__define_initcall("1",fn)
#define postcore_initcall(fn)		__define_initcall("2",fn)
#define arch_initcall(fn)		__define_initcall("3",fn)
#define subsys_initcall(fn)		__define_initcall("4",fn)
#define fs_initcall(fn)			__define_initcall("5",fn)
#define device_initcall(fn)		__define_initcall("6",fn)
#define late_initcall(fn)		__define_initcall("7",fn)


c.  "function call" order matters :)


---
~Randy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: specifying the order of calling kernel functions (or modules)
  2006-09-30 16:47     ` Randy Dunlap
@ 2006-10-07 14:41       ` Seongsu Lee
  2006-10-07 15:27         ` Randy Dunlap
  0 siblings, 1 reply; 7+ messages in thread
From: Seongsu Lee @ 2006-10-07 14:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: Randy Dunlap, Valdis.Kletnieks

Hello,

Thank you for the replys.

I try to phrase differently.

I made a simple kernel module that do 'hello world'. The module will be
called when I do 'modprobe' or 'insmod' to load it into the memory.

When is the function, init_module(), in the module called in the case 
the module is compiled as a built-in one? (Not M but Y in .config)
Can I specify the exact time of calling the function, init_module() in
the module?

-- 
Seongsu Lee - http://www.senux.com/
The nice thing about Windows is - It does not just
crash, it displays a dialog box and lets you press
'OK' first. (Arno Schaefer's .sig)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: specifying the order of calling kernel functions (or modules)
  2006-10-07 14:41       ` Seongsu Lee
@ 2006-10-07 15:27         ` Randy Dunlap
  2006-10-10 14:09           ` Seongsu Lee
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2006-10-07 15:27 UTC (permalink / raw)
  To: Seongsu Lee; +Cc: linux-kernel, Valdis.Kletnieks

On Sat, 7 Oct 2006 23:41:39 +0900 Seongsu Lee wrote:

> Hello,
> 
> Thank you for the replys.
> 
> I try to phrase differently.
> 
> I made a simple kernel module that do 'hello world'. The module will be
> called when I do 'modprobe' or 'insmod' to load it into the memory.
> 
> When is the function, init_module(), in the module called in the case 
> the module is compiled as a built-in one? (Not M but Y in .config)
> Can I specify the exact time of calling the function, init_module() in
> the module?

That depends on the order that it is listed in the (nested)
Makefiles.  Which sub-directory and Makefile will you use?

---
~Randy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: specifying the order of calling kernel functions (or modules)
  2006-10-07 15:27         ` Randy Dunlap
@ 2006-10-10 14:09           ` Seongsu Lee
  0 siblings, 0 replies; 7+ messages in thread
From: Seongsu Lee @ 2006-10-10 14:09 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: linux-kernel

On Sat, Oct 07, 2006 at 08:27:52AM -0700, Randy Dunlap wrote:
> On Sat, 7 Oct 2006 23:41:39 +0900 Seongsu Lee wrote:
> 
> > Hello,
> > 
> > Thank you for the replys.
> > 
> > I try to phrase differently.
> > 
> > I made a simple kernel module that do 'hello world'. The module will be
> > called when I do 'modprobe' or 'insmod' to load it into the memory.
> > 
> > When is the function, init_module(), in the module called in the case 
> > the module is compiled as a built-in one? (Not M but Y in .config)
> > Can I specify the exact time of calling the function, init_module() in
> > the module?
> 
> That depends on the order that it is listed in the (nested)
> Makefiles.  Which sub-directory and Makefile will you use?

drivers/mtd/Makefile

Yes, I confirmed that the order of being called is same with
the order that is listed in the Makefiles.

I think it is better to post questions of kernel newbie like this
into other mailing lists instead of this, developer list. 

Anyway, thank you very much for your help.

-- 
Seongsu Lee - http://www.senux.com/
Your job is being a professor and researcher: That's
one hell of a good excuse for some of the
brain-damages of minix. (Linus Torvalds to Andrew
Tanenbaum)





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-10-10 14:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-28 10:17 specifying the order of calling kernel functions (or modules) Seongsu Lee
2006-09-28 15:47 ` Valdis.Kletnieks
2006-09-30 10:42   ` Seongsu Lee
2006-09-30 16:47     ` Randy Dunlap
2006-10-07 14:41       ` Seongsu Lee
2006-10-07 15:27         ` Randy Dunlap
2006-10-10 14:09           ` Seongsu Lee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.