static struct char_device_struct {

struct char_device_struct *next; unsigned int major; unsigned int baseminor; int minorct; char name[64];

struct file_operations *fops;


The way entries are organized is quite similar to the techniques employed for struct kobj_map above. next links all elements on the same hash line (major_to_index computes the hash position given a major number). You will have guessed that major specifies the major number, while baseminor is the smallest minor number in a consecutive range of minorct minor numbers. name provides an identifier for the device. Usually, this name is chosen similar to the name of the device special file used for the device, but this is no strict requirement. fops points to the file_operations associated with the device, and cdev provides a link with struct cdev, which is discussed in Section 6.4.1.

Continue reading here: Character Devices

Was this article helpful?

0 0