xref: /csrg-svn/sys/stand.att/saio.h (revision 35482)
123240Smckusick /*
233627Sbostic  * Copyright (c) 1982, 1988 Regents of the University of California.
323240Smckusick  * All rights reserved.  The Berkeley software License Agreement
423240Smckusick  * specifies the terms and conditions for redistribution.
523240Smckusick  *
6*35482Sbostic  *	@(#)saio.h	7.9 (Berkeley) 09/12/88
723240Smckusick  */
8325Sbill 
933627Sbostic #include "saioctl.h"
1033626Sbostic #include "saerrno.h"
1133626Sbostic 
1233626Sbostic #define	UNIX	"/vmunix"
1333627Sbostic #define	NULL	0
1433626Sbostic 
15325Sbill /*
1633626Sbostic  * Io block: includes an inode, cells for the use of seek, etc.,
17325Sbill  * and a buffer.
18325Sbill  */
1933627Sbostic struct iob {
2011363Ssam 	int	i_flgs;		/* see F_ below */
21*35482Sbostic 	int	i_adapt;	/* adapter or bus */
2233626Sbostic 	int	i_ctlr;		/* controller */
2311363Ssam 	int	i_unit;		/* pseudo device unit */
2433626Sbostic 	int	i_part;		/* disk partition */
2511363Ssam 	daddr_t	i_boff;		/* block offset on device */
2633626Sbostic 	struct	inode i_ino;	/* inode, if file */
2711363Ssam 	daddr_t	i_cyloff;	/* cylinder offset on device */
2811363Ssam 	off_t	i_offset;	/* seek offset in file */
2911363Ssam 	daddr_t	i_bn;		/* 1st block # of next read */
3011363Ssam 	char	*i_ma;		/* memory address of i/o buffer */
3111363Ssam 	int	i_cc;		/* character count of transfer */
3211363Ssam 	int	i_error;	/* error # return */
3311363Ssam 	int	i_errcnt;	/* error count for driver retries */
3411363Ssam 	int	i_errblk;	/* block # in error for error reporting */
3511363Ssam 	char	i_buf[MAXBSIZE];/* i/o buffer */
366004Smckusic 	union {
3711363Ssam 		struct fs ui_fs;	/* file system super block info */
386004Smckusic 		char dummy[SBSIZE];
396004Smckusic 	} i_un;
40325Sbill };
4133627Sbostic #define	i_fs	i_un.ui_fs
42*35482Sbostic #define	i_bus	i_adapt
43325Sbill 
4433632Sbostic /* codes for sector header word 1 */
4533632Sbostic #define	HDR1_FMT22	0x1000	/* standard 16 bit format */
4633632Sbostic #define	HDR1_OKSCT	0xc000	/* sector ok */
4733632Sbostic #define	HDR1_SSF	0x2000	/* skip sector flag */
4833632Sbostic 
4933627Sbostic #define	F_READ		0x1	/* file opened for reading */
5033627Sbostic #define	F_WRITE		0x2	/* file opened for writing */
5133627Sbostic #define	F_ALLOC		0x4	/* buffer allocated */
5233627Sbostic #define	F_FILE		0x8	/* file instead of device */
5333627Sbostic #define	F_NBSF		0x10	/* no bad sector forwarding */
5433631Sbostic #define	F_ECCLM		0x20	/* limit # of bits in ecc correction */
5533627Sbostic #define	F_SSI		0x40	/* set skip sector inhibit */
5633631Sbostic #define	F_SEVRE		0x80	/* Severe burnin (no retries, no ECC) */
5733626Sbostic 
5810022Ssam /* io types */
5910022Ssam #define	F_RDDATA	0x0100	/* read data */
6010022Ssam #define	F_WRDATA	0x0200	/* write data */
6133627Sbostic #define	F_HDR		0x0400	/* include header on next i/o */
6233627Sbostic #define	F_CHECK		0x0800	/* perform check of data read/write */
6333627Sbostic #define	F_HCHECK	0x1000	/* perform check of header and data */
64325Sbill 
6510022Ssam #define	F_TYPEMASK	0xff00
6610022Ssam 
67325Sbill /*
6833627Sbostic  * Request codes. Must be the same as F_XXX above
6933627Sbostic  */
7033627Sbostic #define	READ	F_READ
7133627Sbostic #define	WRITE	F_WRITE
7233627Sbostic 
7333627Sbostic /*
7433626Sbostic  * Lseek call.
7533626Sbostic  */
7633626Sbostic #define	L_SET		0	/* absolute offset */
7733626Sbostic 
7833626Sbostic /*
7911363Ssam  * Device switch.
80325Sbill  */
81325Sbill struct devsw {
82325Sbill 	char	*dv_name;
83325Sbill 	int	(*dv_strategy)();
84325Sbill 	int	(*dv_open)();
85325Sbill 	int	(*dv_close)();
8610022Ssam 	int	(*dv_ioctl)();
87325Sbill };
88325Sbill 
8933627Sbostic extern struct devsw devsw[];	/* device array */
9033627Sbostic extern int ndevs;		/* number of elements in devsw[] */
91325Sbill 
9233042Skarels #ifdef COMPAT_42
9311139Ssam /*
9433042Skarels  * Old drive description table.
9533042Skarels  * still used by some drivers for now.
9633042Skarels  */
9733042Skarels struct st {
9833042Skarels 	short	nsect;		/* # sectors/track */
9933042Skarels 	short	ntrak;		/* # tracks/surfaces/heads */
10033042Skarels 	short	nspc;		/* # sectors/cylinder */
10133042Skarels 	short	ncyl;		/* # cylinders */
10233042Skarels 	short	*off;		/* partition offset table (cylinders) */
10333042Skarels };
10433042Skarels #endif
10533042Skarels 
10611363Ssam #define	NFILES	4
10733627Sbostic extern struct	iob iob[NFILES];
108