xref: /original-bsd/sys/stand.att/saio.h (revision 8cec2420)
1 /*	saio.h	6.2	09/23/83	*/
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 {
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 */
26 	union {
27 		struct fs ui_fs;	/* file system super block info */
28 		char dummy[SBSIZE];
29 	} i_un;
30 };
31 #define i_fs i_un.ui_fs
32 #define NULL 0
33 
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 */
38 #define F_NBSF		0x10	/* no bad sector forwarding */
39 #define F_ECCLM		0x20	/* limit # of bits in ecc correction */
40 #define F_SSI		0x40	/* set skip sector inhibit */
41 #define F_SEVRE		0x80	/* Severe burnin (no retries, no ECC) */
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
50 
51 /*
52  * Device switch.
53  */
54 struct devsw {
55 	char	*dv_name;
56 	int	(*dv_strategy)();
57 	int	(*dv_open)();
58 	int	(*dv_close)();
59 	int	(*dv_ioctl)();
60 };
61 
62 struct devsw devsw[];
63 
64 /*
65  * Drive description table.
66  * Returned from SAIODEVDATA call.
67  */
68 struct st {
69 	short	nsect;		/* # sectors/track */
70 	short	ntrak;		/* # tracks/surfaces/heads */
71 	short	nspc;		/* # sectors/cylinder */
72 	short	ncyl;		/* # cylinders */
73 	short	*off;		/* partition offset table (cylinders) */
74 };
75 
76 /*
77  * Request codes. Must be the same a F_XXX above
78  */
79 #define	READ	1
80 #define	WRITE	2
81 
82 #define	NBUFS	4
83 
84 char	b[NBUFS][MAXBSIZE];
85 daddr_t	blknos[NBUFS];
86 
87 #define	NFILES	4
88 struct	iob iob[NFILES];
89 
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 */
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 */
105 
106 /* ioctl's -- for disks just now */
107 #define	SAIOHDR		(('d'<<8)|1)	/* next i/o includes header */
108 #define	SAIOCHECK	(('d'<<8)|2)	/* next i/o checks data */
109 #define	SAIOHCHECK	(('d'<<8)|3)	/* next i/o checks header & data */
110 #define	SAIONOBAD	(('d'<<8)|4)	/* inhibit bad sector forwarding */
111 #define	SAIODOBAD	(('d'<<8)|5)	/* enable bad sector forwarding */
112 #define	SAIOECCLIM	(('d'<<8)|6)	/* limit ecc correction to 5 bits */
113 #define	SAIOECCUNL	(('d'<<8)|7)	/* use standard ecc procedures */
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 */
119 #define	SAIOSEVRE	(('d'<<8)|13)	/* severe burnin, no ECC, no retries */
120 #define	SAIONSEVRE	(('d'<<8)|14)	/* clear severe burnin */
121 
122 /* codes for sector header word 1 */
123 #define	HDR1_FMT22	0x1000	/* standard 16 bit format */
124 #define	HDR1_OKSCT	0xc000	/* sector ok */
125 #define	HDR1_SSF	0x2000	/* skip sector flag */
126