Commit | Line | Data |
---|---|---|
da7c5cc6 | 1 | /* |
735671c4 | 2 | * Copyright (c) 1982, 1988 Regents of the University of California. |
da7c5cc6 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
13a5137f | 6 | * @(#)saio.h 7.8 (Berkeley) %G% |
96dca2cc BJ |
7 | */ |
8 | ||
735671c4 | 9 | #include "saioctl.h" |
676dba5d KB |
10 | #include "saerrno.h" |
11 | ||
12 | #define UNIX "/vmunix" | |
735671c4 | 13 | #define NULL 0 |
676dba5d | 14 | |
96dca2cc | 15 | /* |
676dba5d | 16 | * Io block: includes an inode, cells for the use of seek, etc., |
96dca2cc BJ |
17 | * and a buffer. |
18 | */ | |
735671c4 | 19 | struct iob { |
06397eef | 20 | int i_flgs; /* see F_ below */ |
676dba5d KB |
21 | int i_adapt; /* adapter */ |
22 | int i_ctlr; /* controller */ | |
06397eef | 23 | int i_unit; /* pseudo device unit */ |
676dba5d | 24 | int i_part; /* disk partition */ |
06397eef | 25 | daddr_t i_boff; /* block offset on device */ |
676dba5d | 26 | struct inode i_ino; /* inode, if file */ |
06397eef SL |
27 | daddr_t i_cyloff; /* cylinder offset on device */ |
28 | off_t i_offset; /* seek offset in file */ | |
29 | daddr_t i_bn; /* 1st block # of next read */ | |
30 | char *i_ma; /* memory address of i/o buffer */ | |
31 | int i_cc; /* character count of transfer */ | |
32 | int i_error; /* error # return */ | |
33 | int i_errcnt; /* error count for driver retries */ | |
34 | int i_errblk; /* block # in error for error reporting */ | |
35 | char i_buf[MAXBSIZE];/* i/o buffer */ | |
cb31612d | 36 | union { |
06397eef | 37 | struct fs ui_fs; /* file system super block info */ |
cb31612d KM |
38 | char dummy[SBSIZE]; |
39 | } i_un; | |
96dca2cc | 40 | }; |
735671c4 | 41 | #define i_fs i_un.ui_fs |
96dca2cc | 42 | |
13a5137f KB |
43 | /* codes for sector header word 1 */ |
44 | #define HDR1_FMT22 0x1000 /* standard 16 bit format */ | |
45 | #define HDR1_OKSCT 0xc000 /* sector ok */ | |
46 | #define HDR1_SSF 0x2000 /* skip sector flag */ | |
47 | ||
735671c4 KB |
48 | #define F_READ 0x1 /* file opened for reading */ |
49 | #define F_WRITE 0x2 /* file opened for writing */ | |
50 | #define F_ALLOC 0x4 /* buffer allocated */ | |
51 | #define F_FILE 0x8 /* file instead of device */ | |
52 | #define F_NBSF 0x10 /* no bad sector forwarding */ | |
7ccf5b72 | 53 | #define F_ECCLM 0x20 /* limit # of bits in ecc correction */ |
735671c4 | 54 | #define F_SSI 0x40 /* set skip sector inhibit */ |
7ccf5b72 | 55 | #define F_SEVRE 0x80 /* Severe burnin (no retries, no ECC) */ |
676dba5d | 56 | |
0839bdeb SL |
57 | /* io types */ |
58 | #define F_RDDATA 0x0100 /* read data */ | |
59 | #define F_WRDATA 0x0200 /* write data */ | |
735671c4 KB |
60 | #define F_HDR 0x0400 /* include header on next i/o */ |
61 | #define F_CHECK 0x0800 /* perform check of data read/write */ | |
62 | #define F_HCHECK 0x1000 /* perform check of header and data */ | |
0839bdeb SL |
63 | |
64 | #define F_TYPEMASK 0xff00 | |
96dca2cc | 65 | |
735671c4 KB |
66 | /* |
67 | * Request codes. Must be the same as F_XXX above | |
68 | */ | |
69 | #define READ F_READ | |
70 | #define WRITE F_WRITE | |
71 | ||
676dba5d KB |
72 | /* |
73 | * Lseek call. | |
74 | */ | |
75 | #define L_SET 0 /* absolute offset */ | |
76 | ||
96dca2cc | 77 | /* |
06397eef | 78 | * Device switch. |
96dca2cc BJ |
79 | */ |
80 | struct devsw { | |
81 | char *dv_name; | |
82 | int (*dv_strategy)(); | |
83 | int (*dv_open)(); | |
84 | int (*dv_close)(); | |
0839bdeb | 85 | int (*dv_ioctl)(); |
96dca2cc BJ |
86 | }; |
87 | ||
735671c4 KB |
88 | extern struct devsw devsw[]; /* device array */ |
89 | extern int ndevs; /* number of elements in devsw[] */ | |
e184e531 | 90 | |
9e58065e MK |
91 | #ifdef COMPAT_42 |
92 | /* | |
93 | * Old drive description table. | |
94 | * still used by some drivers for now. | |
95 | */ | |
96 | struct st { | |
97 | short nsect; /* # sectors/track */ | |
98 | short ntrak; /* # tracks/surfaces/heads */ | |
99 | short nspc; /* # sectors/cylinder */ | |
100 | short ncyl; /* # cylinders */ | |
101 | short *off; /* partition offset table (cylinders) */ | |
102 | }; | |
103 | #endif | |
104 | ||
06397eef | 105 | #define NFILES 4 |
735671c4 | 106 | extern struct iob iob[NFILES]; |