is there any way to pass array of strings to kernel-module? I would like to pass it like this:
insmod mod.ko array="string1","string2","string3"
There is my code but it is not compiling:
#include<linux/module.h>
#include<linux/moduleparam.h>
static int number_of_elements = 0;
static char array[5][10];
module_param_array(array,charp,&number_of_elements,0644);
static int __init mod_init(void)
{
int i;
for(i=0; i<number_of_elements;i++)
{
pr_notice("%s\n",array[i]);
}
return 0;
}
static void __exit mod_exit(void)
{
pr_notice("End\n");
}
module_init(mod_init);
module_exit(mod_exit);
MODULE_AUTHOR("...");
MODULE_LICENSE("GPL");
MODULE_VERSION("1.0");
insmod mod.ko array="string1,string2,string3"and split the string in your module codechar *:static char *array[5];.