xref: /original-bsd/sys/stand.att/saio.h (revision a9392a99)
1 /*
2  * Copyright (c) 1982, 1988 The Regents of the University of California.
3  * All rights reserved.
4  *
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.14 (Berkeley) 04/04/90
18  */
19 
20 #include "../ufs/fs.h"
21 #include "../ufs/dinode.h"
22 #include "saioctl.h"
23 #include "saerrno.h"
24 
25 #define	UNIX	"/vmunix"
26 #define	NULL	0
27 
28 /*
29  * Io block: includes an dinode, cells for the use of seek, etc.,
30  * and a buffer.
31  */
32 struct iob {
33 	int	i_flgs;		/* see F_ below */
34 	int	i_adapt;	/* adapter or bus */
35 	int	i_ctlr;		/* controller */
36 	int	i_unit;		/* pseudo device unit */
37 	int	i_part;		/* disk partition */
38 	daddr_t	i_boff;		/* block offset on device */
39 	struct	dinode i_ino;	/* dinode, if file */
40 	daddr_t	i_cyloff;	/* cylinder offset on device */
41 	off_t	i_offset;	/* seek offset in file */
42 	dev_t	i_dev;		/* associated device */
43 	daddr_t	i_bn;		/* 1st block # of next read */
44 	char	*i_ma;		/* memory address of i/o buffer */
45 	int	i_cc;		/* character count of transfer */
46 	int	i_error;	/* error # return */
47 	int	i_errcnt;	/* error count for driver retries */
48 	int	i_errblk;	/* block # in error for error reporting */
49 	char	i_buf[MAXBSIZE];/* i/o buffer */
50 	union {
51 		struct fs ui_fs;	/* file system super block info */
52 		char dummy[SBSIZE];
53 	} i_un;
54 };
55 
56 #define	i_fs	i_un.ui_fs
57 #define	i_bus	i_adapt
58 
59 /* codes for sector header word 1 */
60 #define	HDR1_FMT22	0x1000	/* standard 16 bit format */
61 #define	HDR1_OKSCT	0xc000	/* sector ok */
62 #define	HDR1_SSF	0x2000	/* skip sector flag */
63 
64 #define	F_READ		0x0001	/* file opened for reading */
65 #define	F_WRITE		0x0002	/* file opened for writing */
66 #define	F_ALLOC		0x0004	/* buffer allocated */
67 #define	F_FILE		0x0008	/* file instead of device */
68 #define	F_NBSF		0x0010	/* no bad sector forwarding */
69 #define	F_ECCLM		0x0020	/* limit # of bits in ecc correction */
70 #define	F_SSI		0x0040	/* set skip sector inhibit */
71 #define	F_SEVRE		0x0080	/* Severe burnin (no retries, no ECC) */
72 
73 /* io types */
74 #define	F_RDDATA	0x0100	/* read data */
75 #define	F_WRDATA	0x0200	/* write data */
76 #define	F_HDR		0x0400	/* include header on next i/o */
77 #define	F_CHECK		0x0800	/* perform check of data read/write */
78 #define	F_HCHECK	0x1000	/* perform check of header and data */
79 
80 #define	F_TYPEMASK	0xff00
81 
82 #define	READ	F_READ
83 #define	WRITE	F_WRITE
84 
85 /*
86  * Lseek call.
87  */
88 #define	L_SET		0	/* absolute offset */
89 
90 /*
91  * Device switch.
92  */
93 struct devsw {
94 	char	*dv_name;
95 	int	(*dv_strategy)();
96 	int	(*dv_open)();
97 	int	(*dv_close)();
98 	int	(*dv_ioctl)();
99 };
100 
101 extern struct devsw devsw[];	/* device array */
102 extern int ndevs;		/* number of elements in devsw[] */
103 
104 #ifdef COMPAT_42
105 /*
106  * Old drive description table.
107  * still used by some drivers for now.
108  */
109 struct st {
110 	short	nsect;		/* # sectors/track */
111 	short	ntrak;		/* # tracks/surfaces/heads */
112 	short	nspc;		/* # sectors/cylinder */
113 	short	ncyl;		/* # cylinders */
114 	short	*off;		/* partition offset table (cylinders) */
115 };
116 #endif
117 
118 #define	NFILES	4
119 extern struct	iob iob[NFILES];
120