一、杂项设备介绍
杂项设备的主设备号是10,在任何Linux 系统中它都是固定的。
杂项设备的引入既解决了设备号数量少的问题,又降低了使用难度,还能防止碎片化,一举多得。
杂项设备是被强制编译至内核中的。
obj-y += misc.o
二、杂项设备注册函数以及结构体
1、位置:杂项设备的头文件在源码目录下的 include/linux/miscdevice.h中。
2、杂项设备结构体
struct miscdevice {
int minor;
const char *name;
const struct file_operations *fops;
struct list_head list;
struct device *parent;
struct device *this_device;
const char *nodename;
mode_t mode;
};
int