1*30308Skarels /* saio.h 1.2 86/12/18 */ 225863Ssam 325863Ssam /* saio.h 6.2 9/23/83 */ 425863Ssam 525863Ssam /* 625863Ssam * Header file for standalone package 725863Ssam */ 825863Ssam 925863Ssam /* 1025863Ssam * Io block: includes an 1125863Ssam * inode, cells for the use of seek, etc, 1225863Ssam * and a buffer. 1325863Ssam */ 1425863Ssam struct iob { 1525863Ssam int i_flgs; /* see F_ below */ 1625863Ssam struct inode i_ino; /* inode, if file */ 1725863Ssam int i_unit; /* pseudo device unit */ 1825863Ssam daddr_t i_boff; /* block offset on device */ 1925863Ssam daddr_t i_cyloff; /* cylinder offset on device */ 2025863Ssam off_t i_offset; /* seek offset in file */ 2125863Ssam daddr_t i_bn; /* 1st block # of next read */ 2225863Ssam char *i_ma; /* memory address of i/o buffer */ 2325863Ssam int i_cc; /* character count of transfer */ 2425863Ssam int i_error; /* error # return */ 2525863Ssam int i_errcnt; /* error count for driver retries */ 2625863Ssam int i_errblk; /* block # in error for error reporting */ 2725863Ssam char i_buf[MAXBSIZE];/* i/o buffer */ 2825863Ssam union { 2925863Ssam struct fs ui_fs; /* file system super block info */ 3025863Ssam char dummy[SBSIZE]; 3125863Ssam } i_un; 3225863Ssam }; 3325863Ssam #define i_fs i_un.ui_fs 3425863Ssam #define NULL 0 3525863Ssam 3625863Ssam #define F_READ 0x1 /* file opened for reading */ 3725863Ssam #define F_WRITE 0x2 /* file opened for writing */ 3825863Ssam #define F_ALLOC 0x4 /* buffer allocated */ 3925863Ssam #define F_FILE 0x8 /* file instead of device */ 4025863Ssam #define F_NBSF 0x10 /* no bad sector forwarding */ 4125863Ssam #define F_ECCLM 0x20 /* limit # of bits in ecc correction */ 4225863Ssam #define F_SSI 0x40 /* set skip sector inhibit */ 4325863Ssam #define F_SEVRE 0x80 /* Severe burnin (no retries, no ECC) */ 4425863Ssam /* io types */ 4525863Ssam #define F_RDDATA 0x0100 /* read data */ 4625863Ssam #define F_WRDATA 0x0200 /* write data */ 4725863Ssam #define F_HDR 0x0400 /* include header on next i/o */ 4825863Ssam #define F_CHECK 0x0800 /* perform check of data read/write */ 4925863Ssam #define F_HCHECK 0x1000 /* perform check of header and data */ 5025863Ssam 5125863Ssam #define F_TYPEMASK 0xff00 5225863Ssam 5325863Ssam /* 5425863Ssam * Device switch. 5525863Ssam */ 5625863Ssam struct devsw { 5725863Ssam char *dv_name; 5825863Ssam int (*dv_strategy)(); 5925863Ssam int (*dv_open)(); 6025863Ssam int (*dv_close)(); 61*30308Skarels int (*dv_ioctl)(); 6225863Ssam }; 6325863Ssam 6425863Ssam struct devsw devsw[]; 65*30308Skarels int ndevs; 6625863Ssam 6725863Ssam /* 6825863Ssam * Drive description table. 6925863Ssam * Returned from SAIODEVDATA call. 7025863Ssam */ 7125863Ssam struct st { 7225863Ssam short nsect; /* # sectors/track */ 7325863Ssam short ntrak; /* # tracks/surfaces/heads */ 7425863Ssam short nspc; /* # sectors/cylinder */ 7525863Ssam short ncyl; /* # cylinders */ 7625863Ssam short *off; /* partition offset table (cylinders) */ 7725863Ssam }; 7825863Ssam 7925863Ssam /* 8025863Ssam * Request codes. Must be the same a F_XXX above 8125863Ssam */ 8225863Ssam #define READ 1 8325863Ssam #define WRITE 2 8425863Ssam 8525863Ssam #define NBUFS 4 8625863Ssam 8725863Ssam char b[NBUFS][MAXBSIZE]; 8825863Ssam daddr_t blknos[NBUFS]; 8925863Ssam 9025863Ssam #define NFILES 4 9125863Ssam struct iob iob[NFILES]; 9225863Ssam 9325863Ssam extern int errno; /* just like unix */ 9425863Ssam 9525863Ssam /* error codes */ 9625863Ssam #define EBADF 1 /* bad file descriptor */ 9725863Ssam #define EOFFSET 2 /* relative seek not supported */ 9825863Ssam #define EDEV 3 /* improper device specification on open */ 9925863Ssam #define ENXIO 4 /* unknown device specified */ 10025863Ssam #define EUNIT 5 /* improper unit specification */ 10125863Ssam #define ESRCH 6 /* directory search for file failed */ 10225863Ssam #define EIO 7 /* generic error */ 10325863Ssam #define ECMD 10 /* undefined driver command */ 10425863Ssam #define EBSE 11 /* bad sector error */ 10525863Ssam #define EWCK 12 /* write check error */ 10625863Ssam #define EECC 13 /* uncorrectable ecc error */ 10725863Ssam #define EHER 14 /* hard error */ 10825863Ssam 10925863Ssam /* ioctl's -- for disks just now */ 11025863Ssam #define SAIOHDR (('d'<<8)|1) /* next i/o includes header */ 11125863Ssam #define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */ 11225863Ssam #define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */ 11325863Ssam #define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector forwarding */ 11425863Ssam #define SAIODOBAD (('d'<<8)|5) /* enable bad sector forwarding */ 11525863Ssam #define SAIOECCLIM (('d'<<8)|6) /* limit ecc correction to 5 bits */ 11625863Ssam #define SAIOECCUNL (('d'<<8)|7) /* use standard ecc procedures */ 11725863Ssam #define SAIODEVDATA (('d'<<8)|8) /* get device data */ 11825863Ssam #define SAIOSSI (('d'<<8)|9) /* set skip sector inhibit */ 11925863Ssam #define SAIONOSSI (('d'<<8)|10) /* inhibit skip sector handling */ 12025863Ssam #define SAIOSSDEV (('d'<<8)|11) /* is device skip sector type? */ 12125863Ssam #define SAIODEBUG (('d'<<8)|12) /* enable/disable debugging */ 12225863Ssam #define SAIOSEVRE (('d'<<8)|13) /* severe burnin, no ECC, no retries */ 12325863Ssam #define SAIONSEVRE (('d'<<8)|14) /* clear severe burnin */ 12425863Ssam 12525863Ssam /* codes for sector header word 1 */ 12625863Ssam #define HDR1_FMT22 0x1000 /* standard 16 bit format */ 12725863Ssam #define HDR1_OKSCT 0xc000 /* sector ok */ 12825863Ssam #define HDR1_SSF 0x2000 /* skip sector flag */ 129