module_param
2015-12-18 11:09
531 查看
1、作用:向内核模块传递参数。
2、样式:
static char *name = "ff";
static int age=31;
module_param(age, int ,S_IRUGO);
module_param(name, charp ,S_IRUGO);
static int __init hello_init(void)
{
printk("Name:%s\n",name);
printk("Age:%d\n",age);
return 0;
}
static void __exit hello_exit(void)
{
printk("Module exit!\n");
}
3、module_param(name,type,perm);
name:传递参数的名称
type:传递参数数据类型
perm:参数访问权限
type类型: bool
: 布尔型 charp:
字符指针 short:
短整型 ushort : 无符号短整型 int : 整型 等
perm权限:
#defineS_IRUSR 00400 文件所有者可读
#defineS_IWUSR 00200 文件所有者可写
#defineS_IXUSR 00100 文件所有者可执行
#defineS_IRGRP 00040 与文件所有者同组的用户可读
#defineS_IWGRP 00020
#defineS_IXGRP 00010
#defineS_IROTH 00004 与文件所有者不同组的用户可读
#defineS_IWOTH 00002
#defineS_IXOTH 00001
2、样式:
static char *name = "ff";
static int age=31;
module_param(age, int ,S_IRUGO);
module_param(name, charp ,S_IRUGO);
static int __init hello_init(void)
{
printk("Name:%s\n",name);
printk("Age:%d\n",age);
return 0;
}
static void __exit hello_exit(void)
{
printk("Module exit!\n");
}
3、module_param(name,type,perm);
name:传递参数的名称
type:传递参数数据类型
perm:参数访问权限
type类型: bool
: 布尔型 charp:
字符指针 short:
短整型 ushort : 无符号短整型 int : 整型 等
perm权限:
#defineS_IRUSR 00400 文件所有者可读
#defineS_IWUSR 00200 文件所有者可写
#defineS_IXUSR 00100 文件所有者可执行
#defineS_IRGRP 00040 与文件所有者同组的用户可读
#defineS_IWGRP 00020
#defineS_IXGRP 00010
#defineS_IROTH 00004 与文件所有者不同组的用户可读
#defineS_IWOTH 00002
#defineS_IXOTH 00001
相关文章推荐
- Linux socket 初步
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- 基于 Linux 集群环境上 GPFS 的问题诊断
- 谁是桌面王者?Win PK Linux三大镇山之宝
- vivi下重新调整分区