1*10351Shelge /* saio.h 4.9 01/17/83 */ 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 { 1310022Ssam 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; 2210022Ssam int i_error; 2310022Ssam int i_errcnt; 2410333Shelge int i_errblk; 2510022Ssam int i_active; 266004Smckusic char i_buf[MAXBSIZE]; 276004Smckusic union { 286004Smckusic struct fs ui_fs; 296004Smckusic char dummy[SBSIZE]; 306004Smckusic } i_un; 31325Sbill }; 326004Smckusic #define i_fs i_un.ui_fs 3310333Shelge #define NULL 0 34325Sbill 3510022Ssam #define F_READ 0x1 /* file opened for reading */ 3610022Ssam #define F_WRITE 0x2 /* file opened for writing */ 3710022Ssam #define F_ALLOC 0x4 /* buffer allocated */ 3810022Ssam #define F_FILE 0x8 /* file instead of device */ 3910333Shelge #define F_NBSF 0x10 /* no bad sector forwarding */ 4010333Shelge #define F_ECCLM 0x20 /* limit the number of bad bits accepted in ecc's */ 4110022Ssam /* io types */ 4210022Ssam #define F_RDDATA 0x0100 /* read data */ 4310022Ssam #define F_WRDATA 0x0200 /* write data */ 4410022Ssam #define F_HDR 0x0400 /* include header on next i/o */ 4510022Ssam #define F_CHECK 0x0800 /* perform check of data read/write */ 4610022Ssam #define F_HCHECK 0x1000 /* perform check of header and data */ 47325Sbill 4810022Ssam #define F_TYPEMASK 0xff00 4910022Ssam 50325Sbill /* 51325Sbill * dev switch 52325Sbill */ 53325Sbill struct devsw { 54325Sbill char *dv_name; 55325Sbill int (*dv_strategy)(); 56325Sbill int (*dv_open)(); 57325Sbill int (*dv_close)(); 5810022Ssam int (*dv_ioctl)(); 59325Sbill }; 60325Sbill 61325Sbill struct devsw devsw[]; 62325Sbill 63*10351Shelge struct st { 64*10351Shelge short nsect; /* number of sectors per track */ 65*10351Shelge short ntrak; /* number of tracks/surfaces/heads... */ 66*10351Shelge short nspc; /* number of sectors per cylinder */ 67*10351Shelge short ncyl; /* number of cylinders */ 68*10351Shelge short *off; 6910333Shelge }; 7010333Shelge 71325Sbill /* 72325Sbill * request codes. Must be the same a F_XXX above 73325Sbill */ 74325Sbill #define READ 1 75325Sbill #define WRITE 2 76325Sbill 77325Sbill #define NBUFS 4 78325Sbill 796004Smckusic char b[NBUFS][MAXBSIZE]; 80325Sbill daddr_t blknos[NBUFS]; 81325Sbill 82325Sbill #define NFILES 4 83325Sbill struct iob iob[NFILES]; 846373Smckusic 856373Smckusic #define PHYSUBA0 0x20006000 866373Smckusic #define PHYSMBA0 0x20010000 876373Smckusic #define PHYSMBA1 0x20012000 886373Smckusic #define PHYSUMEM 0x2013e000 8910022Ssam 9010022Ssam extern int errno; /* just like unix */ 9110022Ssam 9210022Ssam /* error codes */ 9310022Ssam #define EBADF 1 /* bad file descriptor */ 9410022Ssam #define EOFFSET 2 /* relative seek not supported */ 9510022Ssam #define EDEV 3 /* improper device specification on open */ 9610022Ssam #define ENXIO 4 /* unknown device specified */ 9710022Ssam #define EUNIT 5 /* improper unit specification */ 9810022Ssam #define ESRCH 6 /* directory search for file failed */ 9910022Ssam #define EIO 7 /* generic error */ 10010022Ssam #define ECMD 10 /* undefined driver command */ 10110022Ssam #define EBSE 11 /* bad sector error */ 10210022Ssam #define EWCK 12 /* write check error */ 10310022Ssam #define EHER 13 /* hard error */ 10410022Ssam #define EECC 14 /* severe ecc error, sector recorded as bad*/ 10510022Ssam 10610022Ssam /* ioctl's -- for disks just now */ 10710333Shelge #define SAIOHDR (('d'<<8)|1) /* next i/o includes header */ 10810022Ssam #define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */ 10910022Ssam #define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */ 11010333Shelge #define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector forwarding */ 11110333Shelge #define SAIODOBAD (('d'<<8)|5) /* do bad sector forwarding */ 11210333Shelge #define SAIOECCLIM (('d'<<8)|6) /* report sectors as bad if more than 11310333Shelge * 5 bits are bad in ecc */ 11410333Shelge #define SAIOECCUNL (('d'<<8)|7) /* use standard ecc procedures */ 11510333Shelge #define SAIODEVDATA (('d'<<8)|8) /* get device data */ 11610333Shelge 11710333Shelge /* codes for sector header word 1 */ 11810333Shelge #define HDR1_FMT22 0x1000 /* standard 16 bit format */ 11910333Shelge #define HDR1_OKSCT 0xc000 /* sector ok */ 120