
void cdev_init(struct cdev *cdev, const struct file_operations *fops).The helper functions declared in include/linux/cdev.h are defined in fs/char_dev.c, with some useful code comments: dev_t dev, which stores the (major, minor) numbers couple representing the character device file corresponding to this structure.const struct file_operations *ops, which relates the ordinary operations ( open, read, write, …) on the character device file represented by this structure to some internal operations in the kernel module._randomize_layout is a macro, which is out of the scope of these considerations. Therefore, driver code should include, where not only the structure, but also its associated helper functions are declared. In order to use a character device, the driver must first allocate and register one or more of these structures.
