头文件:
#include <Linux/cdev.h>
2.6.39内核:
struct cdev {
struct kobject kobj;
struct module *owner;
const struct file_operations *ops;
struct list_head list;
dev_t dev;
unsigned int count;
};
struct cdev分配方法:
静态分配 | struct cdev my_cdev; |
动态分配 | struct cdev *my_cdev = cdev_alloc(); |
struct cdev初始化:
struct cdev注册: