Kernel Module Internals
- __register_chrdev_region
- The first and foremost functioni called by kernel module to ask kernel to add this module to it kernel iinternal structure
- What are the structs?
- char_device_struct (char_dev.c)
- Creates a mojor number for this module and creates a new struct for this module add it to the linked list of all char dev structs chrdevs
#define CHRDEV_MAJOR_HASH_SIZE 255 static struct char_device_struct { struct char_device_struct *next; unsigned int major; unsigned int baseminor; int minorct; char name[64]; struct cdev *cdev; /* will die */ } *chrdevs[CHRDEV_MAJOR_HASH_SIZE];
- Creates a mojor number for this module and creates a new struct for this module add it to the linked list of all char dev structs chrdevs
- char_device_struct (char_dev.c)
- class_create
- creaees a class with char device namein /sys/class