Go to the source code of this file.
Classes | |
| struct | char_device_struct |
: name of this range of devices | |
| register_chrdev() - Register a major number for character devices. : major device number or 0 for dynamic allocation : file operations associated with this devices If == 0 this functions will dynamically allocate a major and return its number. If > 0 this function will attempt to reserve a device with the given major number and will return zero on success. Returns a -ve errno on failure. The name of this device has nothing to do with the name of the device in /dev. It only helps to keep track of the different owners of devices. If your module name has only one type of devices it's ok to use e.g. the name of the module here.
This function registers a range of 256 minor numbers. The first minor number is 0. | |
| struct file_operations | def_chr_fops |
| static struct kobj_type | ktype_cdev_default |
| static struct kobj_type | ktype_cdev_dynamic |
| int | register_chrdev (unsigned int major, const char *name, const struct file_operations *fops) |
| void | unregister_chrdev_region (dev_t from, unsigned count) |
| unregister_chrdev_region() - return a range of device numbers : the first in the range of numbers to unregister : the number of device numbers to unregister | |
| void | unregister_chrdev (unsigned int major, const char *name) |
| static | DEFINE_SPINLOCK (cdev_lock) |
| static struct kobject * | cdev_get (struct cdev *p) |
| void | cdev_put (struct cdev *p) |
| static int | chrdev_open (struct inode *inode, struct file *filp) |
| void | cd_forget (struct inode *inode) |
| static void | cdev_purge (struct cdev *cdev) |
| static struct kobject * | exact_match (dev_t dev, int *part, void *data) |
| static int | exact_lock (dev_t dev, void *data) |
| int | cdev_add (struct cdev *p, dev_t dev, unsigned count) |
cdev_add() - add a char device to the system : the cdev structure for the device : the first device number for which this device is responsible : the number of consecutive minor numbers corresponding to this device | |
| static void | cdev_unmap (dev_t dev, unsigned count) |
| void | cdev_del (struct cdev *p) |
cdev_del() - remove a cdev from the system : the cdev structure to be removed | |
| static void | cdev_default_release (struct kobject *kobj) |
| static void | cdev_dynamic_release (struct kobject *kobj) |
| struct cdev * | cdev_alloc (void) |
| cdev_alloc() - allocate a cdev structure | |
| void | cdev_init (struct cdev *cdev, const struct file_operations *fops) |
| cdev_init() - initialize a cdev structure : the structure to initialize : the file_operations for this device | |
| static struct kobject * | base_probe (dev_t dev, int *part, void *data) |
| void __init | chrdev_init (void) |
| core_initcall (chrdev_init) | |
| EXPORT_SYMBOL (register_chrdev_region) | |
| EXPORT_SYMBOL (unregister_chrdev_region) | |
| EXPORT_SYMBOL (alloc_chrdev_region) | |
| EXPORT_SYMBOL (cdev_init) | |
| EXPORT_SYMBOL (cdev_alloc) | |
| EXPORT_SYMBOL (cdev_del) | |
| EXPORT_SYMBOL (cdev_add) | |
| EXPORT_SYMBOL (register_chrdev) | |
| EXPORT_SYMBOL (unregister_chrdev) | |
| EXPORT_SYMBOL (directly_mappable_cdev_bdi) | |
Functions | |
| static | DEFINE_MUTEX (chrdevs_lock) |
| static int | major_to_index (int major) |
| static struct char_device_struct * | __register_chrdev_region (unsigned int major, unsigned int baseminor, int minorct, const char *name) |
| static struct char_device_struct * | __unregister_chrdev_region (unsigned major, unsigned baseminor, int minorct) |
: the name of the device or driver. | |
register_chrdev_region() - register a range of device numbers : the first in the desired range of device numbers; must include the major number. : the number of consecutive device numbers required
Return value is zero on success, a negative error code on failure. | |
| int | register_chrdev_region (dev_t from, unsigned count, const char *name) |
: the name of the associated device or driver | |
alloc_chrdev_region() - register a range of char device numbers : output parameter for first assigned number : first of the requested range of minor numbers : the number of minor numbers required Allocates a range of char device numbers.
The major number will be chosen dynamically, and returned (along with the first minor number) in . Returns zero or a negative error code. | |
| int | alloc_chrdev_region (dev_t *dev, unsigned baseminor, unsigned count, const char *name) |
Variables | |
| struct backing_dev_info | directly_mappable_cdev_bdi |
| static struct kobj_map * | cdev_map |
| static struct char_device_struct * | chrdevs [CHRDEV_MAJOR_HASH_SIZE] |
| static struct char_device_struct* __register_chrdev_region | ( | unsigned int | major, | |
| unsigned int | baseminor, | |||
| int | minorct, | |||
| const char * | name | |||
| ) | [static, read] |
Definition at line 99 of file char_dev.c.
| static struct char_device_struct* __unregister_chrdev_region | ( | unsigned | major, | |
| unsigned | baseminor, | |||
| int | minorct | |||
| ) | [static, read] |
Definition at line 172 of file char_dev.c.
| int alloc_chrdev_region | ( | dev_t * | dev, | |
| unsigned | baseminor, | |||
| unsigned | count, | |||
| const char * | name | |||
| ) |
Definition at line 236 of file char_dev.c.
| static struct kobject* base_probe | ( | dev_t | dev, | |
| int * | part, | |||
| void * | data | |||
| ) | [static, read] |
Definition at line 544 of file char_dev.c.
| void cd_forget | ( | struct inode * | inode | ) |
Definition at line 415 of file char_dev.c.
| int cdev_add | ( | struct cdev * | p, | |
| dev_t | dev, | |||
| unsigned | count | |||
| ) |
cdev_add() - add a char device to the system : the cdev structure for the device : the first device number for which this device is responsible : the number of consecutive minor numbers corresponding to this device
cdev_add() adds the device represented by to the system, making it live immediately. A negative error code is returned on failure.
Definition at line 466 of file char_dev.c.
| struct cdev* cdev_alloc | ( | void | ) | [read] |
cdev_alloc() - allocate a cdev structure
Allocates and returns a cdev structure, or NULL on failure.
Definition at line 518 of file char_dev.c.
| static void cdev_default_release | ( | struct kobject * | kobj | ) | [static] |
Definition at line 492 of file char_dev.c.
| void cdev_del | ( | struct cdev * | p | ) |
cdev_del() - remove a cdev from the system : the cdev structure to be removed
cdev_del() removes from the system, possibly freeing the structure itself.
Definition at line 485 of file char_dev.c.
| static void cdev_dynamic_release | ( | struct kobject * | kobj | ) | [static] |
Definition at line 498 of file char_dev.c.
| static struct kobject* cdev_get | ( | struct cdev * | p | ) | [static, read] |
Definition at line 338 of file char_dev.c.
| void cdev_init | ( | struct cdev * | cdev, | |
| const struct file_operations * | fops | |||
| ) |
cdev_init() - initialize a cdev structure : the structure to initialize : the file_operations for this device
Initializes , remembering , making it ready to add to the system with cdev_add().
Definition at line 536 of file char_dev.c.
| static void cdev_purge | ( | struct cdev * | cdev | ) | [static] |
Definition at line 423 of file char_dev.c.
| void cdev_put | ( | struct cdev * | p | ) |
Definition at line 351 of file char_dev.c.
| static void cdev_unmap | ( | dev_t | dev, | |
| unsigned | count | |||
| ) | [static] |
Definition at line 473 of file char_dev.c.
| void __init chrdev_init | ( | void | ) |
Definition at line 552 of file char_dev.c.
| static int chrdev_open | ( | struct inode * | inode, | |
| struct file * | filp | |||
| ) | [static] |
Definition at line 363 of file char_dev.c.
| core_initcall | ( | chrdev_init | ) |
| static DEFINE_MUTEX | ( | chrdevs_lock | ) | [static] |
| static DEFINE_SPINLOCK | ( | cdev_lock | ) | [static] |
| static int exact_lock | ( | dev_t | dev, | |
| void * | data | |||
| ) | [static] |
Definition at line 450 of file char_dev.c.
| static struct kobject* exact_match | ( | dev_t | dev, | |
| int * | part, | |||
| void * | data | |||
| ) | [static, read] |
Definition at line 444 of file char_dev.c.
| EXPORT_SYMBOL | ( | directly_mappable_cdev_bdi | ) |
| EXPORT_SYMBOL | ( | unregister_chrdev | ) |
| EXPORT_SYMBOL | ( | register_chrdev | ) |
| EXPORT_SYMBOL | ( | cdev_add | ) |
| EXPORT_SYMBOL | ( | cdev_del | ) |
| EXPORT_SYMBOL | ( | cdev_alloc | ) |
| EXPORT_SYMBOL | ( | cdev_init | ) |
| EXPORT_SYMBOL | ( | alloc_chrdev_region | ) |
| EXPORT_SYMBOL | ( | unregister_chrdev_region | ) |
| EXPORT_SYMBOL | ( | register_chrdev_region | ) |
| static int major_to_index | ( | int | major | ) | [inline, static] |
Definition at line 66 of file char_dev.c.
| int register_chrdev | ( | unsigned int | major, | |
| const char * | name, | |||
| const struct file_operations * | fops | |||
| ) |
Definition at line 269 of file char_dev.c.
| int register_chrdev_region | ( | dev_t | from, | |
| unsigned | count, | |||
| const char * | name | |||
| ) |
Definition at line 200 of file char_dev.c.
| void unregister_chrdev | ( | unsigned int | major, | |
| const char * | name | |||
| ) |
Definition at line 327 of file char_dev.c.
| void unregister_chrdev_region | ( | dev_t | from, | |
| unsigned | count | |||
| ) |
unregister_chrdev_region() - return a range of device numbers : the first in the range of numbers to unregister : the number of device numbers to unregister
This function will unregister a range of device numbers, starting with . The caller should normally be the one who allocated those numbers in the first place...
Definition at line 314 of file char_dev.c.
struct kobj_map* cdev_map [static] |
Definition at line 52 of file char_dev.c.
struct char_device_struct * chrdevs[CHRDEV_MAJOR_HASH_SIZE] [static] |
| struct file_operations def_chr_fops |
| struct backing_dev_info directly_mappable_cdev_bdi |
Initial value:
{
.capabilities = (
BDI_CAP_MAP_DIRECT |
BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP),
}
Definition at line 41 of file char_dev.c.
struct kobj_type ktype_cdev_default [static] |
struct kobj_type ktype_cdev_dynamic [static] |
1.5.6