xref: /csrg-svn/sys/stand.att/saio.h (revision 33632)
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*33632Sbostic  *	@(#)saio.h	7.8 (Berkeley) 03/02/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 */
2133626Sbostic 	int	i_adapt;	/* adapter */
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
42325Sbill 
43*33632Sbostic /* codes for sector header word 1 */
44*33632Sbostic #define	HDR1_FMT22	0x1000	/* standard 16 bit format */
45*33632Sbostic #define	HDR1_OKSCT	0xc000	/* sector ok */
46*33632Sbostic #define	HDR1_SSF	0x2000	/* skip sector flag */
47*33632Sbostic 
4833627Sbostic #define	F_READ		0x1	/* file opened for reading */
4933627Sbostic #define	F_WRITE		0x2	/* file opened for writing */
5033627Sbostic #define	F_ALLOC		0x4	/* buffer allocated */
5133627Sbostic #define	F_FILE		0x8	/* file instead of device */
5233627Sbostic #define	F_NBSF		0x10	/* no bad sector forwarding */
5333631Sbostic #define	F_ECCLM		0x20	/* limit # of bits in ecc correction */
5433627Sbostic #define	F_SSI		0x40	/* set skip sector inhibit */
5533631Sbostic #define	F_SEVRE		0x80	/* Severe burnin (no retries, no ECC) */
5633626Sbostic 
5710022Ssam /* io types */
5810022Ssam #define	F_RDDATA	0x0100	/* read data */
5910022Ssam #define	F_WRDATA	0x0200	/* write data */
6033627Sbostic #define	F_HDR		0x0400	/* include header on next i/o */
6133627Sbostic #define	F_CHECK		0x0800	/* perform check of data read/write */
6233627Sbostic #define	F_HCHECK	0x1000	/* perform check of header and data */
63325Sbill 
6410022Ssam #define	F_TYPEMASK	0xff00
6510022Ssam 
66325Sbill /*
6733627Sbostic  * Request codes. Must be the same as F_XXX above
6833627Sbostic  */
6933627Sbostic #define	READ	F_READ
7033627Sbostic #define	WRITE	F_WRITE
7133627Sbostic 
7233627Sbostic /*
7333626Sbostic  * Lseek call.
7433626Sbostic  */
7533626Sbostic #define	L_SET		0	/* absolute offset */
7633626Sbostic 
7733626Sbostic /*
7811363Ssam  * Device switch.
79325Sbill  */
80325Sbill struct devsw {
81325Sbill 	char	*dv_name;
82325Sbill 	int	(*dv_strategy)();
83325Sbill 	int	(*dv_open)();
84325Sbill 	int	(*dv_close)();
8510022Ssam 	int	(*dv_ioctl)();
86325Sbill };
87325Sbill 
8833627Sbostic extern struct devsw devsw[];	/* device array */
8933627Sbostic extern int ndevs;		/* number of elements in devsw[] */
90325Sbill 
9133042Skarels #ifdef COMPAT_42
9211139Ssam /*
9333042Skarels  * Old drive description table.
9433042Skarels  * still used by some drivers for now.
9533042Skarels  */
9633042Skarels struct st {
9733042Skarels 	short	nsect;		/* # sectors/track */
9833042Skarels 	short	ntrak;		/* # tracks/surfaces/heads */
9933042Skarels 	short	nspc;		/* # sectors/cylinder */
10033042Skarels 	short	ncyl;		/* # cylinders */
10133042Skarels 	short	*off;		/* partition offset table (cylinders) */
10233042Skarels };
10333042Skarels #endif
10433042Skarels 
10511363Ssam #define	NFILES	4
10633627Sbostic extern struct	iob iob[NFILES];
107