Re: [RFC] Unifying kernel initialization

Paul Fulghum (paulkf@microgate.com)
Tue, 4 May 1999 13:42:48 -0600


----- Original Message -----
From: Martijn van Oosterhout <kleptog@cupid.suninternet.com>
To: linux kernel <linux-kernel@vger.rutgers.edu>
Sent: Tuesday, May 04, 1999 9:08 AM
Subject: [RFC] Unifying kernel initialization

> If it was built into the kernel, you'd have to
> add it to the mess in init/main.c or similar
> and add a call for it somewhere.

<SNIP>

> I was thinking that a better way to do it would be to have a
> macro REGISTER_INIT_FUNC(function,priority),
> which would add the nessesary info to the
> object file. Then, the kernel would need only
> to loop over this list and all the kernel would
> be initialized in order.

FreeBSD has macros like you describe for defining
init functions and calling order, so it is doable.
The macro creates entries in a global init table that is processed during
boot.

The thing I like this approach is that it keeps the definition in the
same source file as the implementation,. allowing you to add
a kernel function (device or otherwise) without necessarily
having to modify init/main.c.

On the other hand, it could be argued that explicitly adding
the init function call to init/main.c makes it easier to know what
is called and in what order. With the macro, you would have to
grep for all instances of the macro in all the kernel files and then
piece together the load order based on the macro arguments.
(or look at compiler listing files)

Paul Fulghum paulkf@microgate.com
Microgate Corporation www.microgate.com
9501 Capital of Texas Hwy
Austin, Texas 78759
(512)-345-7791

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/