Creating a device

struct proc_dir_entry* proc_mknod(const char* name, mode_t mode, struct proc_dir_entry* parent, kdev_t rdev);

Creates a device file name with mode mode in the procfs directory parent. The device file will work on the device rdev, which can be generated by using the MKDEV macro from linux/kdev_t.h. The mode parameter must contain S_IFBLK or S_IFCHR to create a device node. Compare with userland mknod --mode=mode name rdev.