Issue
What does cdev_add()
actually do? I'm asking terms of registering a device with the kernel.
Does it add the pointer to cdev structure in some map which is indexed by major and minor number? How exactly does this happen when you say the device is added/registered with the kernel? I want to know what steps the cdev_add()
takes to register the device in the running kernel. We create a node for user-space using mknod
command. Even this command is mapped using major and minor number. Does registration also do something similar?
Solution
You can read Linux Device Driver. It is a little bit old, but the main ideas are the same. It is difficoult to explain a simple operation like cdev_add()
and all the stuff around in few lines.
I suggest you to read the book and the source code. If you have trouble to navigate your source code, you can use some tag system like etags + emacs, or the eclipse indexer.
Answered By - Federico Answer Checked By - Terry (WPSolving Volunteer)