1*11363Ssam /* saio.h 4.14 03/01/83 */ 2325Sbill 3325Sbill /* 4*11363Ssam * Header file for standalone package 5325Sbill */ 6325Sbill 7325Sbill /* 8*11363Ssam * Io block: includes an 9325Sbill * inode, cells for the use of seek, etc, 10325Sbill * and a buffer. 11325Sbill */ 12325Sbill struct iob { 13*11363Ssam int i_flgs; /* see F_ below */ 14*11363Ssam struct inode i_ino; /* inode, if file */ 15*11363Ssam int i_unit; /* pseudo device unit */ 16*11363Ssam daddr_t i_boff; /* block offset on device */ 17*11363Ssam daddr_t i_cyloff; /* cylinder offset on device */ 18*11363Ssam off_t i_offset; /* seek offset in file */ 19*11363Ssam daddr_t i_bn; /* 1st block # of next read */ 20*11363Ssam char *i_ma; /* memory address of i/o buffer */ 21*11363Ssam int i_cc; /* character count of transfer */ 22*11363Ssam int i_error; /* error # return */ 23*11363Ssam int i_errcnt; /* error count for driver retries */ 24*11363Ssam int i_errblk; /* block # in error for error reporting */ 25*11363Ssam char i_buf[MAXBSIZE];/* i/o buffer */ 266004Smckusic union { 27*11363Ssam struct fs ui_fs; /* file system super block info */ 286004Smckusic char dummy[SBSIZE]; 296004Smckusic } i_un; 30325Sbill }; 316004Smckusic #define i_fs i_un.ui_fs 3210333Shelge #define NULL 0 33325Sbill 3410022Ssam #define F_READ 0x1 /* file opened for reading */ 3510022Ssam #define F_WRITE 0x2 /* file opened for writing */ 3610022Ssam #define F_ALLOC 0x4 /* buffer allocated */ 3710022Ssam #define F_FILE 0x8 /* file instead of device */ 3810333Shelge #define F_NBSF 0x10 /* no bad sector forwarding */ 3911139Ssam #define F_ECCLM 0x20 /* limit # of bits in ecc correction */ 4011139Ssam #define F_SSI 0x40 /* set skip sector inhibit */ 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 /* 51*11363Ssam * Device 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 6311139Ssam /* 6411139Ssam * Drive description table. 6511139Ssam * Returned from SAIODEVDATA call. 6611139Ssam */ 6710351Shelge struct st { 6811139Ssam short nsect; /* # sectors/track */ 69*11363Ssam short ntrak; /* # tracks/surfaces/heads */ 7011139Ssam short nspc; /* # sectors/cylinder */ 7111139Ssam short ncyl; /* # cylinders */ 7211139Ssam short *off; /* partition offset table (cylinders) */ 7310333Shelge }; 7410333Shelge 75325Sbill /* 76*11363Ssam * Request codes. Must be the same a F_XXX above 77325Sbill */ 78325Sbill #define READ 1 79325Sbill #define WRITE 2 80325Sbill 81325Sbill #define NBUFS 4 82325Sbill 836004Smckusic char b[NBUFS][MAXBSIZE]; 84325Sbill daddr_t blknos[NBUFS]; 85325Sbill 86*11363Ssam #define NFILES 4 87325Sbill struct iob iob[NFILES]; 886373Smckusic 8910022Ssam extern int errno; /* just like unix */ 9010022Ssam 9110022Ssam /* error codes */ 9210022Ssam #define EBADF 1 /* bad file descriptor */ 9310022Ssam #define EOFFSET 2 /* relative seek not supported */ 9410022Ssam #define EDEV 3 /* improper device specification on open */ 9510022Ssam #define ENXIO 4 /* unknown device specified */ 9610022Ssam #define EUNIT 5 /* improper unit specification */ 9710022Ssam #define ESRCH 6 /* directory search for file failed */ 9810022Ssam #define EIO 7 /* generic error */ 99*11363Ssam #define ECMD 10 /* undefined driver command */ 100*11363Ssam #define EBSE 11 /* bad sector error */ 101*11363Ssam #define EWCK 12 /* write check error */ 102*11363Ssam #define EECC 13 /* uncorrectable ecc error */ 103*11363Ssam #define EHER 14 /* hard error */ 10410022Ssam 10510022Ssam /* ioctl's -- for disks just now */ 10610333Shelge #define SAIOHDR (('d'<<8)|1) /* next i/o includes header */ 10710022Ssam #define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */ 10810022Ssam #define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */ 10910333Shelge #define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector forwarding */ 11011139Ssam #define SAIODOBAD (('d'<<8)|5) /* enable bad sector forwarding */ 11111139Ssam #define SAIOECCLIM (('d'<<8)|6) /* limit ecc correction to 5 bits */ 11210333Shelge #define SAIOECCUNL (('d'<<8)|7) /* use standard ecc procedures */ 113*11363Ssam #define SAIODEVDATA (('d'<<8)|8) /* get device data */ 114*11363Ssam #define SAIOSSI (('d'<<8)|9) /* set skip sector inhibit */ 115*11363Ssam #define SAIONOSSI (('d'<<8)|10) /* inhibit skip sector handling */ 116*11363Ssam #define SAIOSSDEV (('d'<<8)|11) /* is device skip sector type? */ 117*11363Ssam #define SAIODEBUG (('d'<<8)|12) /* enable/disable debugging */ 11810333Shelge 11910333Shelge /* codes for sector header word 1 */ 120*11363Ssam #define HDR1_FMT22 0x1000 /* standard 16 bit format */ 121*11363Ssam #define HDR1_OKSCT 0xc000 /* sector ok */ 122*11363Ssam #define HDR1_SSF 0x2000 /* skip sector flag */ 123