1: /*
2: * Each buffer in the pool is usually doubly linked into 2 lists:
3: * the device with which it is currently associated (always)
4: * and also on a list of blocks available for allocation
5: * for other use (usually).
6: * The latter list is kept in last-used order, and the two
7: * lists are doubly linked to make it easy to remove
8: * a buffer from one list when it was found by
9: * looking through the other.
10: * A buffer is on the available list, and is liable
11: * to be reassigned to another disk block, if and only
12: * if it is not marked BUSY. When a buffer is busy, the
13: * available-list pointers can be used for other purposes.
14: * Most drivers use the forward ptr as a link in their I/O
15: * active queue.
16: * A buffer header contains all the information required
17: * to perform I/O.
18: * Most of the routines which manipulate these things
19: * are in bio.c.
20: */
21: struct buf
22: {
23: int b_flags; /* see defines below */
24: struct buf *b_forw; /* headed by devtab of b_dev */
25: struct buf *b_back; /* " */
26: struct buf *av_forw; /* position on free list, */
27: struct buf *av_back; /* if not BUSY*/
28: int b_dev; /* major+minor device name */
29: int b_wcount; /* transfer count (usu. words) */
30: char *b_addr; /* low order core address */
31: char *b_xmem; /* high order core address */
32: char *b_blkno; /* block # on device */
33: char b_error; /* returned after I/O */
34: char *b_resid; /* words not transferred after error */
35: } buf[NBUF];
36:
37: /*
38: * Each block device has a devtab, which contains private state stuff
39: * and 2 list heads: the b_forw/b_back list, which is doubly linked
40: * and has all the buffers currently associated with that major
41: * device; and the d_actf/d_actl list, which is private to the
42: * device but in fact is always used for the head and tail
43: * of the I/O queue for the device.
44: * Various routines in bio.c look at b_forw/b_back
45: * (notice they are the same as in the buf structure)
46: * but the rest is private to each device driver.
47: */
48: struct devtab
49: {
50: char d_active; /* busy flag */
51: char d_errcnt; /* error count (for recovery) */
52: struct buf *b_forw; /* first buffer for this dev */
53: struct buf *b_back; /* last buffer for this dev */
54: struct buf *d_actf; /* head of I/O queue */
55: struct buf *d_actl; /* tail of I/O queue */
56: };
57:
58: /*
59: * This is the head of the queue of available
60: * buffers-- all unused except for the 2 list heads.
61: */
62: struct buf bfreelist;
63:
64: /*
65: * These flags are kept in b_flags.
66: */
67: #define B_WRITE 0 /* non-read pseudo-flag */
68: #define B_READ 01 /* read when I/O occurs */
69: #define B_DONE 02 /* transaction finished */
70: #define B_ERROR 04 /* transaction aborted */
71: #define B_BUSY 010 /* not on av_forw/back list */
72: #define B_PHYS 020 /* Physical IO potentially using UNIBUS map */
73: #define B_MAP 040 /* This block has the UNIBUS map allocated */
74: #define B_WANTED 0100 /* issue wakeup when BUSY goes off */
75: #define B_RELOC 0200 /* no longer used */
76: #define B_ASYNC 0400 /* don't wait for I/O completion */
77: #define B_DELWRI 01000 /* don't write till block leaves available list */
Defined variables
buf
defined in line
35; used 1 times
Defined struct's
buf
defined in line
21; used 166 times
- in line 24-27(8),
52-55(8),
62(2)
- in /usr/sys/dmr/bio.c line
22(2),
57(2),
75(2),
109-111(4),
135-137(4),
154-156(4),
167-169(4),
199(2),
220(2),
280-282(4),
297-299(4),
316-318(4),
354(2),
394-398(4),
422-426(4),
454-457(4),
479(2),
526(2),
552-555(4),
628-630(4)
- in /usr/sys/dmr/hp.c line
64(2),
110-112(4),
151(2),
163(2)
- in /usr/sys/dmr/hs.c line
32(2),
43-45(4),
70(2),
85(2)
- in /usr/sys/dmr/ht.c line
33(2),
112-114(4),
147(2),
188(2)
- in /usr/sys/dmr/rf.c line
23(2),
35-37(4),
61(2),
72(2)
- in /usr/sys/dmr/rk.c line
37-42(6),
70-72(4),
90(2),
100(2)
- in /usr/sys/dmr/rp.c line
42(2),
65-67(4),
108(2),
119(2)
- in /usr/sys/dmr/tc.c line
56-58(4),
82(2),
110(2)
- in /usr/sys/dmr/tm.c line
24(2),
86-88(4),
121(2),
163(2)
- in /usr/sys/ken/rdwri.c line
164(2)
devtab
defined in line
48; used 24 times
Defined macros
B_BUSY
defined in line
71; used 13 times
B_ERROR
defined in line
70; used 24 times
- in /usr/sys/dmr/bio.c line
116,
179,
515,
633
- in /usr/sys/dmr/hp.c line
119,
183
- in /usr/sys/dmr/hs.c line
53,
98
- in /usr/sys/dmr/ht.c line
121,
162,
211
- in /usr/sys/dmr/rf.c line
43,
85
- in /usr/sys/dmr/rk.c line
53,
114
- in /usr/sys/dmr/rp.c line
76,
140
- in /usr/sys/dmr/tc.c line
64,
92,
126
- in /usr/sys/dmr/tm.c line
95,
132,
184
- in /usr/sys/ken/iget.c line
73
B_MAP
defined in line
73; used 3 times
B_READ
defined in line
68; used 23 times
- in /usr/sys/dmr/bio.c line
62,
83,
93,
116,
408,
438
- in /usr/sys/dmr/dp.c line
127
- in /usr/sys/dmr/hp.c line
196
- in /usr/sys/dmr/hs.c line
109
- in /usr/sys/dmr/ht.c line
125,
131,
229
- in /usr/sys/dmr/rf.c line
96
- in /usr/sys/dmr/rk.c line
125
- in /usr/sys/dmr/rp.c line
153
- in /usr/sys/dmr/tc.c line
162
- in /usr/sys/dmr/tm.c line
99,
105,
157,
202
- in /usr/sys/ken/rdwri.c line
61
- in /usr/sys/ken/slp.c line
238,
246
B_WANTED
defined in line
74; used 15 times
- in /usr/sys/dmr/bio.c line
173-176(3),
184,
239,
251,
327,
463,
483,
498,
511-514(2),
588,
610-613(2)
Usage of this include