File:bio.c - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki
4700 #
4701 /*
4702 */
4703
4704 #include "../param.h"
4705 #include "../user.h"
4706 #include "../buf.h"
4707 #include "../conf.h"
4708 #include "../systm.h"
4709 #include "../proc.h"
4710 #include "../seg.h"
4711
4712 /*
4713 * This is the set of buffres proper, whose heads
4714 * were declared in buf.h. There can exist buffer
4715 * headers not pointing here that are used purely
4716 * as arguments to the I/O routines to describe
4717 * I/O to be done-- e.g. swbuf, just below, for
4718 * swapping.
4719 */
4720 char buffers[NBUF][514];
4721 struct buf swbuf;
- 设备缓存数组,参见 设备缓存管理
4722
4723 /*
4724 * Declarations of the tables for the magtape devices;
4725 * see bdwrite.
4726 */
4727 int tmtab;
4728 int httab;
4729
- 指向 磁带设备 的指针
- 类型为 struct devtab
- 参见 bdwrite
4730 /*
4731 * The following several routines allocate and free
4732 * buffers with various side effects. In general the
4733 * arguments to an allocate routine are a device and
4734 * a block number, and the value is a pointer to
4735 * the buffer header; the buffer is marked "busy"
4736 * so that no one else can touch it. If the block was
4737 * already in core, no I/O need be done; if it is
4738 * already busy, the process waits until it becomes free.
4739 * The following routines allocate a buffer:
4740 * getblk
4741 * bread
4742 * breada
4743 * Eventually the buffer must be released, possibly with the
4744 * side effect of writing it out, by using one of
4745 * bwrite
4746 * bdwrite
4747 * bawrite
4748 * brelse
4749 */