Rechercher une page de manuel
register_chrdev
Langue: en
Version: $Date:$ (mandriva - 22/10/07)
Section: 9 (Appels noyau Linux)
NAME
register_chrdev, unregister_chrdev - register a driver major numberSYNOPSIS
#include <linux/fs.h>int register_chrdev(unsigned int major, const char*name, struct file_operations*ops);
int unregister_chrdev(unsigned int major, const char *name);
DESCRIPTION
The register_chrdev function associates a character major number with set of driver entry points. The file_operations structure contains pointers to functions that the the driver uses to implement the kernel interface to the driver.The paramter major is the character major number assigned to the device driver and to be mapped to the function table. The name parameter is a short name for the device and is displayed in the The /proc/devices list. It also must exactly match the name passed to unregister_chrdev function when releasing the functions.
A device driver module may register as many different major numbers as it supports, though this is not typically done.
The unregister_chrdev function releases the major number, and is normally called in the module_cleanup function to remove the driver from the kernel.
RETURN VALUE
On success, register_chrdev returns 0 if major is a number other then 0, otherwise Linux will choose a major number and return the chosen value.If there is an error, one of the following codes is returned instead:
-
- -EINVAL
- The specified number is not valid (> MAX_CHRDEV)
- -EBUSY
- The major number is busy
The unregister_chrdev function will return 0 if successful, or -EINVAL if the major number is not registered with the matching name.
AVAILABILITY
Linux 1.0+SEE ALSO
register_blkdev(9) mknod(2)AUTHOR
Stephen Williams (steve@icarus.com)BUGS
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre