[PATCH] cdev-cidr, part 1
New object: struct cdev. It contains a kobject, a pointer to file_operations and a pointer to owner module. These guys have a search structure of the same sort as gendisks and chrdev_open() picks file_operations from them. Intended use: embed such animal in driver-owned structure (e.g. tty_driver) and register it as associated with given range of device numbers. Generic code will do lookup for such object and use it for the rest. The behaviour of register_chrdev() is _not_ changed - it allocates struct cdev and registers it; any old driver will work as if nothing had changed. On that stage we only use it during chrdev_open() to find file_operations. Later it will be cached in inode->i_cdev (and index in range - in inode->i_cindex) so that ->open() could get whatever objects it wants directly without any special-cased lookups, etc.
Showing
include/linux/cdev.h
0 → 100644
Please register or sign in to comment