内核参数module_param的有关操作
定义一个内核参数比较简单
module_param(参数变量名字,类型,访问权限)
MODULE_PARM_DESC(参数变量名字,“参数说明描述”)
如果需要限制或者检查用户输入的参数的值,比如说限制输入的整型数是 256~512的某个范围等等,输入的一定是某个特定字符串等。那么可以用这个宏。这个支持你传进去一个参数处理的回调函数。
module_param_call 2.6.35 以下
module_param_cb 2.6.38
这里我只针对module_param_cb 做一下说明,module_param_call 用法类似,看内核中的定义:
/**
* module_param_cb - general callback for a module/cmdline parameter
* @name: a valid C identifier which is the parameter name.
* @ops: the set & get operations for this parameter.
* @perm: visibility in sysfs.
*
* The ops can have NULL set or get functions.
*/
#define module_param_cb(name, ops, arg, perm) \
__module_param_call(MODULE_PARAM_PREFIX, \
name, ops, arg, __same_type((arg), bool *), perm)
1、name是