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 | * | |
172fa6ba | 6 | * @(#)saio.h 7.9 (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 */ |
172fa6ba | 21 | int i_adapt; /* adapter or bus */ |
676dba5d | 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 |
172fa6ba | 42 | #define i_bus i_adapt |
96dca2cc | 43 | |
13a5137f KB |
44 | /* codes for sector header word 1 */ |
45 | #define HDR1_FMT22 0x1000 /* standard 16 bit format */ | |
46 | #define HDR1_OKSCT 0xc000 /* sector ok */ | |
47 | #define HDR1_SSF 0x2000 /* skip sector flag */ | |
48 | ||
735671c4 KB |
49 | #define F_READ 0x1 /* file opened for reading */ |
50 | #define F_WRITE 0x2 /* file opened for writing */ | |
51 | #define F_ALLOC 0x4 /* buffer allocated */ | |
52 | #define F_FILE 0x8 /* file instead of device */ | |
53 | #define F_NBSF 0x10 /* no bad sector forwarding */ | |
7ccf5b72 | 54 | #define F_ECCLM 0x20 /* limit # of bits in ecc correction */ |
735671c4 | 55 | #define F_SSI 0x40 /* set skip sector inhibit */ |
7ccf5b72 | 56 | #define F_SEVRE 0x80 /* Severe burnin (no retries, no ECC) */ |
676dba5d | 57 | |
0839bdeb SL |
58 | /* io types */ |
59 | #define F_RDDATA 0x0100 /* read data */ | |
60 | #define F_WRDATA 0x0200 /* write data */ | |
735671c4 KB |
61 | #define F_HDR 0x0400 /* include header on next i/o */ |
62 | #define F_CHECK 0x0800 /* perform check of data read/write */ | |
63 | #define F_HCHECK 0x1000 /* perform check of header and data */ | |
0839bdeb SL |
64 | |
65 | #define F_TYPEMASK 0xff00 | |
96dca2cc | 66 | |
735671c4 KB |
67 | /* |
68 | * Request codes. Must be the same as F_XXX above | |
69 | */ | |
70 | #define READ F_READ | |
71 | #define WRITE F_WRITE | |
72 | ||
676dba5d KB |
73 | /* |
74 | * Lseek call. | |
75 | */ | |
76 | #define L_SET 0 /* absolute offset */ | |
77 | ||
96dca2cc | 78 | /* |
06397eef | 79 | * Device switch. |
96dca2cc BJ |
80 | */ |
81 | struct devsw { | |
82 | char *dv_name; | |
83 | int (*dv_strategy)(); | |
84 | int (*dv_open)(); | |
85 | int (*dv_close)(); | |
0839bdeb | 86 | int (*dv_ioctl)(); |
96dca2cc BJ |
87 | }; |
88 | ||
735671c4 KB |
89 | extern struct devsw devsw[]; /* device array */ |
90 | extern int ndevs; /* number of elements in devsw[] */ | |
e184e531 | 91 | |
9e58065e MK |
92 | #ifdef COMPAT_42 |
93 | /* | |
94 | * Old drive description table. | |
95 | * still used by some drivers for now. | |
96 | */ | |
97 | struct st { | |
98 | short nsect; /* # sectors/track */ | |
99 | short ntrak; /* # tracks/surfaces/heads */ | |
100 | short nspc; /* # sectors/cylinder */ | |
101 | short ncyl; /* # cylinders */ | |
102 | short *off; /* partition offset table (cylinders) */ | |
103 | }; | |
104 | #endif | |
105 | ||
06397eef | 106 | #define NFILES 4 |
735671c4 | 107 | extern struct iob iob[NFILES]; |