|
|
1.1 root 1: /* buf.h 2.1 1/5/80 */
2:
3: /*
4: * Each buffer in the pool is usually doubly linked into 2 lists:
5: * the device with which it is currently associated (always)
6: * and also on a list of blocks available for allocation
7: * for other use (usually).
8: * The latter list is kept in last-used order, and the two
9: * lists are doubly linked to make it easy to remove
10: * a buffer from one list when it was found by
11: * looking through the other.
12: * A buffer is on the available list, and is liable
13: * to be reassigned to another disk block, if and only
14: * if it is not marked BUSY. When a buffer is busy, the
15: * available-list pointers can be used for other purposes.
16: * Most drivers use the forward ptr as a link in their I/O
17: * active queue.
18: * A buffer header contains all the information required
19: * to perform I/O.
20: * Most of the routines which manipulate these things
21: * are in bio.c.
22: */
23: struct buf
24: {
25: int b_flags; /* see defines below */
26: struct buf *b_forw; /* headed by d_tab of conf.c */
27: struct buf *b_back; /* " */
28: struct buf *av_forw; /* position on free list, */
29: struct buf *av_back; /* if not BUSY*/
30: dev_t b_dev; /* major+minor device name */
31: unsigned b_bcount; /* transfer count */
32: union {
33: caddr_t b_addr; /* low order core address */
34: int *b_words; /* words for clearing */
35: struct filsys *b_filsys; /* superblocks */
36: struct dinode *b_dino; /* ilist */
37: daddr_t *b_daddr; /* indirect block */
38: } b_un;
39: daddr_t b_blkno; /* block # on device */
40: char b_xmem; /* high order core address */
41: char b_error; /* returned after I/O */
42: unsigned int b_resid; /* words not transferred after error */
43: struct proc *b_proc; /* process doing physical or swap I/O */
44: };
45:
46: #ifdef KERNEL
47: extern struct buf buf[]; /* The buffer pool itself */
48: extern struct buf swbuf[]; /* swap I/O headers */
49: extern struct buf bfreelist; /* head of available list */
50: extern struct buf bswlist; /* head of free swap header list */
51: extern struct buf *bclnlist; /* head of cleaned page list */
52:
53: struct buf *alloc();
54: struct buf *baddr();
55: struct buf *getblk();
56: struct buf *geteblk();
57: struct buf *bread();
58: struct buf *breada();
59:
60: unsigned minphys();
61: #endif
62:
63: #define NSWBUF 32 /* number of swap I/O headers */
64:
65: /*
66: * These flags are kept in b_flags.
67: */
68: #define B_WRITE 0x0000 /* non-read pseudo-flag */
69: #define B_READ 0x0001 /* read when I/O occurs */
70: #define B_DONE 0x0002 /* transaction finished */
71: #define B_ERROR 0x0004 /* transaction aborted */
72: #define B_BUSY 0x0008 /* not on av_forw/back list */
73: #define B_PHYS 0x0010 /* Physical IO potentially using UNIBUS map */
74: #define B_MAP 0x0020 /* This block has the UNIBUS map allocated */
75: #define B_WANTED 0x0040 /* issue wakeup when BUSY goes off */
76: #define B_AGE 0x0080 /* delayed write for correct aging */
77: #define B_ASYNC 0x0100 /* don't wait for I/O completion */
78: #define B_DELWRI 0x0200 /* don't write till block leaves available list */
79: #define B_TAPE 0x0400 /* this is a magtape (no bdwrite) */
80: #define B_UAREA 0x0800 /* add u-area to a swap operation */
81: #define B_PAGET 0x1000 /* page in/out of page table space */
82: #define B_DIRTY 0x2000 /* dirty page to be pushed out async */
83: #define B_PGIN 0x4000 /* page in flag to swap(), for counting */
84:
85: /*
86: * special redeclarations for
87: * the head of the queue per
88: * device driver.
89: */
90: #define b_actf av_forw
91: #define b_actl av_back
92: #define b_active b_bcount
93: #define b_errcnt b_resid
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.