传递一个数组作为命令行参数Linux内核模块 [英] Passing an array as command line argument for linux kernel module
本文介绍了传递一个数组作为命令行参数Linux内核模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想数组数据传递给Linux内核模块。
在内核:
int类型的[5];
诠释计数;
module_param_array(A,INT和放大器;计数,0);
但我不知道如何从命令行传递值。如果它是一个变量只是我会用:
insmod的k1.ko A = 10
解决方案
您可以通过
传递数组 insmod的k1.ko A = 10,20,30,40
看<一个href=\"http://www.linuxtopia.org/online_books/linux_kernel/linux_kernel_module_programming_2.6/x323.html\">Linux内核模块编程了解详细信息和示例。
I would like to pass an array of data to the Linux kernel module.
In the kernel:
int a[5];
int count;
module_param_array(a, int, &count, 0);
But I've no idea how to pass values from the command line. If it is a just variable I will use:
insmod k1.ko a=10
解决方案
You can pass arrays via
insmod k1.ko a=10,20,30,40
see Linux Kernel Module Programming for more information and examples.
这篇关于传递一个数组作为命令行参数Linux内核模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文