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 d_tab of conf.c */
25: struct buf *b_back; /* " */
26: struct buf *av_forw; /* position on free list, */
27: struct buf *av_back; /* if not BUSY*/
28: dev_t b_dev; /* major+minor device name */
29: unsigned b_bcount; /* transfer count */
30: union {
31: caddr_t b_addr; /* low order core address */
32: int *b_words; /* words for clearing */
33: struct filsys *b_filsys; /* superblocks */
34: struct dinode *b_dino; /* ilist */
35: daddr_t *b_daddr; /* indirect block */
36: } b_un;
37: daddr_t b_blkno; /* block # on device */
38: char b_xmem; /* high order core address */
39: char b_error; /* returned after I/O */
40: unsigned int b_resid; /* words not transferred after error */
41: };
42:
43: extern struct buf buf[]; /* The buffer pool itself */
44: extern struct buf bfreelist; /* head of available list */
45:
46: /*
47: * These flags are kept in b_flags.
48: */
49: #define B_WRITE 0 /* non-read pseudo-flag */
50: #define B_READ 01 /* read when I/O occurs */
51: #define B_DONE 02 /* transaction finished */
52: #define B_ERROR 04 /* transaction aborted */
53: #define B_BUSY 010 /* not on av_forw/back list */
54: #define B_PHYS 020 /* Physical IO potentially using UNIBUS map */
55: #define B_MAP 040 /* This block has the UNIBUS map allocated */
56: #define B_WANTED 0100 /* issue wakeup when BUSY goes off */
57: #define B_AGE 0200 /* delayed write for correct aging */
58: #define B_ASYNC 0400 /* don't wait for I/O completion */
59: #define B_DELWRI 01000 /* don't write till block leaves available list */
60: #define B_TAPE 02000 /* this is a magtape (no bdwrite) */
61: #define B_PBUSY 04000
62: #define B_PACK 010000
63:
64: /*
65: * special redeclarations for
66: * the head of the queue per
67: * device driver.
68: */
69: #define b_actf av_forw
70: #define b_actl av_back
71: #define b_active b_bcount
72: #define b_errcnt b_resid
Defined struct's
buf
defined in line
21; used 236 times
- in line 24-27(8),
43-44(4)
- in /usr/sys/conf/c.c line
17-19(4),
77(2),
84(2)
- in /usr/sys/dev/bio.c line
28-29(4),
55-60(4),
83-88(4),
126(2),
155-157(4),
172(2),
183-185(4),
222-223(4),
237-243(6),
308-312(6),
344(2),
359(2),
375(2),
393(2),
412(2),
459(2),
485(2),
558(2)
- in /usr/sys/dev/dkleave.c line
6(2),
19(2)
- in /usr/sys/dev/dsort.c line
12-15(6)
- in /usr/sys/dev/du.c line
22(2)
- in /usr/sys/dev/hp.c line
83-85(6),
115-117(4),
147(2),
203(2),
259(2)
- in /usr/sys/dev/ht.c line
33-35(6),
123(2),
145(2),
182(2),
254(2)
- in /usr/sys/dev/pk3.c line
10(2),
77(2),
127(2)
- in /usr/sys/dev/rf.c line
21-22(4),
39(2),
62(2),
83(2)
- in /usr/sys/dev/rk.c line
42-46(6),
56(2),
70(2),
98(2)
- in /usr/sys/dev/rl.c line
40-41(4),
60(2),
87(2),
108(2)
- in /usr/sys/dev/rp.c line
43-44(4),
74-76(4),
105(2),
140(2)
- in /usr/sys/dev/tc.c line
24(2),
58(2),
83(2),
112(2)
- in /usr/sys/dev/tm.c line
23-25(6),
104(2),
126(2),
166(2),
221(2)
- in /usr/sys/dev/vp.c line
44(2)
- in /usr/sys/sys/alloc.c line
25(2),
31(2),
83(2),
149(2),
290(2)
- in /usr/sys/sys/iget.c line
37(2),
153(2),
247(2)
- in /usr/sys/sys/machdep.c line
166(2),
189(2)
- in /usr/sys/sys/main.c line
92(2),
127-128(4)
- in /usr/sys/sys/nami.c line
27(2)
- in /usr/sys/sys/prf.c line
111(2)
- in /usr/sys/sys/rdwri.c line
22(2),
86(2)
- in /usr/sys/sys/subr.c line
23(2)
- in /usr/sys/sys/sys1.c line
32(2)
- in /usr/sys/sys/sys3.c line
62(2),
138(2),
202(2)
Defined macros
B_AGE
defined in line
57; used 4 times
B_BUSY
defined in line
53; used 19 times
B_ERROR
defined in line
52; used 32 times
- in /usr/sys/dev/bio.c line
131,
194,
446,
561
- in /usr/sys/dev/hp.c line
127,
229,
274
- in /usr/sys/dev/ht.c line
152,
244,
293
- in /usr/sys/dev/rf.c line
44,
97
- in /usr/sys/dev/rk.c line
52,
114
- in /usr/sys/dev/rl.c line
66,
149
- in /usr/sys/dev/rp.c line
85,
164
- in /usr/sys/dev/tc.c line
65,
94,
128
- in /usr/sys/dev/tm.c line
136,
177,
255
- in /usr/sys/sys/alloc.c line
50,
184,
303
- in /usr/sys/sys/iget.c line
80,
163,
255
- in /usr/sys/sys/nami.c line
139
- in /usr/sys/sys/subr.c line
93
B_MAP
defined in line
55; used 3 times
B_READ
defined in line
50; used 48 times
- in /usr/src/cmd/uucp/pk0.c line
278
- in /usr/sys/dev/bio.c line
69,
94,
107,
131
- in /usr/sys/dev/dsort.c line
26-31(4)
- in /usr/sys/dev/du.c line
118
- in /usr/sys/dev/hp.c line
246,
331
- in /usr/sys/dev/ht.c line
135,
157,
163,
220,
269,
313,
356
- in /usr/sys/dev/mx2.c line
281,
403,
473,
534
- in /usr/sys/dev/pk0.c line
303
- in /usr/sys/dev/rf.c line
73,
109
- in /usr/sys/dev/rk.c line
86,
127
- in /usr/sys/dev/rl.c line
63,
99,
208
- in /usr/sys/dev/rp.c line
127,
176
- in /usr/sys/dev/tc.c line
164
- in /usr/sys/dev/tm.c line
112,
140,
147,
209,
280
- in /usr/sys/sys/nami.c line
138
- in /usr/sys/sys/rdwri.c line
52,
68
- in /usr/sys/sys/slp.c line
311-316(2)
- in /usr/sys/sys/subr.c line
42,
80,
102
- in /usr/sys/sys/text.c line
152
B_WANTED
defined in line
56; used 21 times
- in /usr/sys/dev/bio.c line
188-191(3),
210,
261,
281,
317,
384,
417-421(2),
442-445(2),
519,
540-543(2)
- in /usr/sys/dev/ht.c line
128,
138
- in /usr/sys/dev/tm.c line
109,
119
- in /usr/sys/sys/machdep.c line
174,
193
b_actf
defined in line
69; used 52 times
- in /usr/sys/dev/dsort.c line
17-19(2)
- in /usr/sys/dev/hp.c line
159,
195-196(2),
209-212(3),
228,
266-267(2),
306-313(3)
- in /usr/sys/dev/ht.c line
170-171(2),
187,
247,
258,
307
- in /usr/sys/dev/rf.c line
50-51(2),
65,
88,
100
- in /usr/sys/dev/rk.c line
58-59(2),
75,
103,
117
- in /usr/sys/dev/rl.c line
74-75(2),
89,
119,
163
- in /usr/sys/dev/rp.c line
93-94(2),
111,
146,
167
- in /usr/sys/dev/tc.c line
71-72(2),
89-92(2),
118,
149
- in /usr/sys/dev/tm.c line
154-155(2),
172,
214,
225,
264
b_active
defined in line
71; used 52 times
- in /usr/sys/dev/hp.c line
136-138(2),
165-167(2),
215,
226,
264,
275,
287,
298,
304-307(2)
- in /usr/sys/dev/ht.c line
175,
205,
213,
232-236(2),
261-262(2),
286,
314
- in /usr/sys/dev/rf.c line
55,
67,
85-89(2)
- in /usr/sys/dev/rk.c line
63,
77,
100-104(2)
- in /usr/sys/dev/rl.c line
79,
91,
113,
161
- in /usr/sys/dev/rp.c line
98,
113,
143-147(2)
- in /usr/sys/dev/tc.c line
76,
101-105(2),
133-137(2),
144-148(2),
165
- in /usr/sys/dev/tm.c line
159,
185,
191,
206,
228-229(2),
245
b_actl
defined in line
70; used 20 times
b_errcnt
defined in line
72; used 28 times
- in /usr/sys/dev/hp.c line
227,
233-234(2),
273-276(2),
292,
299,
305-308(2)
- in /usr/sys/dev/ht.c line
282-285(2),
306
- in /usr/sys/dev/rf.c line
93,
99
- in /usr/sys/dev/rk.c line
110,
116
- in /usr/sys/dev/rl.c line
123,
132,
143,
162
- in /usr/sys/dev/rp.c line
160,
166
- in /usr/sys/dev/tc.c line
100,
124-127(2)
- in /usr/sys/dev/tm.c line
210,
243,
263
Usage of this include