struct cdev

来源:互联网 发布:网络赛车赌博 编辑:程序博客网 时间:2024/05/24 02:52

头文件:

#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初始化:

[plain] view plain copy
  1. void cdev_init(struct cdev *cdev, const struct file_operations *fops);  

struct cdev注册:

[plain] view plain copy
  1. int cdev_add(struct cdev *p, dev_t dev, unsigned count);  


struct cdev注销:

[plain] view plain copy
  1. void cdev_del(struct cdev *p);  
0 0