1*25863Ssam /* saio.h 1.1 86/01/12 */ 2*25863Ssam 3*25863Ssam /* saio.h 6.2 9/23/83 */ 4*25863Ssam 5*25863Ssam /* 6*25863Ssam * Header file for standalone package 7*25863Ssam */ 8*25863Ssam 9*25863Ssam /* 10*25863Ssam * Io block: includes an 11*25863Ssam * inode, cells for the use of seek, etc, 12*25863Ssam * and a buffer. 13*25863Ssam */ 14*25863Ssam struct iob { 15*25863Ssam int i_flgs; /* see F_ below */ 16*25863Ssam struct inode i_ino; /* inode, if file */ 17*25863Ssam int i_unit; /* pseudo device unit */ 18*25863Ssam daddr_t i_boff; /* block offset on device */ 19*25863Ssam daddr_t i_cyloff; /* cylinder offset on device */ 20*25863Ssam off_t i_offset; /* seek offset in file */ 21*25863Ssam daddr_t i_bn; /* 1st block # of next read */ 22*25863Ssam char *i_ma; /* memory address of i/o buffer */ 23*25863Ssam int i_cc; /* character count of transfer */ 24*25863Ssam int i_error; /* error # return */ 25*25863Ssam int i_errcnt; /* error count for driver retries */ 26*25863Ssam int i_errblk; /* block # in error for error reporting */ 27*25863Ssam char i_buf[MAXBSIZE];/* i/o buffer */ 28*25863Ssam union { 29*25863Ssam struct fs ui_fs; /* file system super block info */ 30*25863Ssam char dummy[SBSIZE]; 31*25863Ssam } i_un; 32*25863Ssam }; 33*25863Ssam #define i_fs i_un.ui_fs 34*25863Ssam #define NULL 0 35*25863Ssam 36*25863Ssam #define F_READ 0x1 /* file opened for reading */ 37*25863Ssam #define F_WRITE 0x2 /* file opened for writing */ 38*25863Ssam #define F_ALLOC 0x4 /* buffer allocated */ 39*25863Ssam #define F_FILE 0x8 /* file instead of device */ 40*25863Ssam #define F_NBSF 0x10 /* no bad sector forwarding */ 41*25863Ssam #define F_ECCLM 0x20 /* limit # of bits in ecc correction */ 42*25863Ssam #define F_SSI 0x40 /* set skip sector inhibit */ 43*25863Ssam #define F_SEVRE 0x80 /* Severe burnin (no retries, no ECC) */ 44*25863Ssam /* io types */ 45*25863Ssam #define F_RDDATA 0x0100 /* read data */ 46*25863Ssam #define F_WRDATA 0x0200 /* write data */ 47*25863Ssam #define F_HDR 0x0400 /* include header on next i/o */ 48*25863Ssam #define F_CHECK 0x0800 /* perform check of data read/write */ 49*25863Ssam #define F_HCHECK 0x1000 /* perform check of header and data */ 50*25863Ssam 51*25863Ssam #define F_TYPEMASK 0xff00 52*25863Ssam 53*25863Ssam /* 54*25863Ssam * Device switch. 55*25863Ssam */ 56*25863Ssam struct devsw { 57*25863Ssam char *dv_name; 58*25863Ssam int (*dv_strategy)(); 59*25863Ssam int (*dv_open)(); 60*25863Ssam int (*dv_close)(); 61*25863Ssam }; 62*25863Ssam 63*25863Ssam struct devsw devsw[]; 64*25863Ssam 65*25863Ssam /* 66*25863Ssam * Drive description table. 67*25863Ssam * Returned from SAIODEVDATA call. 68*25863Ssam */ 69*25863Ssam struct st { 70*25863Ssam short nsect; /* # sectors/track */ 71*25863Ssam short ntrak; /* # tracks/surfaces/heads */ 72*25863Ssam short nspc; /* # sectors/cylinder */ 73*25863Ssam short ncyl; /* # cylinders */ 74*25863Ssam short *off; /* partition offset table (cylinders) */ 75*25863Ssam }; 76*25863Ssam 77*25863Ssam /* 78*25863Ssam * Request codes. Must be the same a F_XXX above 79*25863Ssam */ 80*25863Ssam #define READ 1 81*25863Ssam #define WRITE 2 82*25863Ssam 83*25863Ssam #define NBUFS 4 84*25863Ssam 85*25863Ssam char b[NBUFS][MAXBSIZE]; 86*25863Ssam daddr_t blknos[NBUFS]; 87*25863Ssam 88*25863Ssam #define NFILES 4 89*25863Ssam struct iob iob[NFILES]; 90*25863Ssam 91*25863Ssam extern int errno; /* just like unix */ 92*25863Ssam 93*25863Ssam /* error codes */ 94*25863Ssam #define EBADF 1 /* bad file descriptor */ 95*25863Ssam #define EOFFSET 2 /* relative seek not supported */ 96*25863Ssam #define EDEV 3 /* improper device specification on open */ 97*25863Ssam #define ENXIO 4 /* unknown device specified */ 98*25863Ssam #define EUNIT 5 /* improper unit specification */ 99*25863Ssam #define ESRCH 6 /* directory search for file failed */ 100*25863Ssam #define EIO 7 /* generic error */ 101*25863Ssam #define ECMD 10 /* undefined driver command */ 102*25863Ssam #define EBSE 11 /* bad sector error */ 103*25863Ssam #define EWCK 12 /* write check error */ 104*25863Ssam #define EECC 13 /* uncorrectable ecc error */ 105*25863Ssam #define EHER 14 /* hard error */ 106*25863Ssam 107*25863Ssam /* ioctl's -- for disks just now */ 108*25863Ssam #define SAIOHDR (('d'<<8)|1) /* next i/o includes header */ 109*25863Ssam #define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */ 110*25863Ssam #define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */ 111*25863Ssam #define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector forwarding */ 112*25863Ssam #define SAIODOBAD (('d'<<8)|5) /* enable bad sector forwarding */ 113*25863Ssam #define SAIOECCLIM (('d'<<8)|6) /* limit ecc correction to 5 bits */ 114*25863Ssam #define SAIOECCUNL (('d'<<8)|7) /* use standard ecc procedures */ 115*25863Ssam #define SAIODEVDATA (('d'<<8)|8) /* get device data */ 116*25863Ssam #define SAIOSSI (('d'<<8)|9) /* set skip sector inhibit */ 117*25863Ssam #define SAIONOSSI (('d'<<8)|10) /* inhibit skip sector handling */ 118*25863Ssam #define SAIOSSDEV (('d'<<8)|11) /* is device skip sector type? */ 119*25863Ssam #define SAIODEBUG (('d'<<8)|12) /* enable/disable debugging */ 120*25863Ssam #define SAIOSEVRE (('d'<<8)|13) /* severe burnin, no ECC, no retries */ 121*25863Ssam #define SAIONSEVRE (('d'<<8)|14) /* clear severe burnin */ 122*25863Ssam 123*25863Ssam /* codes for sector header word 1 */ 124*25863Ssam #define HDR1_FMT22 0x1000 /* standard 16 bit format */ 125*25863Ssam #define HDR1_OKSCT 0xc000 /* sector ok */ 126*25863Ssam #define HDR1_SSF 0x2000 /* skip sector flag */ 127