Commit | Line | Data |
---|---|---|
e184e531 | 1 | /* saio.h 4.8 %G% */ |
96dca2cc BJ |
2 | |
3 | /* | |
4 | * header file for standalone package | |
5 | */ | |
6 | ||
7 | /* | |
8 | * io block: includes an | |
9 | * inode, cells for the use of seek, etc, | |
10 | * and a buffer. | |
11 | */ | |
12 | struct iob { | |
0839bdeb | 13 | int i_flgs; |
96dca2cc BJ |
14 | struct inode i_ino; |
15 | int i_unit; | |
16 | daddr_t i_boff; | |
17 | daddr_t i_cyloff; | |
18 | off_t i_offset; | |
19 | daddr_t i_bn; | |
20 | char *i_ma; | |
21 | int i_cc; | |
0839bdeb SL |
22 | int i_error; |
23 | int i_errcnt; | |
e184e531 | 24 | int i_errblk; |
0839bdeb | 25 | int i_active; |
cb31612d KM |
26 | char i_buf[MAXBSIZE]; |
27 | union { | |
28 | struct fs ui_fs; | |
29 | char dummy[SBSIZE]; | |
30 | } i_un; | |
96dca2cc | 31 | }; |
cb31612d | 32 | #define i_fs i_un.ui_fs |
e184e531 | 33 | #define NULL 0 |
96dca2cc | 34 | |
0839bdeb SL |
35 | #define F_READ 0x1 /* file opened for reading */ |
36 | #define F_WRITE 0x2 /* file opened for writing */ | |
37 | #define F_ALLOC 0x4 /* buffer allocated */ | |
38 | #define F_FILE 0x8 /* file instead of device */ | |
e184e531 HS |
39 | #define F_NBSF 0x10 /* no bad sector forwarding */ |
40 | #define F_ECCLM 0x20 /* limit the number of bad bits accepted in ecc's */ | |
0839bdeb SL |
41 | /* io types */ |
42 | #define F_RDDATA 0x0100 /* read data */ | |
43 | #define F_WRDATA 0x0200 /* write data */ | |
44 | #define F_HDR 0x0400 /* include header on next i/o */ | |
45 | #define F_CHECK 0x0800 /* perform check of data read/write */ | |
46 | #define F_HCHECK 0x1000 /* perform check of header and data */ | |
47 | ||
48 | #define F_TYPEMASK 0xff00 | |
96dca2cc BJ |
49 | |
50 | /* | |
51 | * dev switch | |
52 | */ | |
53 | struct devsw { | |
54 | char *dv_name; | |
55 | int (*dv_strategy)(); | |
56 | int (*dv_open)(); | |
57 | int (*dv_close)(); | |
0839bdeb | 58 | int (*dv_ioctl)(); |
96dca2cc BJ |
59 | }; |
60 | ||
61 | struct devsw devsw[]; | |
62 | ||
e184e531 HS |
63 | /* |
64 | * device data structure, | |
65 | * used by the ioctl-command SAIODEVDATA ( for disks only) | |
66 | */ | |
67 | ||
68 | struct devdata { | |
69 | int nsect; /* number of sectors per track */ | |
70 | int ntrak; /* number of tracks/surfaces/heads... */ | |
71 | int nspc; /* number of sectors per cylinder */ | |
72 | int ncyl; /* number of cylinders */ | |
73 | }; | |
74 | ||
96dca2cc BJ |
75 | /* |
76 | * request codes. Must be the same a F_XXX above | |
77 | */ | |
78 | #define READ 1 | |
79 | #define WRITE 2 | |
80 | ||
81 | #define NBUFS 4 | |
82 | ||
cb31612d | 83 | char b[NBUFS][MAXBSIZE]; |
96dca2cc BJ |
84 | daddr_t blknos[NBUFS]; |
85 | ||
86 | #define NFILES 4 | |
87 | struct iob iob[NFILES]; | |
3d2087b6 KM |
88 | |
89 | #define PHYSUBA0 0x20006000 | |
90 | #define PHYSMBA0 0x20010000 | |
91 | #define PHYSMBA1 0x20012000 | |
92 | #define PHYSUMEM 0x2013e000 | |
0839bdeb SL |
93 | |
94 | extern int errno; /* just like unix */ | |
95 | ||
96 | /* error codes */ | |
97 | #define EBADF 1 /* bad file descriptor */ | |
98 | #define EOFFSET 2 /* relative seek not supported */ | |
99 | #define EDEV 3 /* improper device specification on open */ | |
100 | #define ENXIO 4 /* unknown device specified */ | |
101 | #define EUNIT 5 /* improper unit specification */ | |
102 | #define ESRCH 6 /* directory search for file failed */ | |
103 | #define EIO 7 /* generic error */ | |
104 | #define ECMD 10 /* undefined driver command */ | |
105 | #define EBSE 11 /* bad sector error */ | |
106 | #define EWCK 12 /* write check error */ | |
107 | #define EHER 13 /* hard error */ | |
108 | #define EECC 14 /* severe ecc error, sector recorded as bad*/ | |
109 | ||
110 | /* ioctl's -- for disks just now */ | |
e184e531 | 111 | #define SAIOHDR (('d'<<8)|1) /* next i/o includes header */ |
0839bdeb SL |
112 | #define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */ |
113 | #define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */ | |
e184e531 HS |
114 | #define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector forwarding */ |
115 | #define SAIODOBAD (('d'<<8)|5) /* do bad sector forwarding */ | |
116 | #define SAIOECCLIM (('d'<<8)|6) /* report sectors as bad if more than | |
117 | * 5 bits are bad in ecc */ | |
118 | #define SAIOECCUNL (('d'<<8)|7) /* use standard ecc procedures */ | |
119 | #define SAIODEVDATA (('d'<<8)|8) /* get device data */ | |
120 | ||
121 | /* codes for sector header word 1 */ | |
122 | #define HDR1_FMT22 0x1000 /* standard 16 bit format */ | |
123 | #define HDR1_OKSCT 0xc000 /* sector ok */ |