cdev.h 806 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef _LINUX_CDEV_H
  2. #define _LINUX_CDEV_H
  3. #include <linux/kobject.h>
  4. #include <linux/kdev_t.h>
  5. #include <linux/list.h>
  6. #include <linux/device.h>
  7. struct file_operations;
  8. struct inode;
  9. struct module;
  10. struct cdev {
  11. struct kobject kobj;
  12. struct module *owner;
  13. const struct file_operations *ops;
  14. struct list_head list;
  15. dev_t dev;
  16. unsigned int count;
  17. } __randomize_layout;
  18. void cdev_init(struct cdev *, const struct file_operations *);
  19. struct cdev *cdev_alloc(void);
  20. void cdev_put(struct cdev *p);
  21. int cdev_add(struct cdev *, dev_t, unsigned);
  22. void cdev_set_parent(struct cdev *p, struct kobject *kobj);
  23. int cdev_device_add(struct cdev *cdev, struct device *dev);
  24. void cdev_device_del(struct cdev *cdev, struct device *dev);
  25. void cdev_del(struct cdev *);
  26. void cd_forget(struct inode *);
  27. #endif