Commit | Line | Data |
---|---|---|
9b518d2c KB |
1 | /*- |
2 | * Copyright (c) 1982, 1988, 1991 The Regents of the University of California. | |
2680e07a | 3 | * All rights reserved. |
da7c5cc6 | 4 | * |
bf131693 | 5 | * %sccs.include.redist.c% |
2680e07a | 6 | * |
38a01dbe | 7 | * @(#)saio.h 7.19 (Berkeley) %G% |
96dca2cc BJ |
8 | */ |
9 | ||
bbba0445 | 10 | #include <sys/time.h> |
38a01dbe | 11 | |
d8c95a01 KS |
12 | #include <ufs/ffs/fs.h> |
13 | #include <ufs/ufs/dinode.h> | |
38a01dbe KB |
14 | |
15 | #include <stand/saioctl.h> | |
16 | #include <stand/saerrno.h> | |
676dba5d | 17 | |
1ee763e9 | 18 | #define UNIX "/vmunix" |
9b518d2c KB |
19 | |
20 | #ifndef NULL | |
735671c4 | 21 | #define NULL 0 |
9b518d2c | 22 | #endif |
676dba5d | 23 | |
9b518d2c | 24 | /* I/O block */ |
735671c4 | 25 | struct iob { |
9b518d2c | 26 | int i_flgs; /* flags (see F_*) */ |
172fa6ba | 27 | int i_adapt; /* adapter or bus */ |
676dba5d | 28 | int i_ctlr; /* controller */ |
06397eef | 29 | int i_unit; /* pseudo device unit */ |
676dba5d | 30 | int i_part; /* disk partition */ |
06397eef SL |
31 | daddr_t i_boff; /* block offset on device */ |
32 | daddr_t i_cyloff; /* cylinder offset on device */ | |
33 | off_t i_offset; /* seek offset in file */ | |
c00c9a60 | 34 | dev_t i_dev; /* associated device */ |
06397eef | 35 | daddr_t i_bn; /* 1st block # of next read */ |
9b518d2c | 36 | char *i_ma; /* memory address of I/O buffer */ |
06397eef SL |
37 | int i_cc; /* character count of transfer */ |
38 | int i_error; /* error # return */ | |
39 | int i_errcnt; /* error count for driver retries */ | |
40 | int i_errblk; /* block # in error for error reporting */ | |
9b518d2c KB |
41 | char i_buf[MAXBSIZE];/* I/O buffer */ |
42 | struct dinode i_ino; /* dinode, if file */ | |
43 | union { /* file system super block info */ | |
44 | struct fs ui_fs; | |
cb31612d KM |
45 | char dummy[SBSIZE]; |
46 | } i_un; | |
735671c4 | 47 | #define i_fs i_un.ui_fs |
172fa6ba | 48 | #define i_bus i_adapt |
9b518d2c KB |
49 | }; |
50 | ||
51 | #define SOPEN_MAX 4 | |
52 | extern struct iob iob[SOPEN_MAX]; | |
96dca2cc | 53 | |
9b518d2c | 54 | /* Codes for sector header word 1 */ |
13a5137f KB |
55 | #define HDR1_FMT22 0x1000 /* standard 16 bit format */ |
56 | #define HDR1_OKSCT 0xc000 /* sector ok */ | |
57 | #define HDR1_SSF 0x2000 /* skip sector flag */ | |
58 | ||
9b518d2c | 59 | /* I/O flag values */ |
2680e07a KB |
60 | #define F_READ 0x0001 /* file opened for reading */ |
61 | #define F_WRITE 0x0002 /* file opened for writing */ | |
62 | #define F_ALLOC 0x0004 /* buffer allocated */ | |
63 | #define F_FILE 0x0008 /* file instead of device */ | |
64 | #define F_NBSF 0x0010 /* no bad sector forwarding */ | |
65 | #define F_ECCLM 0x0020 /* limit # of bits in ecc correction */ | |
66 | #define F_SSI 0x0040 /* set skip sector inhibit */ | |
67 | #define F_SEVRE 0x0080 /* Severe burnin (no retries, no ECC) */ | |
676dba5d | 68 | |
9b518d2c | 69 | /* I/O types */ |
0839bdeb SL |
70 | #define F_RDDATA 0x0100 /* read data */ |
71 | #define F_WRDATA 0x0200 /* write data */ | |
735671c4 KB |
72 | #define F_HDR 0x0400 /* include header on next i/o */ |
73 | #define F_CHECK 0x0800 /* perform check of data read/write */ | |
74 | #define F_HCHECK 0x1000 /* perform check of header and data */ | |
0839bdeb | 75 | |
9b518d2c | 76 | #define F_TYPEMASK 0xff00 /* I/O type mask */ |
96dca2cc | 77 | |
9b518d2c | 78 | /* Lseek values */ |
676dba5d KB |
79 | #define L_SET 0 /* absolute offset */ |
80 | ||
9b518d2c | 81 | /* Device switch */ |
96dca2cc BJ |
82 | struct devsw { |
83 | char *dv_name; | |
84 | int (*dv_strategy)(); | |
85 | int (*dv_open)(); | |
86 | int (*dv_close)(); | |
0839bdeb | 87 | int (*dv_ioctl)(); |
96dca2cc BJ |
88 | }; |
89 | ||
735671c4 KB |
90 | extern struct devsw devsw[]; /* device array */ |
91 | extern int ndevs; /* number of elements in devsw[] */ | |
e184e531 | 92 | |
9e58065e MK |
93 | #ifdef COMPAT_42 |
94 | /* | |
95 | * Old drive description table. | |
96 | * still used by some drivers for now. | |
97 | */ | |
98 | struct st { | |
99 | short nsect; /* # sectors/track */ | |
100 | short ntrak; /* # tracks/surfaces/heads */ | |
101 | short nspc; /* # sectors/cylinder */ | |
102 | short ncyl; /* # cylinders */ | |
103 | short *off; /* partition offset table (cylinders) */ | |
104 | }; | |
105 | #endif |