[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: module_param
On 9/4/05, raja <vnagaraju@xxxxxxxxxxxx> wrote:
> Hi,
> I am trying to get the module parameters from command line.
> I want to get the integer array.I am doing ot with the following code
>
>
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/moduleparam.h>
>
> MODULE_LICENSE("GPL");
> MODULE_DESCRIPTION("COMMAND LINE PARAMETERS");
>
> static int __init module_init2(void);
> static void __exit module_exit2(void);
>
> static int __init module_init2()
> {
> static int num;
> printk("Hello World!\n");
> module_param(num,int,0);
> int array[2];
> int i;
> module_param_array(array,int,num,0);
> for(i=0;i<2;i++)
> printk("Values Are : %d %d\n",array[0],array[1]);
> return 0;
First of all, you're mixing variable declarations and code, please
don't do that.
Second, module_param() declarations do not occur in the init function.
Please examine the current kernel code's usage of
module_param{,_array}().
Thanks,
Nish
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/