xref: /csrg-svn/sys/stand.att/saio.h (revision 40499)
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*40499Smckusick  *	@(#)saio.h	7.13 (Berkeley) 03/15/90
1823240Smckusick  */
19325Sbill 
2033627Sbostic #include "saioctl.h"
2133626Sbostic #include "saerrno.h"
2233626Sbostic 
2338112Sbostic #define	UNIX	"/vmunix"
2433627Sbostic #define	NULL	0
2533626Sbostic 
26325Sbill /*
27*40499Smckusick  * Io block: includes an dinode, 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 */
37*40499Smckusick 	struct	dinode i_ino;	/* dinode, if file */
3811363Ssam 	daddr_t	i_cyloff;	/* cylinder offset on device */
3911363Ssam 	off_t	i_offset;	/* seek offset in file */
40*40499Smckusick 	dev_t	i_dev;		/* associated device */
4111363Ssam 	daddr_t	i_bn;		/* 1st block # of next read */
4211363Ssam 	char	*i_ma;		/* memory address of i/o buffer */
4311363Ssam 	int	i_cc;		/* character count of transfer */
4411363Ssam 	int	i_error;	/* error # return */
4511363Ssam 	int	i_errcnt;	/* error count for driver retries */
4611363Ssam 	int	i_errblk;	/* block # in error for error reporting */
4711363Ssam 	char	i_buf[MAXBSIZE];/* i/o buffer */
486004Smckusic 	union {
4911363Ssam 		struct fs ui_fs;	/* file system super block info */
506004Smckusic 		char dummy[SBSIZE];
516004Smckusic 	} i_un;
52325Sbill };
5335754Sbostic 
5433627Sbostic #define	i_fs	i_un.ui_fs
5535482Sbostic #define	i_bus	i_adapt
56325Sbill 
5733632Sbostic /* codes for sector header word 1 */
5833632Sbostic #define	HDR1_FMT22	0x1000	/* standard 16 bit format */
5933632Sbostic #define	HDR1_OKSCT	0xc000	/* sector ok */
6033632Sbostic #define	HDR1_SSF	0x2000	/* skip sector flag */
6133632Sbostic 
6235754Sbostic #define	F_READ		0x0001	/* file opened for reading */
6335754Sbostic #define	F_WRITE		0x0002	/* file opened for writing */
6435754Sbostic #define	F_ALLOC		0x0004	/* buffer allocated */
6535754Sbostic #define	F_FILE		0x0008	/* file instead of device */
6635754Sbostic #define	F_NBSF		0x0010	/* no bad sector forwarding */
6735754Sbostic #define	F_ECCLM		0x0020	/* limit # of bits in ecc correction */
6835754Sbostic #define	F_SSI		0x0040	/* set skip sector inhibit */
6935754Sbostic #define	F_SEVRE		0x0080	/* Severe burnin (no retries, no ECC) */
7033626Sbostic 
7110022Ssam /* io types */
7210022Ssam #define	F_RDDATA	0x0100	/* read data */
7310022Ssam #define	F_WRDATA	0x0200	/* write data */
7433627Sbostic #define	F_HDR		0x0400	/* include header on next i/o */
7533627Sbostic #define	F_CHECK		0x0800	/* perform check of data read/write */
7633627Sbostic #define	F_HCHECK	0x1000	/* perform check of header and data */
77325Sbill 
7810022Ssam #define	F_TYPEMASK	0xff00
7910022Ssam 
8033627Sbostic #define	READ	F_READ
8133627Sbostic #define	WRITE	F_WRITE
8233627Sbostic 
8333627Sbostic /*
8433626Sbostic  * Lseek call.
8533626Sbostic  */
8633626Sbostic #define	L_SET		0	/* absolute offset */
8733626Sbostic 
8833626Sbostic /*
8911363Ssam  * Device switch.
90325Sbill  */
91325Sbill struct devsw {
92325Sbill 	char	*dv_name;
93325Sbill 	int	(*dv_strategy)();
94325Sbill 	int	(*dv_open)();
95325Sbill 	int	(*dv_close)();
9610022Ssam 	int	(*dv_ioctl)();
97325Sbill };
98325Sbill 
9933627Sbostic extern struct devsw devsw[];	/* device array */
10033627Sbostic extern int ndevs;		/* number of elements in devsw[] */
101325Sbill 
10233042Skarels #ifdef COMPAT_42
10311139Ssam /*
10433042Skarels  * Old drive description table.
10533042Skarels  * still used by some drivers for now.
10633042Skarels  */
10733042Skarels struct st {
10833042Skarels 	short	nsect;		/* # sectors/track */
10933042Skarels 	short	ntrak;		/* # tracks/surfaces/heads */
11033042Skarels 	short	nspc;		/* # sectors/cylinder */
11133042Skarels 	short	ncyl;		/* # cylinders */
11233042Skarels 	short	*off;		/* partition offset table (cylinders) */
11333042Skarels };
11433042Skarels #endif
11533042Skarels 
11611363Ssam #define	NFILES	4
11733627Sbostic extern struct	iob iob[NFILES];
118