xref: /csrg-svn/sys/stand.att/saio.h (revision 40755)
123240Smckusick /*
235754Sbostic  * Copyright (c) 1982, 1988 The Regents of the University of California.
335754Sbostic  * All rights reserved.
423240Smckusick  *
535754Sbostic  * Redistribution and use in source and binary forms are permitted
635754Sbostic  * provided that the above copyright notice and this paragraph are
735754Sbostic  * duplicated in all such forms and that any documentation,
835754Sbostic  * advertising materials, and other materials related to such
935754Sbostic  * distribution and use acknowledge that the software was developed
1035754Sbostic  * by the University of California, Berkeley.  The name of the
1135754Sbostic  * University may not be used to endorse or promote products derived
1235754Sbostic  * from this software without specific prior written permission.
1335754Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1435754Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1535754Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1635754Sbostic  *
17*40755Smckusick  *	@(#)saio.h	7.14 (Berkeley) 04/04/90
1823240Smckusick  */
19325Sbill 
20*40755Smckusick #include "../ufs/fs.h"
21*40755Smckusick #include "../ufs/dinode.h"
2233627Sbostic #include "saioctl.h"
2333626Sbostic #include "saerrno.h"
2433626Sbostic 
2538112Sbostic #define	UNIX	"/vmunix"
2633627Sbostic #define	NULL	0
2733626Sbostic 
28325Sbill /*
2940499Smckusick  * Io block: includes an dinode, cells for the use of seek, etc.,
30325Sbill  * and a buffer.
31325Sbill  */
3233627Sbostic struct iob {
3311363Ssam 	int	i_flgs;		/* see F_ below */
3435482Sbostic 	int	i_adapt;	/* adapter or bus */
3533626Sbostic 	int	i_ctlr;		/* controller */
3611363Ssam 	int	i_unit;		/* pseudo device unit */
3733626Sbostic 	int	i_part;		/* disk partition */
3811363Ssam 	daddr_t	i_boff;		/* block offset on device */
3940499Smckusick 	struct	dinode i_ino;	/* dinode, if file */
4011363Ssam 	daddr_t	i_cyloff;	/* cylinder offset on device */
4111363Ssam 	off_t	i_offset;	/* seek offset in file */
4240499Smckusick 	dev_t	i_dev;		/* associated device */
4311363Ssam 	daddr_t	i_bn;		/* 1st block # of next read */
4411363Ssam 	char	*i_ma;		/* memory address of i/o buffer */
4511363Ssam 	int	i_cc;		/* character count of transfer */
4611363Ssam 	int	i_error;	/* error # return */
4711363Ssam 	int	i_errcnt;	/* error count for driver retries */
4811363Ssam 	int	i_errblk;	/* block # in error for error reporting */
4911363Ssam 	char	i_buf[MAXBSIZE];/* i/o buffer */
506004Smckusic 	union {
5111363Ssam 		struct fs ui_fs;	/* file system super block info */
526004Smckusic 		char dummy[SBSIZE];
536004Smckusic 	} i_un;
54325Sbill };
5535754Sbostic 
5633627Sbostic #define	i_fs	i_un.ui_fs
5735482Sbostic #define	i_bus	i_adapt
58325Sbill 
5933632Sbostic /* codes for sector header word 1 */
6033632Sbostic #define	HDR1_FMT22	0x1000	/* standard 16 bit format */
6133632Sbostic #define	HDR1_OKSCT	0xc000	/* sector ok */
6233632Sbostic #define	HDR1_SSF	0x2000	/* skip sector flag */
6333632Sbostic 
6435754Sbostic #define	F_READ		0x0001	/* file opened for reading */
6535754Sbostic #define	F_WRITE		0x0002	/* file opened for writing */
6635754Sbostic #define	F_ALLOC		0x0004	/* buffer allocated */
6735754Sbostic #define	F_FILE		0x0008	/* file instead of device */
6835754Sbostic #define	F_NBSF		0x0010	/* no bad sector forwarding */
6935754Sbostic #define	F_ECCLM		0x0020	/* limit # of bits in ecc correction */
7035754Sbostic #define	F_SSI		0x0040	/* set skip sector inhibit */
7135754Sbostic #define	F_SEVRE		0x0080	/* Severe burnin (no retries, no ECC) */
7233626Sbostic 
7310022Ssam /* io types */
7410022Ssam #define	F_RDDATA	0x0100	/* read data */
7510022Ssam #define	F_WRDATA	0x0200	/* write data */
7633627Sbostic #define	F_HDR		0x0400	/* include header on next i/o */
7733627Sbostic #define	F_CHECK		0x0800	/* perform check of data read/write */
7833627Sbostic #define	F_HCHECK	0x1000	/* perform check of header and data */
79325Sbill 
8010022Ssam #define	F_TYPEMASK	0xff00
8110022Ssam 
8233627Sbostic #define	READ	F_READ
8333627Sbostic #define	WRITE	F_WRITE
8433627Sbostic 
8533627Sbostic /*
8633626Sbostic  * Lseek call.
8733626Sbostic  */
8833626Sbostic #define	L_SET		0	/* absolute offset */
8933626Sbostic 
9033626Sbostic /*
9111363Ssam  * Device switch.
92325Sbill  */
93325Sbill struct devsw {
94325Sbill 	char	*dv_name;
95325Sbill 	int	(*dv_strategy)();
96325Sbill 	int	(*dv_open)();
97325Sbill 	int	(*dv_close)();
9810022Ssam 	int	(*dv_ioctl)();
99325Sbill };
100325Sbill 
10133627Sbostic extern struct devsw devsw[];	/* device array */
10233627Sbostic extern int ndevs;		/* number of elements in devsw[] */
103325Sbill 
10433042Skarels #ifdef COMPAT_42
10511139Ssam /*
10633042Skarels  * Old drive description table.
10733042Skarels  * still used by some drivers for now.
10833042Skarels  */
10933042Skarels struct st {
11033042Skarels 	short	nsect;		/* # sectors/track */
11133042Skarels 	short	ntrak;		/* # tracks/surfaces/heads */
11233042Skarels 	short	nspc;		/* # sectors/cylinder */
11333042Skarels 	short	ncyl;		/* # cylinders */
11433042Skarels 	short	*off;		/* partition offset table (cylinders) */
11533042Skarels };
11633042Skarels #endif
11733042Skarels 
11811363Ssam #define	NFILES	4
11933627Sbostic extern struct	iob iob[NFILES];
120