code:bdevsw - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki

Source

  • 定义了描述块设备(如RK磁盘)的结构

4608 /* ------------------------- */

4609 /* Declaration of block device

4610  * switch. Each entry (row) is

4611  * the only link between the

4612  * main unix code and the driver.

4613  * The initialization of the

4614  * device switches is in the

4615  * file conf.c.

4616  */

4617 struct bdevsw {

4618     int (*d_open)();

4619     int (*d_close)();

4620     int (*d_strategy)();

  • 设备驱动函数指针
4621     int *d_tab;
4622 } bdevsw[];

4623 /* ------------------------- */

4650 /*

4651  * this file is created, along with the file "low.s",

4652  * by the program "mkconf.c", to reflect the actual

4653  * configuration of peripheral devices on a system.

4654  */

4655

4656 int (*bdevsw[])()

4657 {

4658 &nulldev, &nulldev, &rkstrategy, &rktab, /*rk */

  • 对于rk磁盘的设备描述
4659 &nodev, &nodev, &nodev, 0, /* rp */

4660 &nodev, &nodev, &nodev, 0, /* rf */

4661 &nodev, &nodev, &nodev, 0, /* tm */

4662 &nodev, &nodev, &nodev, 0, /* tc */

4663 &nodev, &nodev, &nodev, 0, /* hs */

4664 &nodev, &nodev, &nodev, 0, /* hp */

4665 &nodev, &nodev, &nodev, 0, /* ht */

4666 0

4667 };

Ref

Caller

⚠️ **GitHub.com Fallback** ⚠️