xref: /csrg-svn/sys/stand.att/saio.h (revision 10022)
1*10022Ssam /*	saio.h	4.7	12/30/82	*/
2325Sbill 
3325Sbill /*
4325Sbill  * header file for standalone package
5325Sbill  */
6325Sbill 
7325Sbill /*
8325Sbill  * io block: includes an
9325Sbill  * inode, cells for the use of seek, etc,
10325Sbill  * and a buffer.
11325Sbill  */
12325Sbill struct	iob {
13*10022Ssam 	int	i_flgs;
14325Sbill 	struct	inode i_ino;
15325Sbill 	int	i_unit;
16325Sbill 	daddr_t	i_boff;
17325Sbill 	daddr_t	i_cyloff;
18325Sbill 	off_t	i_offset;
19325Sbill 	daddr_t	i_bn;
20325Sbill 	char	*i_ma;
21325Sbill 	int	i_cc;
22*10022Ssam 	int	i_error;
23*10022Ssam 	int	i_errcnt;
24*10022Ssam 	int	i_active;
256004Smckusic 	char	i_buf[MAXBSIZE];
266004Smckusic 	union {
276004Smckusic 		struct fs ui_fs;
286004Smckusic 		char dummy[SBSIZE];
296004Smckusic 	} i_un;
30325Sbill };
316004Smckusic #define i_fs i_un.ui_fs
32325Sbill 
33*10022Ssam #define F_READ		0x1	/* file opened for reading */
34*10022Ssam #define F_WRITE		0x2	/* file opened for writing */
35*10022Ssam #define F_ALLOC		0x4	/* buffer allocated */
36*10022Ssam #define F_FILE		0x8	/* file instead of device */
37*10022Ssam /* io types */
38*10022Ssam #define	F_RDDATA	0x0100	/* read data */
39*10022Ssam #define	F_WRDATA	0x0200	/* write data */
40*10022Ssam #define F_HDR		0x0400	/* include header on next i/o */
41*10022Ssam #define F_CHECK		0x0800	/* perform check of data read/write */
42*10022Ssam #define F_HCHECK	0x1000	/* perform check of header and data */
43325Sbill 
44*10022Ssam #define	F_TYPEMASK	0xff00
45*10022Ssam 
46325Sbill /*
47325Sbill  * dev switch
48325Sbill  */
49325Sbill struct devsw {
50325Sbill 	char	*dv_name;
51325Sbill 	int	(*dv_strategy)();
52325Sbill 	int	(*dv_open)();
53325Sbill 	int	(*dv_close)();
54*10022Ssam 	int	(*dv_ioctl)();
55325Sbill };
56325Sbill 
57325Sbill struct devsw devsw[];
58325Sbill 
59325Sbill /*
60325Sbill  * request codes. Must be the same a F_XXX above
61325Sbill  */
62325Sbill #define	READ	1
63325Sbill #define	WRITE	2
64325Sbill 
65325Sbill #define	NBUFS	4
66325Sbill 
676004Smckusic char	b[NBUFS][MAXBSIZE];
68325Sbill daddr_t	blknos[NBUFS];
69325Sbill 
70325Sbill #define NFILES	4
71325Sbill struct	iob iob[NFILES];
726373Smckusic 
736373Smckusic #define	PHYSUBA0	0x20006000
746373Smckusic #define	PHYSMBA0	0x20010000
756373Smckusic #define	PHYSMBA1	0x20012000
766373Smckusic #define	PHYSUMEM	0x2013e000
77*10022Ssam 
78*10022Ssam extern	int errno;	/* just like unix */
79*10022Ssam 
80*10022Ssam /* error codes */
81*10022Ssam #define	EBADF	1	/* bad file descriptor */
82*10022Ssam #define	EOFFSET	2	/* relative seek not supported */
83*10022Ssam #define	EDEV	3	/* improper device specification on open */
84*10022Ssam #define	ENXIO	4	/* unknown device specified */
85*10022Ssam #define	EUNIT	5	/* improper unit specification */
86*10022Ssam #define	ESRCH	6	/* directory search for file failed */
87*10022Ssam #define	EIO	7	/* generic error */
88*10022Ssam #define ECMD	10	/* undefined driver command */
89*10022Ssam #define EBSE	11	/* bad sector error */
90*10022Ssam #define EWCK	12	/* write check error */
91*10022Ssam #define EHER	13	/* hard error */
92*10022Ssam #define EECC	14	/* severe ecc error, sector recorded as bad*/
93*10022Ssam 
94*10022Ssam /* ioctl's -- for disks just now */
95*10022Ssam #define	SAIOHDR	(('d'<<8)|1)	/* next i/o includes header */
96*10022Ssam #define	SAIOCHECK	(('d'<<8)|2)	/* next i/o checks data */
97*10022Ssam #define	SAIOHCHECK	(('d'<<8)|3)	/* next i/o checks header & data */
98