Linux V3.10 内核的变化…
来源:互联网 发布:三国志11 mac 10.12 编辑:程序博客网 时间:2024/05/16 01:30
把一个在3.8内核运行的内核模块源码放到3.10内核编译失败,编译显示在kernel 3.8 下调用的create_proc_entry() 函数未定义。总结一下这个内核模块源码在3.10与3.8编译通过的区别。
1.
1
static
inline
struct
proc_dir_entry*create_proc_entry(
const
char
*name,
2
umode_tmode,
struct
proc_dir_entry*parent)
3.8 内核有这个API,3.10 内核没有
3.10 可以使用:proc_create() 函数
1
static
inline
struct
proc_dir_entry*proc_create(
const
char
*name,umode_t mode,
2
struct
proc_dir_entry*parent,
3
const
struct
file_operations*proc_fops)
这个函数在 3.8与 3.10 内核都有。
比较可以看出 proc_create() 比create_proc_entry() 多了一个file_operations参数
调用create_proc_entry()代码:
1
ipf_stats = create_proc_entry(
"stats"
,0, proc_ipf);
2
if
(ipf_stats)
3
{
4
ipf_stats->proc_fops= &stats_file_ops;
5
}
使用proc_create() 代码:
1
ipf_stats = proc_create(
"stats"
,0, proc_ipf, &stats_file_ops);
2. struct
3.10内核去掉了:write_proc_t *write_proc函数指针。那么如何实现相同功能的写函数呢?答案是通过proc_create()最后一个参数。
1
static
struct
file_operationscmd_file_ops = {
2
.write= ipf_cmd_write,
3
};
1
ipf_cmd = proc_create(
"cmd"
,S_IFREG | S_IRUGO | S_IWUSR, proc_ipf,&cmd_file_ops);
ipf_cmd_write 是自定义的写函数,其内容可以自己实现。
0 0
- Linux V3.10 内核的变化…
- Linux:内核进程 (脑里面必有…
- Top 10 Linux console application…
- inotify -- Linux 2.6 内核中的文…
- [转]inotify -- Linux 2.6 内核中…
- googlemap API v3 - for my refere…
- Linux 内核剖析
- linux 内核大事记
- Linux 内核分析
- 解析 Linux 内核可装载模块的版本…
- Linux 内核的排队自旋锁(FIFO Tick…
- linux 多线程编程 ---- 信号量的使…
- Linux glibc 的 ma…
- linux-2.6.26.5内核的 lcd驱动移植…
- linux-2.6.26.5内核的 lcd驱动移植…
- Linux 系统内核的调试
- Linux 系统内核的调试
- 透过 Linux 内核看无锁编程
- Ubuntu 12.04搭建MTK 65…
- (转)上层APP调用底层硬件驱动过…
- adb 全部命令
- export 与export default区别
- Android开发之适配系统语言
- Linux V3.10 内核的变化…
- Android 系统默认参数的修改(一)
- HTML-表单标签
- Android 系统默认参数的修改(二)
- Android Camera sensor…
- Android操作系统11种传感器介绍
- Android指南针app的实现原理总结
- Ubuntu 12.04 打开开机…
- React组件化