Commit | Line | Data |
---|---|---|
71da8ead | 1 | /* saio.h 6.2 %G% */ |
96dca2cc BJ |
2 | |
3 | /* | |
06397eef | 4 | * Header file for standalone package |
96dca2cc BJ |
5 | */ |
6 | ||
7 | /* | |
06397eef | 8 | * Io block: includes an |
96dca2cc BJ |
9 | * inode, cells for the use of seek, etc, |
10 | * and a buffer. | |
11 | */ | |
12 | struct iob { | |
06397eef SL |
13 | int i_flgs; /* see F_ below */ |
14 | struct inode i_ino; /* inode, if file */ | |
15 | int i_unit; /* pseudo device unit */ | |
16 | daddr_t i_boff; /* block offset on device */ | |
17 | daddr_t i_cyloff; /* cylinder offset on device */ | |
18 | off_t i_offset; /* seek offset in file */ | |
19 | daddr_t i_bn; /* 1st block # of next read */ | |
20 | char *i_ma; /* memory address of i/o buffer */ | |
21 | int i_cc; /* character count of transfer */ | |
22 | int i_error; /* error # return */ | |
23 | int i_errcnt; /* error count for driver retries */ | |
24 | int i_errblk; /* block # in error for error reporting */ | |
25 | char i_buf[MAXBSIZE];/* i/o buffer */ | |
cb31612d | 26 | union { |
06397eef | 27 | struct fs ui_fs; /* file system super block info */ |
cb31612d KM |
28 | char dummy[SBSIZE]; |
29 | } i_un; | |
96dca2cc | 30 | }; |
cb31612d | 31 | #define i_fs i_un.ui_fs |
e184e531 | 32 | #define NULL 0 |
96dca2cc | 33 | |
0839bdeb SL |
34 | #define F_READ 0x1 /* file opened for reading */ |
35 | #define F_WRITE 0x2 /* file opened for writing */ | |
36 | #define F_ALLOC 0x4 /* buffer allocated */ | |
37 | #define F_FILE 0x8 /* file instead of device */ | |
e184e531 | 38 | #define F_NBSF 0x10 /* no bad sector forwarding */ |
e63fbccd SL |
39 | #define F_ECCLM 0x20 /* limit # of bits in ecc correction */ |
40 | #define F_SSI 0x40 /* set skip sector inhibit */ | |
71da8ead | 41 | #define F_SEVRE 0x80 /* Severe burnin (no retries, no ECC) */ |
0839bdeb SL |
42 | /* io types */ |
43 | #define F_RDDATA 0x0100 /* read data */ | |
44 | #define F_WRDATA 0x0200 /* write data */ | |
45 | #define F_HDR 0x0400 /* include header on next i/o */ | |
46 | #define F_CHECK 0x0800 /* perform check of data read/write */ | |
47 | #define F_HCHECK 0x1000 /* perform check of header and data */ | |
48 | ||
49 | #define F_TYPEMASK 0xff00 | |
96dca2cc BJ |
50 | |
51 | /* | |
06397eef | 52 | * Device switch. |
96dca2cc BJ |
53 | */ |
54 | struct devsw { | |
55 | char *dv_name; | |
56 | int (*dv_strategy)(); | |
57 | int (*dv_open)(); | |
58 | int (*dv_close)(); | |
0839bdeb | 59 | int (*dv_ioctl)(); |
96dca2cc BJ |
60 | }; |
61 | ||
62 | struct devsw devsw[]; | |
63 | ||
e63fbccd SL |
64 | /* |
65 | * Drive description table. | |
66 | * Returned from SAIODEVDATA call. | |
67 | */ | |
be8e681f | 68 | struct st { |
e63fbccd | 69 | short nsect; /* # sectors/track */ |
06397eef | 70 | short ntrak; /* # tracks/surfaces/heads */ |
e63fbccd SL |
71 | short nspc; /* # sectors/cylinder */ |
72 | short ncyl; /* # cylinders */ | |
73 | short *off; /* partition offset table (cylinders) */ | |
e184e531 HS |
74 | }; |
75 | ||
96dca2cc | 76 | /* |
06397eef | 77 | * Request codes. Must be the same a F_XXX above |
96dca2cc BJ |
78 | */ |
79 | #define READ 1 | |
80 | #define WRITE 2 | |
81 | ||
82 | #define NBUFS 4 | |
83 | ||
cb31612d | 84 | char b[NBUFS][MAXBSIZE]; |
96dca2cc BJ |
85 | daddr_t blknos[NBUFS]; |
86 | ||
06397eef | 87 | #define NFILES 4 |
96dca2cc | 88 | struct iob iob[NFILES]; |
3d2087b6 | 89 | |
0839bdeb SL |
90 | extern int errno; /* just like unix */ |
91 | ||
92 | /* error codes */ | |
93 | #define EBADF 1 /* bad file descriptor */ | |
94 | #define EOFFSET 2 /* relative seek not supported */ | |
95 | #define EDEV 3 /* improper device specification on open */ | |
96 | #define ENXIO 4 /* unknown device specified */ | |
97 | #define EUNIT 5 /* improper unit specification */ | |
98 | #define ESRCH 6 /* directory search for file failed */ | |
99 | #define EIO 7 /* generic error */ | |
06397eef SL |
100 | #define ECMD 10 /* undefined driver command */ |
101 | #define EBSE 11 /* bad sector error */ | |
102 | #define EWCK 12 /* write check error */ | |
103 | #define EECC 13 /* uncorrectable ecc error */ | |
104 | #define EHER 14 /* hard error */ | |
0839bdeb SL |
105 | |
106 | /* ioctl's -- for disks just now */ | |
e184e531 | 107 | #define SAIOHDR (('d'<<8)|1) /* next i/o includes header */ |
0839bdeb SL |
108 | #define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */ |
109 | #define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */ | |
e184e531 | 110 | #define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector forwarding */ |
e63fbccd SL |
111 | #define SAIODOBAD (('d'<<8)|5) /* enable bad sector forwarding */ |
112 | #define SAIOECCLIM (('d'<<8)|6) /* limit ecc correction to 5 bits */ | |
e184e531 | 113 | #define SAIOECCUNL (('d'<<8)|7) /* use standard ecc procedures */ |
06397eef SL |
114 | #define SAIODEVDATA (('d'<<8)|8) /* get device data */ |
115 | #define SAIOSSI (('d'<<8)|9) /* set skip sector inhibit */ | |
116 | #define SAIONOSSI (('d'<<8)|10) /* inhibit skip sector handling */ | |
117 | #define SAIOSSDEV (('d'<<8)|11) /* is device skip sector type? */ | |
118 | #define SAIODEBUG (('d'<<8)|12) /* enable/disable debugging */ | |
71da8ead MK |
119 | #define SAIOSEVRE (('d'<<8)|13) /* severe burnin, no ECC, no retries */ |
120 | #define SAIONSEVRE (('d'<<8)|14) /* clear severe burnin */ | |
e184e531 HS |
121 | |
122 | /* codes for sector header word 1 */ | |
06397eef SL |
123 | #define HDR1_FMT22 0x1000 /* standard 16 bit format */ |
124 | #define HDR1_OKSCT 0xc000 /* sector ok */ | |
125 | #define HDR1_SSF 0x2000 /* skip sector flag */ |