xref: /csrg-svn/sys/stand.att/saio.h (revision 35754)
123240Smckusick /*
2*35754Sbostic  * Copyright (c) 1982, 1988 The Regents of the University of California.
3*35754Sbostic  * All rights reserved.
423240Smckusick  *
5*35754Sbostic  * Redistribution and use in source and binary forms are permitted
6*35754Sbostic  * provided that the above copyright notice and this paragraph are
7*35754Sbostic  * duplicated in all such forms and that any documentation,
8*35754Sbostic  * advertising materials, and other materials related to such
9*35754Sbostic  * distribution and use acknowledge that the software was developed
10*35754Sbostic  * by the University of California, Berkeley.  The name of the
11*35754Sbostic  * University may not be used to endorse or promote products derived
12*35754Sbostic  * from this software without specific prior written permission.
13*35754Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*35754Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*35754Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16*35754Sbostic  *
17*35754Sbostic  *	@(#)saio.h	7.10 (Berkeley) 09/29/88
1823240Smckusick  */
19325Sbill 
2033627Sbostic #include "saioctl.h"
2133626Sbostic #include "saerrno.h"
2233626Sbostic 
2333626Sbostic #define	UNIX	"/vmunix"
2433627Sbostic #define	NULL	0
2533626Sbostic 
26325Sbill /*
2733626Sbostic  * Io block: includes an inode, cells for the use of seek, etc.,
28325Sbill  * and a buffer.
29325Sbill  */
3033627Sbostic struct iob {
3111363Ssam 	int	i_flgs;		/* see F_ below */
3235482Sbostic 	int	i_adapt;	/* adapter or bus */
3333626Sbostic 	int	i_ctlr;		/* controller */
3411363Ssam 	int	i_unit;		/* pseudo device unit */
3533626Sbostic 	int	i_part;		/* disk partition */
3611363Ssam 	daddr_t	i_boff;		/* block offset on device */
3733626Sbostic 	struct	inode i_ino;	/* inode, if file */
3811363Ssam 	daddr_t	i_cyloff;	/* cylinder offset on device */
3911363Ssam 	off_t	i_offset;	/* seek offset in file */
4011363Ssam 	daddr_t	i_bn;		/* 1st block # of next read */
4111363Ssam 	char	*i_ma;		/* memory address of i/o buffer */
4211363Ssam 	int	i_cc;		/* character count of transfer */
4311363Ssam 	int	i_error;	/* error # return */
4411363Ssam 	int	i_errcnt;	/* error count for driver retries */
4511363Ssam 	int	i_errblk;	/* block # in error for error reporting */
4611363Ssam 	char	i_buf[MAXBSIZE];/* i/o buffer */
476004Smckusic 	union {
4811363Ssam 		struct fs ui_fs;	/* file system super block info */
496004Smckusic 		char dummy[SBSIZE];
506004Smckusic 	} i_un;
51325Sbill };
52*35754Sbostic 
5333627Sbostic #define	i_fs	i_un.ui_fs
5435482Sbostic #define	i_bus	i_adapt
55325Sbill 
5633632Sbostic /* codes for sector header word 1 */
5733632Sbostic #define	HDR1_FMT22	0x1000	/* standard 16 bit format */
5833632Sbostic #define	HDR1_OKSCT	0xc000	/* sector ok */
5933632Sbostic #define	HDR1_SSF	0x2000	/* skip sector flag */
6033632Sbostic 
61*35754Sbostic #define	F_READ		0x0001	/* file opened for reading */
62*35754Sbostic #define	F_WRITE		0x0002	/* file opened for writing */
63*35754Sbostic #define	F_ALLOC		0x0004	/* buffer allocated */
64*35754Sbostic #define	F_FILE		0x0008	/* file instead of device */
65*35754Sbostic #define	F_NBSF		0x0010	/* no bad sector forwarding */
66*35754Sbostic #define	F_ECCLM		0x0020	/* limit # of bits in ecc correction */
67*35754Sbostic #define	F_SSI		0x0040	/* set skip sector inhibit */
68*35754Sbostic #define	F_SEVRE		0x0080	/* Severe burnin (no retries, no ECC) */
6933626Sbostic 
7010022Ssam /* io types */
7110022Ssam #define	F_RDDATA	0x0100	/* read data */
7210022Ssam #define	F_WRDATA	0x0200	/* write data */
7333627Sbostic #define	F_HDR		0x0400	/* include header on next i/o */
7433627Sbostic #define	F_CHECK		0x0800	/* perform check of data read/write */
7533627Sbostic #define	F_HCHECK	0x1000	/* perform check of header and data */
76325Sbill 
7710022Ssam #define	F_TYPEMASK	0xff00
7810022Ssam 
7933627Sbostic #define	READ	F_READ
8033627Sbostic #define	WRITE	F_WRITE
8133627Sbostic 
8233627Sbostic /*
8333626Sbostic  * Lseek call.
8433626Sbostic  */
8533626Sbostic #define	L_SET		0	/* absolute offset */
8633626Sbostic 
8733626Sbostic /*
8811363Ssam  * Device switch.
89325Sbill  */
90325Sbill struct devsw {
91325Sbill 	char	*dv_name;
92325Sbill 	int	(*dv_strategy)();
93325Sbill 	int	(*dv_open)();
94325Sbill 	int	(*dv_close)();
9510022Ssam 	int	(*dv_ioctl)();
96325Sbill };
97325Sbill 
9833627Sbostic extern struct devsw devsw[];	/* device array */
9933627Sbostic extern int ndevs;		/* number of elements in devsw[] */
100325Sbill 
10133042Skarels #ifdef COMPAT_42
10211139Ssam /*
10333042Skarels  * Old drive description table.
10433042Skarels  * still used by some drivers for now.
10533042Skarels  */
10633042Skarels struct st {
10733042Skarels 	short	nsect;		/* # sectors/track */
10833042Skarels 	short	ntrak;		/* # tracks/surfaces/heads */
10933042Skarels 	short	nspc;		/* # sectors/cylinder */
11033042Skarels 	short	ncyl;		/* # cylinders */
11133042Skarels 	short	*off;		/* partition offset table (cylinders) */
11233042Skarels };
11333042Skarels #endif
11433042Skarels 
11511363Ssam #define	NFILES	4
11633627Sbostic extern struct	iob iob[NFILES];
117