All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* Re: initialisation code
  2001-03-21 16:30 initialisation code Manoj Sontakke
@ 2001-03-21 11:37 ` Keith Owens
  2001-03-22  9:29   ` Manoj Sontakke
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Owens @ 2001-03-21 11:37 UTC (permalink / raw
  To: Manoj Sontakke; +Cc: linux-kernel

On Wed, 21 Mar 2001 22:00:51 +0530 (IST), 
Manoj Sontakke <manojs@sasken.com> wrote:
>	I have a initlisation function (just like pktsched_init in
>TC). Can anyone tell me, where in the kernel boot sequence should I make a
>call to my initialisation function.

Welcome to the wonderful world of magic initialisation.

(1) Declare your initialisation function as int __init foo_init(void).

(2) Decide when your function needs to be called, e.g. after initialisers
    for A, B, C but before initialisers for X, Y, Z.

(3) Edit the Makefile to insert obj-$(CONFIG_FOO) after the objects
    that contain initialisers A, B, C and before the objects for
    initialisers X, Y, Z.

(4) Document why the order of this routine is required!  Without docs
    in the Makefile we have no idea if object order is correct or not.


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

* initialisation code
@ 2001-03-21 16:30 Manoj Sontakke
  2001-03-21 11:37 ` Keith Owens
  0 siblings, 1 reply; 4+ messages in thread
From: Manoj Sontakke @ 2001-03-21 16:30 UTC (permalink / raw
  To: linux-kernel

Hi
	I am trying to implement some QoS in kernel(in the IP
layer....similar to TC..... BTW  TC works in the data-link layer). I am
dequeuing the packets from the IP queue when the function ip_forward is
called. After processing them, I am reinserting them back to the IP queue.
	I have a initlisation function (just like pktsched_init in
TC). Can anyone tell me, where in the kernel boot sequence should I make a
call to my initialisation function.

Thanks in advance for all the help. 

Manoj


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

* Re: initialisation code
  2001-03-22  9:29   ` Manoj Sontakke
@ 2001-03-22  4:27     ` Keith Owens
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Owens @ 2001-03-22  4:27 UTC (permalink / raw
  To: Manoj Sontakke; +Cc: linux-kernel

On Thu, 22 Mar 2001 14:59:31 +0530 (IST), 
Manoj Sontakke <manojs@sasken.com> wrote:
>On Wed, 21 Mar 2001, Keith Owens wrote:
>> Welcome to the wonderful world of magic initialisation.
>> 
>> (1) Declare your initialisation function as int __init foo_init(void).
>> (2) Decide when your function needs to be called, e.g. after initialisers
>>     for A, B, C but before initialisers for X, Y, Z.
>
>where do i find this ABC abs XYZ ?

You coded it, you know what kernel facilities must be initialised
before your program (ABC) and what kernel code cannot be initialised
until after your program (XYZ).

>What if I have to make it as an insertable/removable module?

static int __init foo_init(void) {
  ...
}

module_init(foo_init);

Automatically generates the correct code for a built in object and for
a module.  See include/linux/init.h and almost any drivers/net/*.c,
plip.c is a good example.

>> 
>> (3) Edit the Makefile to insert obj-$(CONFIG_FOO) after the objects
>>     that contain initialisers A, B, C and before the objects for
>>     initialisers X, Y, Z.
>
>Do I need to edit the .config file to add CONFIG_FOO=y ?

Do not edit .config, it is generated.  Edit a [Cc]onfig.in file, read
Documentation/kbuild/config-language.txt and look at the [Cc]onfig.in
file in the directory where you are putting your source.  Do not forget
to update Documentation/Configure.help.


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

* Re: initialisation code
  2001-03-21 11:37 ` Keith Owens
@ 2001-03-22  9:29   ` Manoj Sontakke
  2001-03-22  4:27     ` Keith Owens
  0 siblings, 1 reply; 4+ messages in thread
From: Manoj Sontakke @ 2001-03-22  9:29 UTC (permalink / raw
  To: Keith Owens; +Cc: linux-kernel

Hi
	Thanks for all the help.

On Wed, 21 Mar 2001, Keith Owens wrote:

> On Wed, 21 Mar 2001 22:00:51 +0530 (IST), 
> Manoj Sontakke <manojs@sasken.com> wrote:
> >	I have a initlisation function (just like pktsched_init in
> >TC). Can anyone tell me, where in the kernel boot sequence should I make a
> >call to my initialisation function.
> 
> Welcome to the wonderful world of magic initialisation.
> 
> (1) Declare your initialisation function as int __init foo_init(void).
> 
> (2) Decide when your function needs to be called, e.g. after initialisers
>     for A, B, C but before initialisers for X, Y, Z.

where do i find this ABC abs XYZ ?
What if I have to make it as an insertable/removable module?

> 
> (3) Edit the Makefile to insert obj-$(CONFIG_FOO) after the objects
>     that contain initialisers A, B, C and before the objects for
>     initialisers X, Y, Z.

Do I need to edit the .config file to add CONFIG_FOO=y ?

> 
> (4) Document why the order of this routine is required!  Without docs
>     in the Makefile we have no idea if object order is correct or not.
> 
of course

manojs


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

end of thread, other threads:[~2001-03-22  4:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-21 16:30 initialisation code Manoj Sontakke
2001-03-21 11:37 ` Keith Owens
2001-03-22  9:29   ` Manoj Sontakke
2001-03-22  4:27     ` Keith Owens

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.