1 /* 2 * Copyright (c) 1982, 1988 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that the above copyright notice and this paragraph are 7 * duplicated in all such forms and that any documentation, 8 * advertising materials, and other materials related to such 9 * distribution and use acknowledge that the software was developed 10 * by the University of California, Berkeley. The name of the 11 * University may not be used to endorse or promote products derived 12 * from this software without specific prior written permission. 13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 * 17 * @(#)saio.h 7.12 (Berkeley) 05/23/89 18 */ 19 20 #include "saioctl.h" 21 #include "saerrno.h" 22 23 #define UNIX "/vmunix" 24 #define NULL 0 25 26 /* 27 * Io block: includes an inode, cells for the use of seek, etc., 28 * and a buffer. 29 */ 30 struct iob { 31 int i_flgs; /* see F_ below */ 32 int i_adapt; /* adapter or bus */ 33 int i_ctlr; /* controller */ 34 int i_unit; /* pseudo device unit */ 35 int i_part; /* disk partition */ 36 daddr_t i_boff; /* block offset on device */ 37 struct inode i_ino; /* inode, if file */ 38 daddr_t i_cyloff; /* cylinder offset on device */ 39 off_t i_offset; /* seek offset in file */ 40 daddr_t i_bn; /* 1st block # of next read */ 41 char *i_ma; /* memory address of i/o buffer */ 42 int i_cc; /* character count of transfer */ 43 int i_error; /* error # return */ 44 int i_errcnt; /* error count for driver retries */ 45 int i_errblk; /* block # in error for error reporting */ 46 char i_buf[MAXBSIZE];/* i/o buffer */ 47 union { 48 struct fs ui_fs; /* file system super block info */ 49 char dummy[SBSIZE]; 50 } i_un; 51 }; 52 53 #define i_fs i_un.ui_fs 54 #define i_bus i_adapt 55 56 /* codes for sector header word 1 */ 57 #define HDR1_FMT22 0x1000 /* standard 16 bit format */ 58 #define HDR1_OKSCT 0xc000 /* sector ok */ 59 #define HDR1_SSF 0x2000 /* skip sector flag */ 60 61 #define F_READ 0x0001 /* file opened for reading */ 62 #define F_WRITE 0x0002 /* file opened for writing */ 63 #define F_ALLOC 0x0004 /* buffer allocated */ 64 #define F_FILE 0x0008 /* file instead of device */ 65 #define F_NBSF 0x0010 /* no bad sector forwarding */ 66 #define F_ECCLM 0x0020 /* limit # of bits in ecc correction */ 67 #define F_SSI 0x0040 /* set skip sector inhibit */ 68 #define F_SEVRE 0x0080 /* Severe burnin (no retries, no ECC) */ 69 70 /* io types */ 71 #define F_RDDATA 0x0100 /* read data */ 72 #define F_WRDATA 0x0200 /* write data */ 73 #define F_HDR 0x0400 /* include header on next i/o */ 74 #define F_CHECK 0x0800 /* perform check of data read/write */ 75 #define F_HCHECK 0x1000 /* perform check of header and data */ 76 77 #define F_TYPEMASK 0xff00 78 79 #define READ F_READ 80 #define WRITE F_WRITE 81 82 /* 83 * Lseek call. 84 */ 85 #define L_SET 0 /* absolute offset */ 86 87 /* 88 * Device switch. 89 */ 90 struct devsw { 91 char *dv_name; 92 int (*dv_strategy)(); 93 int (*dv_open)(); 94 int (*dv_close)(); 95 int (*dv_ioctl)(); 96 }; 97 98 extern struct devsw devsw[]; /* device array */ 99 extern int ndevs; /* number of elements in devsw[] */ 100 101 #ifdef COMPAT_42 102 /* 103 * Old drive description table. 104 * still used by some drivers for now. 105 */ 106 struct st { 107 short nsect; /* # sectors/track */ 108 short ntrak; /* # tracks/surfaces/heads */ 109 short nspc; /* # sectors/cylinder */ 110 short ncyl; /* # cylinders */ 111 short *off; /* partition offset table (cylinders) */ 112 }; 113 #endif 114 115 #define NFILES 4 116 extern struct iob iob[NFILES]; 117