4、用内存虚拟出来的块设备sbull_devstruct sbull_dev { int size; /* Device size in sectors */ u8 *data; /* The data array */ short users; /* How many users */ short media_change;
5、 /* Flag a media change? */ spinlock_t lock; /* For mutual exclusion */ struct request_queue *queue; /* The device request queue */ struct gendisk *gd; /* The gendisk structure */ str
6、uct timer_list timer; /* For simulated media changes */};这个设备结构体是我们工作的核心,也许你不知道需要哪些成员,不要紧,还是那句话,编写驱动的时候,需要设备表现出那些性质和功能,相应的添加上就OK了。(3)设备的初始化 sbull_init( ){一、sbull_major = register_blkdev(sbull_major, "sbull");二、Static struct sbull_dev *Devices =