123240Smckusick /* 235754Sbostic * Copyright (c) 1982, 1988 The Regents of the University of California. 335754Sbostic * All rights reserved. 423240Smckusick * 5*44517Sbostic * %sccs.include.redist.c% 635754Sbostic * 7*44517Sbostic * @(#)saio.h 7.15 (Berkeley) 06/28/90 823240Smckusick */ 9325Sbill 1040755Smckusick #include "../ufs/fs.h" 1140755Smckusick #include "../ufs/dinode.h" 1233627Sbostic #include "saioctl.h" 1333626Sbostic #include "saerrno.h" 1433626Sbostic 1538112Sbostic #define UNIX "/vmunix" 1633627Sbostic #define NULL 0 1733626Sbostic 18325Sbill /* 1940499Smckusick * Io block: includes an dinode, cells for the use of seek, etc., 20325Sbill * and a buffer. 21325Sbill */ 2233627Sbostic struct iob { 2311363Ssam int i_flgs; /* see F_ below */ 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 */ 2940499Smckusick struct dinode i_ino; /* dinode, if file */ 3011363Ssam daddr_t i_cyloff; /* cylinder offset on device */ 3111363Ssam off_t i_offset; /* seek offset in file */ 3240499Smckusick dev_t i_dev; /* associated device */ 3311363Ssam daddr_t i_bn; /* 1st block # of next read */ 3411363Ssam char *i_ma; /* memory address of i/o buffer */ 3511363Ssam int i_cc; /* character count of transfer */ 3611363Ssam int i_error; /* error # return */ 3711363Ssam int i_errcnt; /* error count for driver retries */ 3811363Ssam int i_errblk; /* block # in error for error reporting */ 3911363Ssam char i_buf[MAXBSIZE];/* i/o buffer */ 406004Smckusic union { 4111363Ssam struct fs ui_fs; /* file system super block info */ 426004Smckusic char dummy[SBSIZE]; 436004Smckusic } i_un; 44325Sbill }; 4535754Sbostic 4633627Sbostic #define i_fs i_un.ui_fs 4735482Sbostic #define i_bus i_adapt 48325Sbill 4933632Sbostic /* codes for sector header word 1 */ 5033632Sbostic #define HDR1_FMT22 0x1000 /* standard 16 bit format */ 5133632Sbostic #define HDR1_OKSCT 0xc000 /* sector ok */ 5233632Sbostic #define HDR1_SSF 0x2000 /* skip sector flag */ 5333632Sbostic 5435754Sbostic #define F_READ 0x0001 /* file opened for reading */ 5535754Sbostic #define F_WRITE 0x0002 /* file opened for writing */ 5635754Sbostic #define F_ALLOC 0x0004 /* buffer allocated */ 5735754Sbostic #define F_FILE 0x0008 /* file instead of device */ 5835754Sbostic #define F_NBSF 0x0010 /* no bad sector forwarding */ 5935754Sbostic #define F_ECCLM 0x0020 /* limit # of bits in ecc correction */ 6035754Sbostic #define F_SSI 0x0040 /* set skip sector inhibit */ 6135754Sbostic #define F_SEVRE 0x0080 /* Severe burnin (no retries, no ECC) */ 6233626Sbostic 6310022Ssam /* io types */ 6410022Ssam #define F_RDDATA 0x0100 /* read data */ 6510022Ssam #define F_WRDATA 0x0200 /* write data */ 6633627Sbostic #define F_HDR 0x0400 /* include header on next i/o */ 6733627Sbostic #define F_CHECK 0x0800 /* perform check of data read/write */ 6833627Sbostic #define F_HCHECK 0x1000 /* perform check of header and data */ 69325Sbill 7010022Ssam #define F_TYPEMASK 0xff00 7110022Ssam 7233627Sbostic #define READ F_READ 7333627Sbostic #define WRITE F_WRITE 7433627Sbostic 7533627Sbostic /* 7633626Sbostic * Lseek call. 7733626Sbostic */ 7833626Sbostic #define L_SET 0 /* absolute offset */ 7933626Sbostic 8033626Sbostic /* 8111363Ssam * Device switch. 82325Sbill */ 83325Sbill struct devsw { 84325Sbill char *dv_name; 85325Sbill int (*dv_strategy)(); 86325Sbill int (*dv_open)(); 87325Sbill int (*dv_close)(); 8810022Ssam int (*dv_ioctl)(); 89325Sbill }; 90325Sbill 9133627Sbostic extern struct devsw devsw[]; /* device array */ 9233627Sbostic extern int ndevs; /* number of elements in devsw[] */ 93325Sbill 9433042Skarels #ifdef COMPAT_42 9511139Ssam /* 9633042Skarels * Old drive description table. 9733042Skarels * still used by some drivers for now. 9833042Skarels */ 9933042Skarels struct st { 10033042Skarels short nsect; /* # sectors/track */ 10133042Skarels short ntrak; /* # tracks/surfaces/heads */ 10233042Skarels short nspc; /* # sectors/cylinder */ 10333042Skarels short ncyl; /* # cylinders */ 10433042Skarels short *off; /* partition offset table (cylinders) */ 10533042Skarels }; 10633042Skarels #endif 10733042Skarels 10811363Ssam #define NFILES 4 10933627Sbostic extern struct iob iob[NFILES]; 110