149116Sbostic /*- 2*63370Sbostic * Copyright (c) 1982, 1988, 1991, 1993 3*63370Sbostic * The Regents of the University of California. All rights reserved. 423240Smckusick * 544517Sbostic * %sccs.include.redist.c% 635754Sbostic * 7*63370Sbostic * @(#)saio.h 8.1 (Berkeley) 06/11/93 823240Smckusick */ 9325Sbill 1054072Shibler #include <sys/time.h> 1156509Sbostic 1253697Ssklower #include <ufs/ffs/fs.h> 1353697Ssklower #include <ufs/ufs/dinode.h> 1433626Sbostic 1560328Smckusick #include <stand.att/saioctl.h> 1660328Smckusick #include <stand.att/saerrno.h> 1756509Sbostic 1838112Sbostic #define UNIX "/vmunix" 1949116Sbostic 2049116Sbostic #ifndef NULL 2133627Sbostic #define NULL 0 2249116Sbostic #endif 2333626Sbostic 2449116Sbostic /* I/O block */ 2533627Sbostic struct iob { 2649116Sbostic int i_flgs; /* flags (see F_*) */ 2735482Sbostic int i_adapt; /* adapter or bus */ 2833626Sbostic int i_ctlr; /* controller */ 2911363Ssam int i_unit; /* pseudo device unit */ 3033626Sbostic int i_part; /* disk partition */ 3111363Ssam daddr_t i_boff; /* block offset on device */ 3211363Ssam daddr_t i_cyloff; /* cylinder offset on device */ 3311363Ssam off_t i_offset; /* seek offset in file */ 3440499Smckusick dev_t i_dev; /* associated device */ 3511363Ssam daddr_t i_bn; /* 1st block # of next read */ 3649116Sbostic char *i_ma; /* memory address of I/O buffer */ 3711363Ssam int i_cc; /* character count of transfer */ 3811363Ssam int i_error; /* error # return */ 3911363Ssam int i_errcnt; /* error count for driver retries */ 4011363Ssam int i_errblk; /* block # in error for error reporting */ 4149116Sbostic char i_buf[MAXBSIZE];/* I/O buffer */ 4249116Sbostic struct dinode i_ino; /* dinode, if file */ 4349116Sbostic union { /* file system super block info */ 4449116Sbostic struct fs ui_fs; 456004Smckusic char dummy[SBSIZE]; 466004Smckusic } i_un; 4733627Sbostic #define i_fs i_un.ui_fs 4835482Sbostic #define i_bus i_adapt 4949116Sbostic }; 50325Sbill 5149116Sbostic #define SOPEN_MAX 4 5249116Sbostic extern struct iob iob[SOPEN_MAX]; 5349116Sbostic 5449116Sbostic /* Codes for sector header word 1 */ 5533632Sbostic #define HDR1_FMT22 0x1000 /* standard 16 bit format */ 5633632Sbostic #define HDR1_OKSCT 0xc000 /* sector ok */ 5733632Sbostic #define HDR1_SSF 0x2000 /* skip sector flag */ 5833632Sbostic 5949116Sbostic /* I/O flag values */ 6035754Sbostic #define F_READ 0x0001 /* file opened for reading */ 6135754Sbostic #define F_WRITE 0x0002 /* file opened for writing */ 6235754Sbostic #define F_ALLOC 0x0004 /* buffer allocated */ 6335754Sbostic #define F_FILE 0x0008 /* file instead of device */ 6435754Sbostic #define F_NBSF 0x0010 /* no bad sector forwarding */ 6535754Sbostic #define F_ECCLM 0x0020 /* limit # of bits in ecc correction */ 6635754Sbostic #define F_SSI 0x0040 /* set skip sector inhibit */ 6735754Sbostic #define F_SEVRE 0x0080 /* Severe burnin (no retries, no ECC) */ 6833626Sbostic 6949116Sbostic /* I/O types */ 7010022Ssam #define F_RDDATA 0x0100 /* read data */ 7110022Ssam #define F_WRDATA 0x0200 /* write data */ 7233627Sbostic #define F_HDR 0x0400 /* include header on next i/o */ 7333627Sbostic #define F_CHECK 0x0800 /* perform check of data read/write */ 7433627Sbostic #define F_HCHECK 0x1000 /* perform check of header and data */ 75325Sbill 7649116Sbostic #define F_TYPEMASK 0xff00 /* I/O type mask */ 7710022Ssam 7849116Sbostic /* Lseek values */ 7933626Sbostic #define L_SET 0 /* absolute offset */ 8033626Sbostic 8149116Sbostic /* Device switch */ 82325Sbill struct devsw { 83325Sbill char *dv_name; 84325Sbill int (*dv_strategy)(); 85325Sbill int (*dv_open)(); 86325Sbill int (*dv_close)(); 8710022Ssam int (*dv_ioctl)(); 88325Sbill }; 89325Sbill 9033627Sbostic extern struct devsw devsw[]; /* device array */ 9133627Sbostic extern int ndevs; /* number of elements in devsw[] */ 92325Sbill 9333042Skarels #ifdef COMPAT_42 9411139Ssam /* 9533042Skarels * Old drive description table. 9633042Skarels * still used by some drivers for now. 9733042Skarels */ 9833042Skarels struct st { 9933042Skarels short nsect; /* # sectors/track */ 10033042Skarels short ntrak; /* # tracks/surfaces/heads */ 10133042Skarels short nspc; /* # sectors/cylinder */ 10233042Skarels short ncyl; /* # cylinders */ 10333042Skarels short *off; /* partition offset table (cylinders) */ 10433042Skarels }; 10533042Skarels #endif 106