Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_CDEV_H |
| 2 | #define _LINUX_CDEV_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
Jan Engelhardt | 5ec68b2 | 2006-12-06 20:36:14 -0800 | [diff] [blame] | 4 | #include <linux/kobject.h> |
| 5 | #include <linux/kdev_t.h> |
| 6 | #include <linux/list.h> |
Logan Gunthorpe | 233ed09 | 2017-03-17 12:48:08 -0600 | [diff] [blame] | 7 | #include <linux/device.h> |
Jan Engelhardt | 5ec68b2 | 2006-12-06 20:36:14 -0800 | [diff] [blame] | 8 | |
Jan Engelhardt | 3d8b303 | 2007-01-29 13:19:56 -0800 | [diff] [blame] | 9 | struct file_operations; |
| 10 | struct inode; |
| 11 | struct module; |
| 12 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | struct cdev { |
| 14 | struct kobject kobj; |
| 15 | struct module *owner; |
Arjan van de Ven | 99ac48f | 2006-03-28 01:56:41 -0800 | [diff] [blame] | 16 | const struct file_operations *ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | struct list_head list; |
| 18 | dev_t dev; |
| 19 | unsigned int count; |
Kees Cook | 3859a27 | 2016-10-28 01:22:25 -0700 | [diff] [blame] | 20 | } __randomize_layout; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
Arjan van de Ven | 99ac48f | 2006-03-28 01:56:41 -0800 | [diff] [blame] | 22 | void cdev_init(struct cdev *, const struct file_operations *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
| 24 | struct cdev *cdev_alloc(void); |
| 25 | |
| 26 | void cdev_put(struct cdev *p); |
| 27 | |
| 28 | int cdev_add(struct cdev *, dev_t, unsigned); |
| 29 | |
Logan Gunthorpe | 233ed09 | 2017-03-17 12:48:08 -0600 | [diff] [blame] | 30 | void cdev_set_parent(struct cdev *p, struct kobject *kobj); |
| 31 | int cdev_device_add(struct cdev *cdev, struct device *dev); |
| 32 | void cdev_device_del(struct cdev *cdev, struct device *dev); |
| 33 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | void cdev_del(struct cdev *); |
| 35 | |
| 36 | void cd_forget(struct inode *); |
| 37 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | #endif |