3、据结构有两个,一个是structblock_device,用来描述一个块设备或者块设备的一个分区;另一个是structgendisk,用来描述整个块设备的特性。对于一个包含多个分区的块设备,structblock_device结构有多个,而structgendisk结构永远只有一个。[cpp] viewplaincopy1.struct block_device { 2. dev_t bd_dev; /* not a kdev_t - it's a search key */ 3. struct inode * bd_inode; /* wi
4、ll die */ 4. struct super_block * bd_super; 5. int bd_openers; 6. struct mutex bd_mutex; /* open/close mutex */ 7. struct list_head bd_inodes; 8. void * bd_holder; 9. int bd_holders; 10.#ifdef CONFIG_SYSFS 11. struct list_head b
5、d_holder_list; 12.#endif 13. struct block_device * bd_contains; 14. unsigned bd_block_size; 15. struct hd_struct * bd_part; 16. /* number of times partitions within this device have been opened. */ 17. unsigned bd_part_count; 18. int bd_invalidated;
6、 19. struct gendisk * bd_disk; 20. struct list_head bd_list; 21. /* 22. * Private data. You must have bd_claim'ed the block_device 23. * to use this. NOTE: bd_claim allows an owner to claim 24. * the same device multiple times, the owner must take special 25. * ca
7、re to not mess up bd_private for that case. 26. */ 27. unsigned long bd_private; 28. 29. /* The counter of freeze processes */ 30. int bd_fsfreeze_count; 31. /* Mute