code:struct devtab - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki

Source

4537

4538 /*

4539  * Each block device has a devtab, which contains private

4540  * state stuff and 2 list heads: the b_forw/b_back list,

4541  * which is doubly linked and has all the buffers currently

4542  * associated with the major device;

4543  * and the d_actf/d_actl list, which is private to the

4544  * device but in fact is always used for the head and tail

4545  * of the I/O queue for the device.

4546  * Various routines in bio.c look at b_forw/b_back

4547  * (notice they are the same as in the buf structure)

4548  * but the rest is private to each device driver.

4549  */

4550

4551 struct devtab

4552 {

4553     char d_active; /* busy flag */

  • 标志设备是否启动
4554     char d_errcnt; /* error count (for recovery)*/
  • 累计I/O错误次数
4555     struct buf *b_forw; /* first buffer for this dev */

4556     struct buf *b_back; /* last buffer for this dev */

4557     struct buf *d_actf; /* head of I/O queue */

4558     struct buf *d_actl; /* tail of I/O queue */

4559 };

4560 /* ------------------------- */

Ref

Caller

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