|
|
1.1 root 1: /* (-lgl
2: * COHERENT Version 4.0
3: * Copyright (c) 1982, 1992 by Mark Williams Company.
4: * All rights reserved. May not be copied without permission.
5: -lgl) */
6: /*
7: * /usr/include/sys/buf.h
8: *
9: * Buffer header.
10: *
11: * Revised: Wed Apr 7 15:05:36 1993 CDT
12: */
13: #ifndef __SYS_BUF_H__
14: #define __SYS_BUF_H__
15:
16: #include <common/feature.h>
17: #include <common/__paddr.h>
18: #include <sys/types.h>
19: #include <sys/ksynch.h>
20:
21: #if ! __KERNEL__
22: # error You must be compiling the kernel to use this header!
23: #endif
24:
25: typedef struct buf {
26: struct buf *b_actf; /* First in queue */
27: struct buf *b_actl; /* Last in queue */
28: GATE b_gate; /* Gate */
29: unsigned b_flag; /* Flags */
30: dev_t b_dev; /* Device */
31: daddr_t b_bno; /* Block number */
32: char b_req; /* I/O type */
33: char b_err; /* Error */
34: unsigned b_seqn; /* Buffer sequence number */
35: #if ! _I386
36: bold_t b_map; /* Old map */
37: vaddr_t b_count; /* Size of I/O */
38: vaddr_t b_resid; /* Driver returns count here */
39: faddr_t b_faddr; /* Far Virtual address */
40: __paddr_t b_paddr; /* Physical address */
41: #else /* if _I386 */
42: off_t b_count; /* Size of I/O */
43: off_t b_resid; /* Driver returns count here */
44: __paddr_t b_paddr; /* physical address (bytes) */
45: caddr_t b_vaddr; /* kernel virtual address (bytes) */
46: unsigned long b_hashval; /* used to index into hasharray[] */
47: struct buf *b_LRUf; /* Next (older) in LRU chain */
48: struct buf *b_LRUb; /* Previous (newer) in LRU chain */
49: struct buf *b_hashf; /* Next in this hash chain */
50: struct buf *b_hashb; /* Previous in this hash chain */
51: #endif /* _I386 */
52: } BUF;
53:
54: /*
55: * Flags (b_flags).
56: */
57: #define BFNTP 0x0001 /* Buffer not valid */
58: #define BFERR 0x0004 /* Error */
59: #define BFMOD 0x0008 /* Data has been modified */
60: #define BFASY 0x0010 /* Asynchrous */
61: #define BFMAP 0x0020 /* Buffer has been mapped */
62: #define BFRAW 0x0040 /* Request is raw */
63: #define BFTAP 0x0080 /* Request is to a tape */
64:
65: #define BFBLK 0x4000 /* Aligned on a block boundary */
66: #define BFIOC 0x8000 /* Perform bounds checking */
67:
68: /*
69: * Requests.
70: */
71: #define BREAD 1 /* Read */
72: #define BWRITE 2 /* Write */
73: /* sad but true, floppy driver uses these: */
74: #define BFLSTAT 3 /* Floppy Drive Status */
75: #define BFLFMT 4 /* Floppy Disk Format */
76:
77: #define BNULL ((BUF *)0)
78:
79: /*
80: * Functions.
81: */
82: extern BUF *bread(); /* bio.c */
83: extern BUF *bclaim(); /* bio.c */
84: extern BUF *vread(); /* fs3.c */
85: extern BUF *aread(); /* fs3.c */
86:
87: /*
88: * Global variables.
89: */
90: extern unsigned bufseqn; /* Buffer sequencer */
91: extern int bufneed; /* Buffer is needed */
92: extern BUF swapbuf; /* Buffer for swap I/O */
93: extern BUF *bufl; /* Buffer headers */
94:
95: /*
96: * Flags for 3rd argument to bclaim () and bread ().
97: */
98:
99: enum {
100: BUF_SYNC,
101: BUF_ASYNC
102: };
103:
104: #endif /* ! defined (__SYS_BUF_H__) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.