lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20060930094731.2fe41e12.rdunlap@xenotime.net>
Date:	Sat, 30 Sep 2006 09:47:31 -0700
From:	Randy Dunlap <rdunlap@...otime.net>
To:	Seongsu Lee <senux@...ux.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: specifying the order of calling kernel functions (or modules)

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

> On Thu, Sep 28, 2006 at 11:47:02AM -0400, Valdis.Kletnieks@...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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ