xref: /original-bsd/sys/stand.att/saio.h (revision f1656be1)
1 /*
2  * Copyright (c) 1982, 1988 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)saio.h	7.8 (Berkeley) 03/02/88
7  */
8 
9 #include "saioctl.h"
10 #include "saerrno.h"
11 
12 #define	UNIX	"/vmunix"
13 #define	NULL	0
14 
15 /*
16  * Io block: includes an inode, cells for the use of seek, etc.,
17  * and a buffer.
18  */
19 struct iob {
20 	int	i_flgs;		/* see F_ below */
21 	int	i_adapt;	/* adapter */
22 	int	i_ctlr;		/* controller */
23 	int	i_unit;		/* pseudo device unit */
24 	int	i_part;		/* disk partition */
25 	daddr_t	i_boff;		/* block offset on device */
26 	struct	inode i_ino;	/* inode, if file */
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 */
36 	union {
37 		struct fs ui_fs;	/* file system super block info */
38 		char dummy[SBSIZE];
39 	} i_un;
40 };
41 #define	i_fs	i_un.ui_fs
42 
43 /* codes for sector header word 1 */
44 #define	HDR1_FMT22	0x1000	/* standard 16 bit format */
45 #define	HDR1_OKSCT	0xc000	/* sector ok */
46 #define	HDR1_SSF	0x2000	/* skip sector flag */
47 
48 #define	F_READ		0x1	/* file opened for reading */
49 #define	F_WRITE		0x2	/* file opened for writing */
50 #define	F_ALLOC		0x4	/* buffer allocated */
51 #define	F_FILE		0x8	/* file instead of device */
52 #define	F_NBSF		0x10	/* no bad sector forwarding */
53 #define	F_ECCLM		0x20	/* limit # of bits in ecc correction */
54 #define	F_SSI		0x40	/* set skip sector inhibit */
55 #define	F_SEVRE		0x80	/* Severe burnin (no retries, no ECC) */
56 
57 /* io types */
58 #define	F_RDDATA	0x0100	/* read data */
59 #define	F_WRDATA	0x0200	/* write data */
60 #define	F_HDR		0x0400	/* include header on next i/o */
61 #define	F_CHECK		0x0800	/* perform check of data read/write */
62 #define	F_HCHECK	0x1000	/* perform check of header and data */
63 
64 #define	F_TYPEMASK	0xff00
65 
66 /*
67  * Request codes. Must be the same as F_XXX above
68  */
69 #define	READ	F_READ
70 #define	WRITE	F_WRITE
71 
72 /*
73  * Lseek call.
74  */
75 #define	L_SET		0	/* absolute offset */
76 
77 /*
78  * Device switch.
79  */
80 struct devsw {
81 	char	*dv_name;
82 	int	(*dv_strategy)();
83 	int	(*dv_open)();
84 	int	(*dv_close)();
85 	int	(*dv_ioctl)();
86 };
87 
88 extern struct devsw devsw[];	/* device array */
89 extern int ndevs;		/* number of elements in devsw[] */
90 
91 #ifdef COMPAT_42
92 /*
93  * Old drive description table.
94  * still used by some drivers for now.
95  */
96 struct st {
97 	short	nsect;		/* # sectors/track */
98 	short	ntrak;		/* # tracks/surfaces/heads */
99 	short	nspc;		/* # sectors/cylinder */
100 	short	ncyl;		/* # cylinders */
101 	short	*off;		/* partition offset table (cylinders) */
102 };
103 #endif
104 
105 #define	NFILES	4
106 extern struct	iob iob[NFILES];
107