字符设备驱动(2)
发布时间
阅读量:
阅读量
字符设备驱动
在Linux字符设备驱动程序设计中,有4种非常重要的数据结构:
Struct file
Struct inode
Struct cdev
Struct file_operations
Struct File(sbh_p92)
表示被打开的一个文件,在系统的内核空间中,默认情况下会为每个被打开的都会有一个专门定义的数据结构(称为struct file)进行绑定;该数据结构会在相应的操作完成时自动解绑并释放资源。
其中第一个成员是一个定位类型(loff_t)变量f_pos;第二个成员是一个指针变量f_op(类型为struct file_operations),用于指向与该操作相关的操作实例;第三个成员是一个位域数组f_flags;第四个成员是一个标志位域数组f_mode;第五个成员则用于存储一些私有数据。
You may employ the field to refer to allocated memory locations. Private data may serve as a reliable source for safeguarding the state information across successive system calls.

还没有任何评论哟~
