void cdev_init(struct cdev *cdev, const struct file_operations *fops)
2013-07-20 13:20
525 查看
fs/char_dev.c
/**
* cdev_init() - initialize a cdev structure
* @cdev: the structure to initialize
* @fops: the file_operations for this device
*
* Initializes @cdev, remembering @fops, making it ready to add to the
* system with cdev_add().
*/
void cdev_init(struct cdev *cdev, const struct file_operations *fops)
{
memset(cdev, 0, sizeof *cdev);
INIT_LIST_HEAD(&cdev->list);
kobject_init(&cdev->kobj, &ktype_cdev_default);
cdev->ops = fops;
}
/**
* cdev_init() - initialize a cdev structure
* @cdev: the structure to initialize
* @fops: the file_operations for this device
*
* Initializes @cdev, remembering @fops, making it ready to add to the
* system with cdev_add().
*/
void cdev_init(struct cdev *cdev, const struct file_operations *fops)
{
memset(cdev, 0, sizeof *cdev);
INIT_LIST_HEAD(&cdev->list);
kobject_init(&cdev->kobj, &ktype_cdev_default);
cdev->ops = fops;
}
相关文章推荐
- static inline int register_chrdev(unsigned int major, const char *name, const struct file_operations
- 对于struct file_operations中ioctl消失的学习笔记
- 对关于字符驱动的一些重要数据结构(file_operations, file, inode, cdev)的理解
- struct--file_operations
- linux内核中struct file_operations 结构体介绍
- Linux2.6 struct file_operations
- 字符驱动之二操作方法(struct file_operations)【转】
- 对于struct file_operations中ioctl消失的学习笔记
- 在kernel 2.6.36 中已经完全删除了struct file_operations 中的ioctl 函数指针
- 2.6.36中struct file_operations 的变化
- 对于struct file_operations中ioctl消失的学习笔记
- struct file_operations and struct inode_operations defined in include/linux/fs.h
- 内核关于struct file_operations结构体的说明--基于4.1.X kernel
- 简单理解 struct inode 和 struct file,cdev 和 inode的关系
- 对于struct file_operations中ioctl消失的学习笔记
- struct file_operations及struct file结构体理解转
- 简单理解 struct inode 和 struct file,cdev 和 inode的关系
- struct file_operations 的进一步理解(转)
- 结构体初始化的方法——关于struct file_operations
- static struct file_operations结构体介绍(转)