Re: [LIP] kernel programming

Amit Kucheria <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
Please set your mailer to word wrap at 72 characters.

On Tue, 18 Nov 2003, suresh kumar wrote:

> Hi 
> I have the following queries. Kindly help me out.
> 
> 1)What is the difference among, module_init, init_module, __init,
> __init_data and their corresponding deinit function? How do we select
> what should be used?

__init tells the kernel that this memory can be freed after 
initialization. For description on module_init(), try reading Alessandro 
Rubini's "Linux Device drivers". It available online at www.xml.com

> 2)(I have used MODULE_PARAM macro to pass some arguments while insmod
> a module.  The program looks some thing like this. Kindly tell me
> where I have gone wrong. /* hello-5.c - Demonstrates command line
> argument passing to a module. */ #define __KERNEL__ #define MODULE
> #include <linux/module.h> #include <linux/kernel.h> #include
> <linux/init.h>
> 
> 
> static short int myshort = 1;
> MODULE_PARM (myshort, "h");
> static int __init hello_5_init(void)
> {
> 	printk("this is junk`");
> 	
> printk("Hello, world 5\n=============\n");
> printk("myshort is a short integer: %hd\n", myshort);
> return 0;
> }
> module_init(hello_5_init);
> module_deinit(hello_5_init);
> 
> insmod <name> <values>

What does it output? I don't want to have to cut paste, make your module 
to find out the output.

> 3)Proc is the image of the kernel which can be used to configure
> kernel at runtime. I want to do the same with the module that I write.
> kindly tell how this has to be done. It is known that it can be done
> using ioctls. For a bigger module, which has more configuration, which
> is advised, a)configuration through proc b) through CLI using ioctls.
> I mean the tradeoff in terms of flexibility, complexity, efficiency
> etc...

You seriously need to read the above book.
 
> 4)How do we set the IP address to the interface permanenly using
> ifconfig in redhat 9.0. Previous versions, I used to disable and set
> the interface and enable it.I remember it working.  Does it vary from
> distribution to distribution? I can not use setup or any thing else.

/etc/sysconfig/network-scripts/ifcfg-eth0
 
> 5) Ne one tell me good material to read for tasklets programming and
> kernel scheduling.

above book.

-- 
I'm an angel!!! Honest!
The horns are just there to hold the halo up straight.
-----------------------------------------------------
Amit Kucheria             | amitk@ NOSPAM ittc.ku.edu
Wireless Systems Engineer | 760-822-8529
Metric Systems Corp.      | Vista, CA 92083
-----------------------------------------------------



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.