摘要: 一、定义: struct file结构体定义在/linux/include/linux/fs.h(Linux 2.6.11内核)中,其原型是: 721struct file { 722 /* 723 * fu_list becomes invalid after file_free is called and queued via 724 * fu_rcuhead for RCU freeing... 阅读全文
posted @ 2011-01-09 20:30 羽落无声 阅读(918) 评论(0) 推荐(0) 编辑
摘要: struct file结构体定义在/linux/include/linux/fs.h(Linux 2.6.11内核)中,其原型是:struct file { /* * fu_list becomes invalid after file_free is called and queued via * fu_rcuhead for RCU freeing */ union { struct list... 阅读全文
posted @ 2011-01-09 20:29 羽落无声 阅读(502) 评论(0) 推荐(0) 编辑
摘要: 在Linux2.6内核中一个字符设备用cdev结构来描述,其定义如下:struct cdev { struct kobject kobj; struct module *owner; //所属模块 const struct file_operations *ops; //文件操作结构,在写驱动时,其结构体内的大部分函数要被实现 struct list_head list; dev_t dev; ... 阅读全文
posted @ 2011-01-09 20:27 羽落无声 阅读(5499) 评论(0) 推荐(0) 编辑
摘要: 在 linux 2.6内核中,使用 cdev结构体描述字符设备,cdev 的定义在 linux/cdev.h 中可找到,其定义如下:引用 struct cdev { struct kobject kobj; struct module *owner; const struct file_operations *ops; struct list_head list; dev_t dev; uns... 阅读全文
posted @ 2011-01-09 20:26 羽落无声 阅读(2379) 评论(0) 推荐(0) 编辑
摘要: Linux中的File_operations结构体2008-07-07 12:34File_operations结构体 file_operation就是把系统调用和驱动程序关联起来的关键数据结构。这个结构的每一个成员都对应着一个系统调用。读取file_operation中相应的函数指针,接着把控制权转交给函数,从而完成了Linux设备驱动程序的工作。 在系统内部,I/O设备的存取操作通过特定的入口... 阅读全文
posted @ 2011-01-09 19:36 羽落无声 阅读(7680) 评论(0) 推荐(0) 编辑
摘要: 我的理解是这样的: 两个主要数据结构如下:struct file_operations { struct module *owner; loff_t (*llseek) (struct file *, loff_t, int); ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); ssize_t (*write) (... 阅读全文
posted @ 2011-01-09 19:35 羽落无声 阅读(2849) 评论(0) 推荐(0) 编辑
摘要: copy_to_user,copy_from_user,get_user,put_user函数比较copy_to_user -- Copy a block of data into user space. copy_from_user -- Copy a block of data from user space.get_user -- Get a simple variable from use... 阅读全文
posted @ 2011-01-09 19:11 羽落无声 阅读(2633) 评论(0) 推荐(0) 编辑
摘要: 在Linux平台下,每一个进程都有一个task_struct数据结构,用来存储该进程的相关信息。task_struct在内核的以下代码中定义(以2.6.36为例,其他类似):http://lxr.linux.no/linux+v2.6.27/include/linux/sched.h。 task_struct最简单的两个成员,其他的这里就不再介绍了:进程名称点击隐藏C CODE1153115411... 阅读全文
posted @ 2011-01-09 14:43 羽落无声 阅读(4187) 评论(0) 推荐(0) 编辑
摘要: 尽管内核模块不象应用程序一样顺序执行, 内核做的大部分动作是代表一个特定进程的. 内核代码可以引用当前进程, 通过存取全局项 current, 它在 asm/current.h 中定义, 它产生一个指针指向结构 task_struct, 在 linux/sched.h 定义. current 指针指向当前在运行的进程. 在一个系统调用执行期间, 例如 open 或者 read, 当前进程是... 阅读全文
posted @ 2011-01-09 14:41 羽落无声 阅读(2990) 评论(0) 推荐(0) 编辑
摘要: http://blog168.chinaunix.net/space.php?uid=24219701&do=blog&cuid=2439407 硬件接法:L3MODE - GPB2 L3DATA-GPB3 L3CLOCK-GPB4 内核自带的声卡驱动,可以正常编译,也会打印出正确的配置信息,但是播放时没有声音,也不能进行录音。要替换掉内核自带的驱动(注意先备份[sound/soc/s3c... 阅读全文
posted @ 2011-01-09 14:23 羽落无声 阅读(1356) 评论(0) 推荐(1) 编辑
摘要: http://blog.csdn.net/lemon_fantasy/archive/2009/02/17/3901030.aspx Linux 将所有外部设备看成是一类特殊文件,称之为“设备文件”,如果说系统调用是Linux内核和应用程序之间的接口,那么设备驱动程序则可以看成是Linux 内核与外部设备之间的接口。设备驱动程序向应用程序屏蔽了硬件在实现上的细节,使得应用程序可以像操作普通文件一样... 阅读全文
posted @ 2011-01-09 13:51 羽落无声 阅读(842) 评论(0) 推荐(0) 编辑
摘要: 发布日期: 2004 年 8 月 01 日 杨沙洲 (pubb@163.net)国防科技大学计算机学院 简介: 本文详细分析了 2.6.x 内核中链表结构的实现,并通过实例对每个链表操作接口进行了详尽的讲解。 原文地址:http://www.ibm.com/developerworks/cn/linux/kernel/l-chain/index.html 一、 链表数据结构简介 链表是一种常... 阅读全文
posted @ 2011-01-09 09:15 羽落无声 阅读(373) 评论(0) 推荐(0) 编辑