|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution is only permitted until one year after the first shipment ! 6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and ! 7: * binary forms are permitted provided that: (1) source distributions retain ! 8: * this entire copyright notice and comment, and (2) distributions including ! 9: * binaries display the following acknowledgement: This product includes ! 10: * software developed by the University of California, Berkeley and its ! 11: * contributors'' in the documentation or other materials provided with the ! 12: * distribution and in all advertising materials mentioning features or use ! 13: * of this software. Neither the name of the University nor the names of ! 14: * its contributors may be used to endorse or promote products derived from ! 15: * this software without specific prior written permission. ! 16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 19: * ! 20: * @(#)saio.h 7.3 (Berkeley) 7/1/90 ! 21: */ ! 22: ! 23: /* ! 24: * Header file for standalone package ! 25: */ ! 26: ! 27: #include <sys/param.h> ! 28: #include "../ufs/dinode.h" ! 29: #include "../ufs/fs.h" ! 30: ! 31: /* ! 32: * Io block: includes a ! 33: * dinode, cells for the use of seek, etc, ! 34: * and a buffer. ! 35: */ ! 36: struct iob { ! 37: int i_flgs; /* see F_ below */ ! 38: struct dinode i_ino; /* dinode, if file */ ! 39: int i_unit; /* pseudo device unit */ ! 40: daddr_t i_boff; /* block offset on device */ ! 41: daddr_t i_cyloff; /* cylinder offset on device */ ! 42: off_t i_offset; /* seek offset in file */ ! 43: dev_t i_dev; /* associated device */ ! 44: daddr_t i_bn; /* 1st block # of next read */ ! 45: char *i_ma; /* memory address of i/o buffer */ ! 46: int i_cc; /* character count of transfer */ ! 47: int i_error; /* error # return */ ! 48: int i_errcnt; /* error count for driver retries */ ! 49: int i_errblk; /* block # in error for error reporting */ ! 50: char i_buf[MAXBSIZE];/* i/o buffer */ ! 51: union { ! 52: struct fs ui_fs; /* file system super block info */ ! 53: char dummy[SBSIZE]; ! 54: } i_un; ! 55: }; ! 56: #define i_fs i_un.ui_fs ! 57: #define NULL 0 ! 58: ! 59: #define F_READ 0x1 /* file opened for reading */ ! 60: #define F_WRITE 0x2 /* file opened for writing */ ! 61: #define F_ALLOC 0x4 /* buffer allocated */ ! 62: #define F_FILE 0x8 /* file instead of device */ ! 63: #define F_NBSF 0x10 /* no bad sector forwarding */ ! 64: #define F_SSI 0x40 /* set skip sector inhibit */ ! 65: /* io types */ ! 66: #define F_RDDATA 0x0100 /* read data */ ! 67: #define F_WRDATA 0x0200 /* write data */ ! 68: #define F_HDR 0x0400 /* include header on next i/o */ ! 69: #define F_CHECK 0x0800 /* perform check of data read/write */ ! 70: #define F_HCHECK 0x1000 /* perform check of header and data */ ! 71: ! 72: #define F_TYPEMASK 0xff00 ! 73: ! 74: /* ! 75: * Device switch. ! 76: */ ! 77: struct devsw { ! 78: char *dv_name; ! 79: int (*dv_strategy)(); ! 80: int (*dv_open)(); ! 81: int (*dv_close)(); ! 82: int (*dv_ioctl)(); ! 83: }; ! 84: ! 85: struct devsw devsw[]; ! 86: ! 87: /* ! 88: * Drive description table. ! 89: * Returned from SAIODEVDATA call. ! 90: */ ! 91: struct st { ! 92: short nsect; /* # sectors/track */ ! 93: short ntrak; /* # tracks/surfaces/heads */ ! 94: short nspc; /* # sectors/cylinder */ ! 95: short ncyl; /* # cylinders */ ! 96: short *off; /* partition offset table (cylinders) */ ! 97: }; ! 98: ! 99: /* ! 100: * Request codes. Must be the same a F_XXX above ! 101: */ ! 102: #define READ 1 ! 103: #define WRITE 2 ! 104: ! 105: #define NBUFS 4 ! 106: ! 107: char b[NBUFS][MAXBSIZE]; ! 108: daddr_t blknos[NBUFS]; ! 109: ! 110: #define NFILES 4 ! 111: struct iob iob[NFILES]; ! 112: ! 113: extern int errno; /* just like unix */ ! 114: ! 115: /* error codes */ ! 116: #define EBADF 1 /* bad file descriptor */ ! 117: #define EOFFSET 2 /* relative seek not supported */ ! 118: #define EDEV 3 /* improper device specification on open */ ! 119: #define ENXIO 4 /* unknown device specified */ ! 120: #define EUNIT 5 /* improper unit specification */ ! 121: #define ESRCH 6 /* directory search for file failed */ ! 122: #define EIO 7 /* generic error */ ! 123: #define ECMD 10 /* undefined driver command */ ! 124: #define EBSE 11 /* bad sector error */ ! 125: #define EWCK 12 /* write check error */ ! 126: #define EECC 13 /* uncorrectable ecc error */ ! 127: #define EHER 14 /* hard error */ ! 128: ! 129: /* ioctl's -- for disks just now */ ! 130: #define SAIOHDR (('d'<<8)|1) /* next i/o includes header */ ! 131: #define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */ ! 132: #define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */ ! 133: #define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector forwarding */ ! 134: #define SAIODOBAD (('d'<<8)|5) /* enable bad sector forwarding */ ! 135: #define SAIOECCLIM (('d'<<8)|6) /* set limit to ecc correction, bits */ ! 136: #define SAIORETRIES (('d'<<8)|7) /* set retry count for unit */ ! 137: #define SAIODEVDATA (('d'<<8)|8) /* get device data */ ! 138: #define SAIOSSI (('d'<<8)|9) /* set skip sector inhibit */ ! 139: #define SAIONOSSI (('d'<<8)|10) /* inhibit skip sector handling */ ! 140: #define SAIOSSDEV (('d'<<8)|11) /* is device skip sector type? */ ! 141: #define SAIODEBUG (('d'<<8)|12) /* enable/disable debugging */ ! 142: #define SAIOGBADINFO (('d'<<8)|13) /* get bad-sector table */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.