use modem entry in linesw to signal carrier change; split line-disc close
[unix-history] / usr / src / sys / stand.att / saio.h
CommitLineData
da7c5cc6
KM
1/*
2 * Copyright (c) 1982 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 *
6 * @(#)saio.h 6.3 (Berkeley) %G%
7 */
96dca2cc
BJ
8
9/*
06397eef 10 * Header file for standalone package
96dca2cc
BJ
11 */
12
13/*
06397eef 14 * Io block: includes an
96dca2cc
BJ
15 * inode, cells for the use of seek, etc,
16 * and a buffer.
17 */
18struct iob {
06397eef
SL
19 int i_flgs; /* see F_ below */
20 struct inode i_ino; /* inode, if file */
21 int i_unit; /* pseudo device unit */
22 daddr_t i_boff; /* block offset on device */
23 daddr_t i_cyloff; /* cylinder offset on device */
24 off_t i_offset; /* seek offset in file */
25 daddr_t i_bn; /* 1st block # of next read */
26 char *i_ma; /* memory address of i/o buffer */
27 int i_cc; /* character count of transfer */
28 int i_error; /* error # return */
29 int i_errcnt; /* error count for driver retries */
30 int i_errblk; /* block # in error for error reporting */
31 char i_buf[MAXBSIZE];/* i/o buffer */
cb31612d 32 union {
06397eef 33 struct fs ui_fs; /* file system super block info */
cb31612d
KM
34 char dummy[SBSIZE];
35 } i_un;
96dca2cc 36};
cb31612d 37#define i_fs i_un.ui_fs
e184e531 38#define NULL 0
96dca2cc 39
0839bdeb
SL
40#define F_READ 0x1 /* file opened for reading */
41#define F_WRITE 0x2 /* file opened for writing */
42#define F_ALLOC 0x4 /* buffer allocated */
43#define F_FILE 0x8 /* file instead of device */
e184e531 44#define F_NBSF 0x10 /* no bad sector forwarding */
e63fbccd
SL
45#define F_ECCLM 0x20 /* limit # of bits in ecc correction */
46#define F_SSI 0x40 /* set skip sector inhibit */
71da8ead 47#define F_SEVRE 0x80 /* Severe burnin (no retries, no ECC) */
0839bdeb
SL
48/* io types */
49#define F_RDDATA 0x0100 /* read data */
50#define F_WRDATA 0x0200 /* write data */
51#define F_HDR 0x0400 /* include header on next i/o */
52#define F_CHECK 0x0800 /* perform check of data read/write */
53#define F_HCHECK 0x1000 /* perform check of header and data */
54
55#define F_TYPEMASK 0xff00
96dca2cc
BJ
56
57/*
06397eef 58 * Device switch.
96dca2cc
BJ
59 */
60struct devsw {
61 char *dv_name;
62 int (*dv_strategy)();
63 int (*dv_open)();
64 int (*dv_close)();
0839bdeb 65 int (*dv_ioctl)();
96dca2cc
BJ
66};
67
68struct devsw devsw[];
69
e63fbccd
SL
70/*
71 * Drive description table.
72 * Returned from SAIODEVDATA call.
73 */
be8e681f 74struct st {
e63fbccd 75 short nsect; /* # sectors/track */
06397eef 76 short ntrak; /* # tracks/surfaces/heads */
e63fbccd
SL
77 short nspc; /* # sectors/cylinder */
78 short ncyl; /* # cylinders */
79 short *off; /* partition offset table (cylinders) */
e184e531
HS
80};
81
96dca2cc 82/*
06397eef 83 * Request codes. Must be the same a F_XXX above
96dca2cc
BJ
84 */
85#define READ 1
86#define WRITE 2
87
88#define NBUFS 4
89
cb31612d 90char b[NBUFS][MAXBSIZE];
96dca2cc
BJ
91daddr_t blknos[NBUFS];
92
06397eef 93#define NFILES 4
96dca2cc 94struct iob iob[NFILES];
3d2087b6 95
0839bdeb
SL
96extern int errno; /* just like unix */
97
98/* error codes */
99#define EBADF 1 /* bad file descriptor */
100#define EOFFSET 2 /* relative seek not supported */
101#define EDEV 3 /* improper device specification on open */
102#define ENXIO 4 /* unknown device specified */
103#define EUNIT 5 /* improper unit specification */
104#define ESRCH 6 /* directory search for file failed */
105#define EIO 7 /* generic error */
06397eef
SL
106#define ECMD 10 /* undefined driver command */
107#define EBSE 11 /* bad sector error */
108#define EWCK 12 /* write check error */
109#define EECC 13 /* uncorrectable ecc error */
110#define EHER 14 /* hard error */
0839bdeb
SL
111
112/* ioctl's -- for disks just now */
e184e531 113#define SAIOHDR (('d'<<8)|1) /* next i/o includes header */
0839bdeb
SL
114#define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */
115#define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */
e184e531 116#define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector forwarding */
e63fbccd
SL
117#define SAIODOBAD (('d'<<8)|5) /* enable bad sector forwarding */
118#define SAIOECCLIM (('d'<<8)|6) /* limit ecc correction to 5 bits */
e184e531 119#define SAIOECCUNL (('d'<<8)|7) /* use standard ecc procedures */
06397eef
SL
120#define SAIODEVDATA (('d'<<8)|8) /* get device data */
121#define SAIOSSI (('d'<<8)|9) /* set skip sector inhibit */
122#define SAIONOSSI (('d'<<8)|10) /* inhibit skip sector handling */
123#define SAIOSSDEV (('d'<<8)|11) /* is device skip sector type? */
124#define SAIODEBUG (('d'<<8)|12) /* enable/disable debugging */
71da8ead
MK
125#define SAIOSEVRE (('d'<<8)|13) /* severe burnin, no ECC, no retries */
126#define SAIONSEVRE (('d'<<8)|14) /* clear severe burnin */
e184e531
HS
127
128/* codes for sector header word 1 */
06397eef
SL
129#define HDR1_FMT22 0x1000 /* standard 16 bit format */
130#define HDR1_OKSCT 0xc000 /* sector ok */
131#define HDR1_SSF 0x2000 /* skip sector flag */