Commit | Line | Data |
---|---|---|
da7c5cc6 | 1 | /* |
2680e07a KB |
2 | * Copyright (c) 1982, 1988 The Regents of the University of California. |
3 | * All rights reserved. | |
da7c5cc6 | 4 | * |
2680e07a KB |
5 | * Redistribution and use in source and binary forms are permitted |
6 | * provided that the above copyright notice and this paragraph are | |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
16 | * | |
17 | * @(#)saio.h 7.10 (Berkeley) %G% | |
96dca2cc BJ |
18 | */ |
19 | ||
735671c4 | 20 | #include "saioctl.h" |
676dba5d KB |
21 | #include "saerrno.h" |
22 | ||
23 | #define UNIX "/vmunix" | |
735671c4 | 24 | #define NULL 0 |
676dba5d | 25 | |
96dca2cc | 26 | /* |
676dba5d | 27 | * Io block: includes an inode, cells for the use of seek, etc., |
96dca2cc BJ |
28 | * and a buffer. |
29 | */ | |
735671c4 | 30 | struct iob { |
06397eef | 31 | int i_flgs; /* see F_ below */ |
172fa6ba | 32 | int i_adapt; /* adapter or bus */ |
676dba5d | 33 | int i_ctlr; /* controller */ |
06397eef | 34 | int i_unit; /* pseudo device unit */ |
676dba5d | 35 | int i_part; /* disk partition */ |
06397eef | 36 | daddr_t i_boff; /* block offset on device */ |
676dba5d | 37 | struct inode i_ino; /* inode, if file */ |
06397eef SL |
38 | daddr_t i_cyloff; /* cylinder offset on device */ |
39 | off_t i_offset; /* seek offset in file */ | |
40 | daddr_t i_bn; /* 1st block # of next read */ | |
41 | char *i_ma; /* memory address of i/o buffer */ | |
42 | int i_cc; /* character count of transfer */ | |
43 | int i_error; /* error # return */ | |
44 | int i_errcnt; /* error count for driver retries */ | |
45 | int i_errblk; /* block # in error for error reporting */ | |
46 | char i_buf[MAXBSIZE];/* i/o buffer */ | |
cb31612d | 47 | union { |
06397eef | 48 | struct fs ui_fs; /* file system super block info */ |
cb31612d KM |
49 | char dummy[SBSIZE]; |
50 | } i_un; | |
96dca2cc | 51 | }; |
2680e07a | 52 | |
735671c4 | 53 | #define i_fs i_un.ui_fs |
172fa6ba | 54 | #define i_bus i_adapt |
96dca2cc | 55 | |
13a5137f KB |
56 | /* codes for sector header word 1 */ |
57 | #define HDR1_FMT22 0x1000 /* standard 16 bit format */ | |
58 | #define HDR1_OKSCT 0xc000 /* sector ok */ | |
59 | #define HDR1_SSF 0x2000 /* skip sector flag */ | |
60 | ||
2680e07a KB |
61 | #define F_READ 0x0001 /* file opened for reading */ |
62 | #define F_WRITE 0x0002 /* file opened for writing */ | |
63 | #define F_ALLOC 0x0004 /* buffer allocated */ | |
64 | #define F_FILE 0x0008 /* file instead of device */ | |
65 | #define F_NBSF 0x0010 /* no bad sector forwarding */ | |
66 | #define F_ECCLM 0x0020 /* limit # of bits in ecc correction */ | |
67 | #define F_SSI 0x0040 /* set skip sector inhibit */ | |
68 | #define F_SEVRE 0x0080 /* Severe burnin (no retries, no ECC) */ | |
676dba5d | 69 | |
0839bdeb SL |
70 | /* io types */ |
71 | #define F_RDDATA 0x0100 /* read data */ | |
72 | #define F_WRDATA 0x0200 /* write data */ | |
735671c4 KB |
73 | #define F_HDR 0x0400 /* include header on next i/o */ |
74 | #define F_CHECK 0x0800 /* perform check of data read/write */ | |
75 | #define F_HCHECK 0x1000 /* perform check of header and data */ | |
0839bdeb SL |
76 | |
77 | #define F_TYPEMASK 0xff00 | |
96dca2cc | 78 | |
735671c4 KB |
79 | #define READ F_READ |
80 | #define WRITE F_WRITE | |
81 | ||
676dba5d KB |
82 | /* |
83 | * Lseek call. | |
84 | */ | |
85 | #define L_SET 0 /* absolute offset */ | |
86 | ||
96dca2cc | 87 | /* |
06397eef | 88 | * Device switch. |
96dca2cc BJ |
89 | */ |
90 | struct devsw { | |
91 | char *dv_name; | |
92 | int (*dv_strategy)(); | |
93 | int (*dv_open)(); | |
94 | int (*dv_close)(); | |
0839bdeb | 95 | int (*dv_ioctl)(); |
96dca2cc BJ |
96 | }; |
97 | ||
735671c4 KB |
98 | extern struct devsw devsw[]; /* device array */ |
99 | extern int ndevs; /* number of elements in devsw[] */ | |
e184e531 | 100 | |
9e58065e MK |
101 | #ifdef COMPAT_42 |
102 | /* | |
103 | * Old drive description table. | |
104 | * still used by some drivers for now. | |
105 | */ | |
106 | struct st { | |
107 | short nsect; /* # sectors/track */ | |
108 | short ntrak; /* # tracks/surfaces/heads */ | |
109 | short nspc; /* # sectors/cylinder */ | |
110 | short ncyl; /* # cylinders */ | |
111 | short *off; /* partition offset table (cylinders) */ | |
112 | }; | |
113 | #endif | |
114 | ||
06397eef | 115 | #define NFILES 4 |
735671c4 | 116 | extern struct iob iob[NFILES]; |