First page Back Continue Last page Overview Graphics
Implementing a character driver
Four major steps
- Implement operations corresponding to the system calls an application can apply to a file: file operations
- Define a file_operations structure associating function pointers to their implementation in your driver
- Reserve a set of major and minors for your driver
- Tell the kernel to associate the reserved major and minor to your file operations
This is a very common design scheme in the Linux kernel
- A common kernel infrastructure defines a set of operations to be implemented by a driver and functions to register your driver
- Your driver only needs to implement this set of well-defined operations