2 .TH register_chrdev 9 "$Date:$" "Linux 2.0" "Kernel Functions"
4 register_chrdev, unregister_chrdev \- register a driver major number
6 .B #include <linux/fs.h>
8 .BI "int register_chrdev(unsigned int " major ", const char*" name ","
9 .BI "struct file_operations*" ops ");"
11 .BI "int unregister_chrdev(unsigned int " major ", const char *" name ");"
15 function associates a character major number with set of driver entry
16 points. The file_operations structure contains pointers to functions
17 that the the driver uses to implement the kernel interface to the
22 is the character major number assigned to the device driver and to be
23 mapped to the function table. The
25 parameter is a short name for the device and is displayed in the
28 list. It also must exactly match the name passed to
30 function when releasing the functions.
32 A device driver module may register as many different major numbers as
33 it supports, though this is not typically done.
37 function releases the major number, and is normally called in the
38 module_cleanup function to remove the driver from the kernel.
44 is a number other then 0, otherwise Linux will choose a major number
45 and return the chosen value.
47 If there is an error, one of the following codes is returned instead:
51 The specified number is not valid (> MAX_CHRDEV)
54 The major number is busy
59 function will return 0 if successful, or
61 if the major number is not registered with the matching name.
65 .BR register_blkdev "(9) " mknod "(2)"
67 Stephen Williams (steve@icarus.com)