1*10333Shelge /* saio.h 4.8 01/16/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; 24*10333Shelge 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 33*10333Shelge #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 */ 39*10333Shelge #define F_NBSF 0x10 /* no bad sector forwarding */ 40*10333Shelge #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*10333Shelge /* 64*10333Shelge * device data structure, 65*10333Shelge * used by the ioctl-command SAIODEVDATA ( for disks only) 66*10333Shelge */ 67*10333Shelge 68*10333Shelge struct devdata { 69*10333Shelge int nsect; /* number of sectors per track */ 70*10333Shelge int ntrak; /* number of tracks/surfaces/heads... */ 71*10333Shelge int nspc; /* number of sectors per cylinder */ 72*10333Shelge int ncyl; /* number of cylinders */ 73*10333Shelge }; 74*10333Shelge 75325Sbill /* 76325Sbill * 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 86325Sbill #define NFILES 4 87325Sbill struct iob iob[NFILES]; 886373Smckusic 896373Smckusic #define PHYSUBA0 0x20006000 906373Smckusic #define PHYSMBA0 0x20010000 916373Smckusic #define PHYSMBA1 0x20012000 926373Smckusic #define PHYSUMEM 0x2013e000 9310022Ssam 9410022Ssam extern int errno; /* just like unix */ 9510022Ssam 9610022Ssam /* error codes */ 9710022Ssam #define EBADF 1 /* bad file descriptor */ 9810022Ssam #define EOFFSET 2 /* relative seek not supported */ 9910022Ssam #define EDEV 3 /* improper device specification on open */ 10010022Ssam #define ENXIO 4 /* unknown device specified */ 10110022Ssam #define EUNIT 5 /* improper unit specification */ 10210022Ssam #define ESRCH 6 /* directory search for file failed */ 10310022Ssam #define EIO 7 /* generic error */ 10410022Ssam #define ECMD 10 /* undefined driver command */ 10510022Ssam #define EBSE 11 /* bad sector error */ 10610022Ssam #define EWCK 12 /* write check error */ 10710022Ssam #define EHER 13 /* hard error */ 10810022Ssam #define EECC 14 /* severe ecc error, sector recorded as bad*/ 10910022Ssam 11010022Ssam /* ioctl's -- for disks just now */ 111*10333Shelge #define SAIOHDR (('d'<<8)|1) /* next i/o includes header */ 11210022Ssam #define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */ 11310022Ssam #define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */ 114*10333Shelge #define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector forwarding */ 115*10333Shelge #define SAIODOBAD (('d'<<8)|5) /* do bad sector forwarding */ 116*10333Shelge #define SAIOECCLIM (('d'<<8)|6) /* report sectors as bad if more than 117*10333Shelge * 5 bits are bad in ecc */ 118*10333Shelge #define SAIOECCUNL (('d'<<8)|7) /* use standard ecc procedures */ 119*10333Shelge #define SAIODEVDATA (('d'<<8)|8) /* get device data */ 120*10333Shelge 121*10333Shelge /* codes for sector header word 1 */ 122*10333Shelge #define HDR1_FMT22 0x1000 /* standard 16 bit format */ 123*10333Shelge #define HDR1_OKSCT 0xc000 /* sector ok */ 124