149116Sbostic /*- 249116Sbostic * Copyright (c) 1982, 1988, 1991 The Regents of the University of California. 335754Sbostic * All rights reserved. 423240Smckusick * 544517Sbostic * %sccs.include.redist.c% 635754Sbostic * 7*53697Ssklower * @(#)saio.h 7.17 (Berkeley) 05/27/92 823240Smckusick */ 9325Sbill 10*53697Ssklower #include <ufs/ffs/fs.h> 11*53697Ssklower #include <ufs/ufs/dinode.h> 1233627Sbostic #include "saioctl.h" 1333626Sbostic #include "saerrno.h" 1433626Sbostic 1538112Sbostic #define UNIX "/vmunix" 1649116Sbostic 1749116Sbostic #ifndef NULL 1833627Sbostic #define NULL 0 1949116Sbostic #endif 2033626Sbostic 2149116Sbostic /* I/O block */ 2233627Sbostic struct iob { 2349116Sbostic int i_flgs; /* flags (see F_*) */ 2435482Sbostic int i_adapt; /* adapter or bus */ 2533626Sbostic int i_ctlr; /* controller */ 2611363Ssam int i_unit; /* pseudo device unit */ 2733626Sbostic int i_part; /* disk partition */ 2811363Ssam daddr_t i_boff; /* block offset on device */ 2911363Ssam daddr_t i_cyloff; /* cylinder offset on device */ 3011363Ssam off_t i_offset; /* seek offset in file */ 3140499Smckusick dev_t i_dev; /* associated device */ 3211363Ssam daddr_t i_bn; /* 1st block # of next read */ 3349116Sbostic char *i_ma; /* memory address of I/O buffer */ 3411363Ssam int i_cc; /* character count of transfer */ 3511363Ssam int i_error; /* error # return */ 3611363Ssam int i_errcnt; /* error count for driver retries */ 3711363Ssam int i_errblk; /* block # in error for error reporting */ 3849116Sbostic char i_buf[MAXBSIZE];/* I/O buffer */ 3949116Sbostic struct dinode i_ino; /* dinode, if file */ 4049116Sbostic union { /* file system super block info */ 4149116Sbostic struct fs ui_fs; 426004Smckusic char dummy[SBSIZE]; 436004Smckusic } i_un; 4433627Sbostic #define i_fs i_un.ui_fs 4535482Sbostic #define i_bus i_adapt 4649116Sbostic }; 47325Sbill 4849116Sbostic #define SOPEN_MAX 4 4949116Sbostic extern struct iob iob[SOPEN_MAX]; 5049116Sbostic 5149116Sbostic /* Codes for sector header word 1 */ 5233632Sbostic #define HDR1_FMT22 0x1000 /* standard 16 bit format */ 5333632Sbostic #define HDR1_OKSCT 0xc000 /* sector ok */ 5433632Sbostic #define HDR1_SSF 0x2000 /* skip sector flag */ 5533632Sbostic 5649116Sbostic /* I/O flag values */ 5735754Sbostic #define F_READ 0x0001 /* file opened for reading */ 5835754Sbostic #define F_WRITE 0x0002 /* file opened for writing */ 5935754Sbostic #define F_ALLOC 0x0004 /* buffer allocated */ 6035754Sbostic #define F_FILE 0x0008 /* file instead of device */ 6135754Sbostic #define F_NBSF 0x0010 /* no bad sector forwarding */ 6235754Sbostic #define F_ECCLM 0x0020 /* limit # of bits in ecc correction */ 6335754Sbostic #define F_SSI 0x0040 /* set skip sector inhibit */ 6435754Sbostic #define F_SEVRE 0x0080 /* Severe burnin (no retries, no ECC) */ 6533626Sbostic 6649116Sbostic /* I/O types */ 6710022Ssam #define F_RDDATA 0x0100 /* read data */ 6810022Ssam #define F_WRDATA 0x0200 /* write data */ 6933627Sbostic #define F_HDR 0x0400 /* include header on next i/o */ 7033627Sbostic #define F_CHECK 0x0800 /* perform check of data read/write */ 7133627Sbostic #define F_HCHECK 0x1000 /* perform check of header and data */ 72325Sbill 7349116Sbostic #define F_TYPEMASK 0xff00 /* I/O type mask */ 7410022Ssam 7549116Sbostic /* Lseek values */ 7633626Sbostic #define L_SET 0 /* absolute offset */ 7733626Sbostic 7849116Sbostic /* Device switch */ 79325Sbill struct devsw { 80325Sbill char *dv_name; 81325Sbill int (*dv_strategy)(); 82325Sbill int (*dv_open)(); 83325Sbill int (*dv_close)(); 8410022Ssam int (*dv_ioctl)(); 85325Sbill }; 86325Sbill 8733627Sbostic extern struct devsw devsw[]; /* device array */ 8833627Sbostic extern int ndevs; /* number of elements in devsw[] */ 89325Sbill 9033042Skarels #ifdef COMPAT_42 9111139Ssam /* 9233042Skarels * Old drive description table. 9333042Skarels * still used by some drivers for now. 9433042Skarels */ 9533042Skarels struct st { 9633042Skarels short nsect; /* # sectors/track */ 9733042Skarels short ntrak; /* # tracks/surfaces/heads */ 9833042Skarels short nspc; /* # sectors/cylinder */ 9933042Skarels short ncyl; /* # cylinders */ 10033042Skarels short *off; /* partition offset table (cylinders) */ 10133042Skarels }; 10233042Skarels #endif 103