xref: /csrg-svn/sys/stand.att/saio.h (revision 54072)
149116Sbostic /*-
249116Sbostic  * Copyright (c) 1982, 1988, 1991 The Regents of the University of California.
335754Sbostic  * All rights reserved.
423240Smckusick  *
544517Sbostic  * %sccs.include.redist.c%
635754Sbostic  *
7*54072Shibler  *	@(#)saio.h	7.18 (Berkeley) 06/18/92
823240Smckusick  */
9325Sbill 
10*54072Shibler #include <sys/time.h>
1153697Ssklower #include <ufs/ffs/fs.h>
1253697Ssklower #include <ufs/ufs/dinode.h>
1333627Sbostic #include "saioctl.h"
1433626Sbostic #include "saerrno.h"
1533626Sbostic 
1638112Sbostic #define	UNIX	"/vmunix"
1749116Sbostic 
1849116Sbostic #ifndef NULL
1933627Sbostic #define	NULL	0
2049116Sbostic #endif
2133626Sbostic 
2249116Sbostic /* I/O block */
2333627Sbostic struct iob {
2449116Sbostic 	int	i_flgs;		/* flags (see F_*) */
2535482Sbostic 	int	i_adapt;	/* adapter or bus */
2633626Sbostic 	int	i_ctlr;		/* controller */
2711363Ssam 	int	i_unit;		/* pseudo device unit */
2833626Sbostic 	int	i_part;		/* disk partition */
2911363Ssam 	daddr_t	i_boff;		/* block offset on device */
3011363Ssam 	daddr_t	i_cyloff;	/* cylinder offset on device */
3111363Ssam 	off_t	i_offset;	/* seek offset in file */
3240499Smckusick 	dev_t	i_dev;		/* associated device */
3311363Ssam 	daddr_t	i_bn;		/* 1st block # of next read */
3449116Sbostic 	char	*i_ma;		/* memory address of I/O buffer */
3511363Ssam 	int	i_cc;		/* character count of transfer */
3611363Ssam 	int	i_error;	/* error # return */
3711363Ssam 	int	i_errcnt;	/* error count for driver retries */
3811363Ssam 	int	i_errblk;	/* block # in error for error reporting */
3949116Sbostic 	char	i_buf[MAXBSIZE];/* I/O buffer */
4049116Sbostic 	struct	dinode i_ino;	/* dinode, if file */
4149116Sbostic 	union {			/* file system super block info */
4249116Sbostic 		struct fs ui_fs;
436004Smckusic 		char dummy[SBSIZE];
446004Smckusic 	} i_un;
4533627Sbostic #define	i_fs	i_un.ui_fs
4635482Sbostic #define	i_bus	i_adapt
4749116Sbostic };
48325Sbill 
4949116Sbostic #define	SOPEN_MAX	4
5049116Sbostic extern struct iob iob[SOPEN_MAX];
5149116Sbostic 
5249116Sbostic /* Codes for sector header word 1 */
5333632Sbostic #define	HDR1_FMT22	0x1000	/* standard 16 bit format */
5433632Sbostic #define	HDR1_OKSCT	0xc000	/* sector ok */
5533632Sbostic #define	HDR1_SSF	0x2000	/* skip sector flag */
5633632Sbostic 
5749116Sbostic /* I/O flag values */
5835754Sbostic #define	F_READ		0x0001	/* file opened for reading */
5935754Sbostic #define	F_WRITE		0x0002	/* file opened for writing */
6035754Sbostic #define	F_ALLOC		0x0004	/* buffer allocated */
6135754Sbostic #define	F_FILE		0x0008	/* file instead of device */
6235754Sbostic #define	F_NBSF		0x0010	/* no bad sector forwarding */
6335754Sbostic #define	F_ECCLM		0x0020	/* limit # of bits in ecc correction */
6435754Sbostic #define	F_SSI		0x0040	/* set skip sector inhibit */
6535754Sbostic #define	F_SEVRE		0x0080	/* Severe burnin (no retries, no ECC) */
6633626Sbostic 
6749116Sbostic /* I/O types */
6810022Ssam #define	F_RDDATA	0x0100	/* read data */
6910022Ssam #define	F_WRDATA	0x0200	/* write data */
7033627Sbostic #define	F_HDR		0x0400	/* include header on next i/o */
7133627Sbostic #define	F_CHECK		0x0800	/* perform check of data read/write */
7233627Sbostic #define	F_HCHECK	0x1000	/* perform check of header and data */
73325Sbill 
7449116Sbostic #define	F_TYPEMASK	0xff00	/* I/O type mask */
7510022Ssam 
7649116Sbostic /* Lseek values */
7733626Sbostic #define	L_SET		0	/* absolute offset */
7833626Sbostic 
7949116Sbostic /* Device switch */
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
104