1 /* saio.h 4.7 12/30/82 */ 2 3 /* 4 * header file for standalone package 5 */ 6 7 /* 8 * io block: includes an 9 * inode, cells for the use of seek, etc, 10 * and a buffer. 11 */ 12 struct iob { 13 int i_flgs; 14 struct inode i_ino; 15 int i_unit; 16 daddr_t i_boff; 17 daddr_t i_cyloff; 18 off_t i_offset; 19 daddr_t i_bn; 20 char *i_ma; 21 int i_cc; 22 int i_error; 23 int i_errcnt; 24 int i_active; 25 char i_buf[MAXBSIZE]; 26 union { 27 struct fs ui_fs; 28 char dummy[SBSIZE]; 29 } i_un; 30 }; 31 #define i_fs i_un.ui_fs 32 33 #define F_READ 0x1 /* file opened for reading */ 34 #define F_WRITE 0x2 /* file opened for writing */ 35 #define F_ALLOC 0x4 /* buffer allocated */ 36 #define F_FILE 0x8 /* file instead of device */ 37 /* io types */ 38 #define F_RDDATA 0x0100 /* read data */ 39 #define F_WRDATA 0x0200 /* write data */ 40 #define F_HDR 0x0400 /* include header on next i/o */ 41 #define F_CHECK 0x0800 /* perform check of data read/write */ 42 #define F_HCHECK 0x1000 /* perform check of header and data */ 43 44 #define F_TYPEMASK 0xff00 45 46 /* 47 * dev switch 48 */ 49 struct devsw { 50 char *dv_name; 51 int (*dv_strategy)(); 52 int (*dv_open)(); 53 int (*dv_close)(); 54 int (*dv_ioctl)(); 55 }; 56 57 struct devsw devsw[]; 58 59 /* 60 * request codes. Must be the same a F_XXX above 61 */ 62 #define READ 1 63 #define WRITE 2 64 65 #define NBUFS 4 66 67 char b[NBUFS][MAXBSIZE]; 68 daddr_t blknos[NBUFS]; 69 70 #define NFILES 4 71 struct iob iob[NFILES]; 72 73 #define PHYSUBA0 0x20006000 74 #define PHYSMBA0 0x20010000 75 #define PHYSMBA1 0x20012000 76 #define PHYSUMEM 0x2013e000 77 78 extern int errno; /* just like unix */ 79 80 /* error codes */ 81 #define EBADF 1 /* bad file descriptor */ 82 #define EOFFSET 2 /* relative seek not supported */ 83 #define EDEV 3 /* improper device specification on open */ 84 #define ENXIO 4 /* unknown device specified */ 85 #define EUNIT 5 /* improper unit specification */ 86 #define ESRCH 6 /* directory search for file failed */ 87 #define EIO 7 /* generic error */ 88 #define ECMD 10 /* undefined driver command */ 89 #define EBSE 11 /* bad sector error */ 90 #define EWCK 12 /* write check error */ 91 #define EHER 13 /* hard error */ 92 #define EECC 14 /* severe ecc error, sector recorded as bad*/ 93 94 /* ioctl's -- for disks just now */ 95 #define SAIOHDR (('d'<<8)|1) /* next i/o includes header */ 96 #define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */ 97 #define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */ 98