1 |
30 |
unneback |
/*-
|
2 |
|
|
* Copyright (c) 1990, 1993
|
3 |
|
|
* The Regents of the University of California. All rights reserved.
|
4 |
|
|
* (c) UNIX System Laboratories, Inc.
|
5 |
|
|
* All or some portions of this file are derived from material licensed
|
6 |
|
|
* to the University of California by American Telephone and Telegraph
|
7 |
|
|
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
8 |
|
|
* the permission of UNIX System Laboratories, Inc.
|
9 |
|
|
*
|
10 |
|
|
* Redistribution and use in source and binary forms, with or without
|
11 |
|
|
* modification, are permitted provided that the following conditions
|
12 |
|
|
* are met:
|
13 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
14 |
|
|
* notice, this list of conditions and the following disclaimer.
|
15 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
16 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
17 |
|
|
* documentation and/or other materials provided with the distribution.
|
18 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
19 |
|
|
* must display the following acknowledgement:
|
20 |
|
|
* This product includes software developed by the University of
|
21 |
|
|
* California, Berkeley and its contributors.
|
22 |
|
|
* 4. Neither the name of the University nor the names of its contributors
|
23 |
|
|
* may be used to endorse or promote products derived from this software
|
24 |
|
|
* without specific prior written permission.
|
25 |
|
|
*
|
26 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
27 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
28 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
29 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
30 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
31 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
32 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
33 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
34 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
35 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
36 |
|
|
* SUCH DAMAGE.
|
37 |
|
|
*
|
38 |
|
|
* @(#)conf.h 8.5 (Berkeley) 1/9/95
|
39 |
|
|
* $Id: conf.h,v 1.2 2001-09-27 12:02:00 chris Exp $
|
40 |
|
|
*/
|
41 |
|
|
|
42 |
|
|
#ifndef _SYS_CONF_H_
|
43 |
|
|
#define _SYS_CONF_H_
|
44 |
|
|
|
45 |
|
|
/*
|
46 |
|
|
* Definitions of device driver entry switches
|
47 |
|
|
*/
|
48 |
|
|
|
49 |
|
|
struct buf;
|
50 |
|
|
struct proc;
|
51 |
|
|
struct tty;
|
52 |
|
|
struct uio;
|
53 |
|
|
struct vnode;
|
54 |
|
|
|
55 |
|
|
typedef int d_open_t __P((dev_t dev, int oflags, int devtype, struct proc *p));
|
56 |
|
|
typedef int d_close_t __P((dev_t dev, int fflag, int devtype, struct proc *p));
|
57 |
|
|
typedef void d_strategy_t __P((struct buf *bp));
|
58 |
|
|
typedef int d_ioctl_t __P((dev_t dev, int cmd, caddr_t data,
|
59 |
|
|
int fflag, struct proc *p));
|
60 |
|
|
typedef int d_dump_t __P((dev_t dev));
|
61 |
|
|
typedef int d_psize_t __P((dev_t dev));
|
62 |
|
|
|
63 |
|
|
typedef int d_read_t __P((dev_t dev, struct uio *uio, int ioflag));
|
64 |
|
|
typedef int d_write_t __P((dev_t dev, struct uio *uio, int ioflag));
|
65 |
|
|
typedef void d_stop_t __P((struct tty *tp, int rw));
|
66 |
|
|
typedef int d_reset_t __P((dev_t dev));
|
67 |
|
|
typedef struct tty *d_devtotty_t __P((dev_t dev));
|
68 |
|
|
typedef int d_select_t __P((dev_t dev, int which, struct proc *p));
|
69 |
|
|
typedef int d_mmap_t __P((dev_t dev, int offset, int nprot));
|
70 |
|
|
|
71 |
|
|
typedef int l_open_t __P((dev_t dev, struct tty *tp));
|
72 |
|
|
typedef int l_close_t __P((struct tty *tp, int flag));
|
73 |
|
|
typedef int l_read_t __P((struct tty *tp, struct uio *uio, int flag));
|
74 |
|
|
typedef int l_write_t __P((struct tty *tp, struct uio *uio, int flag));
|
75 |
|
|
typedef int l_ioctl_t __P((struct tty *tp, int cmd, caddr_t data,
|
76 |
|
|
int flag, struct proc *p));
|
77 |
|
|
typedef int l_rint_t __P((int c, struct tty *tp));
|
78 |
|
|
typedef int l_start_t __P((struct tty *tp));
|
79 |
|
|
typedef int l_modem_t __P((struct tty *tp, int flag));
|
80 |
|
|
|
81 |
|
|
/*
|
82 |
|
|
* Block device switch table
|
83 |
|
|
*/
|
84 |
|
|
struct bdevsw {
|
85 |
|
|
d_open_t *d_open;
|
86 |
|
|
d_close_t *d_close;
|
87 |
|
|
d_strategy_t *d_strategy;
|
88 |
|
|
d_ioctl_t *d_ioctl;
|
89 |
|
|
d_dump_t *d_dump;
|
90 |
|
|
d_psize_t *d_psize;
|
91 |
|
|
int d_flags;
|
92 |
|
|
char *d_name; /* name of the driver e.g. audio */
|
93 |
|
|
struct cdevsw *d_cdev; /* cross pointer to the cdev */
|
94 |
|
|
int d_maj; /* the major number we were assigned */
|
95 |
|
|
};
|
96 |
|
|
|
97 |
|
|
#ifdef KERNEL
|
98 |
|
|
extern struct bdevsw *bdevsw[];
|
99 |
|
|
#endif
|
100 |
|
|
|
101 |
|
|
/*
|
102 |
|
|
* Character device switch table
|
103 |
|
|
*/
|
104 |
|
|
struct cdevsw {
|
105 |
|
|
d_open_t *d_open;
|
106 |
|
|
d_close_t *d_close;
|
107 |
|
|
d_read_t *d_read;
|
108 |
|
|
d_write_t *d_write;
|
109 |
|
|
d_ioctl_t *d_ioctl;
|
110 |
|
|
d_stop_t *d_stop;
|
111 |
|
|
d_reset_t *d_reset; /* XXX not used */
|
112 |
|
|
d_devtotty_t *d_devtotty;
|
113 |
|
|
d_select_t *d_select;
|
114 |
|
|
d_mmap_t *d_mmap;
|
115 |
|
|
d_strategy_t *d_strategy;
|
116 |
|
|
char *d_name; /* see above */
|
117 |
|
|
struct bdevsw *d_bdev;
|
118 |
|
|
int d_maj;
|
119 |
|
|
};
|
120 |
|
|
|
121 |
|
|
#ifdef KERNEL
|
122 |
|
|
extern struct cdevsw *cdevsw[];
|
123 |
|
|
#endif
|
124 |
|
|
|
125 |
|
|
/*
|
126 |
|
|
* Line discipline switch table
|
127 |
|
|
*/
|
128 |
|
|
struct linesw {
|
129 |
|
|
l_open_t *l_open;
|
130 |
|
|
l_close_t *l_close;
|
131 |
|
|
l_read_t *l_read;
|
132 |
|
|
l_write_t *l_write;
|
133 |
|
|
l_ioctl_t *l_ioctl;
|
134 |
|
|
l_rint_t *l_rint;
|
135 |
|
|
l_start_t *l_start;
|
136 |
|
|
l_modem_t *l_modem;
|
137 |
|
|
};
|
138 |
|
|
|
139 |
|
|
#ifdef KERNEL
|
140 |
|
|
extern struct linesw linesw[];
|
141 |
|
|
extern int nlinesw;
|
142 |
|
|
|
143 |
|
|
int ldisc_register __P((int , struct linesw *));
|
144 |
|
|
void ldisc_deregister __P((int));
|
145 |
|
|
#define LDISC_LOAD -1 /* Loadable line discipline */
|
146 |
|
|
#endif
|
147 |
|
|
|
148 |
|
|
/*
|
149 |
|
|
* Swap device table
|
150 |
|
|
*/
|
151 |
|
|
struct swdevt {
|
152 |
|
|
dev_t sw_dev;
|
153 |
|
|
int sw_flags;
|
154 |
|
|
int sw_nblks;
|
155 |
|
|
struct vnode *sw_vp;
|
156 |
|
|
};
|
157 |
|
|
#define SW_FREED 0x01
|
158 |
|
|
#define SW_SEQUENTIAL 0x02
|
159 |
|
|
#define sw_freed sw_flags /* XXX compat */
|
160 |
|
|
|
161 |
|
|
#ifdef KERNEL
|
162 |
|
|
d_open_t noopen;
|
163 |
|
|
d_close_t noclose;
|
164 |
|
|
d_read_t noread;
|
165 |
|
|
d_write_t nowrite;
|
166 |
|
|
d_ioctl_t noioctl;
|
167 |
|
|
d_stop_t nostop;
|
168 |
|
|
d_reset_t noreset;
|
169 |
|
|
d_devtotty_t nodevtotty;
|
170 |
|
|
d_select_t noselect;
|
171 |
|
|
d_mmap_t nommap;
|
172 |
|
|
|
173 |
|
|
/* Bogus defines for compatibility. */
|
174 |
|
|
#define noioc noioctl
|
175 |
|
|
#define nostrat nostrategy
|
176 |
|
|
#define zerosize nopsize
|
177 |
|
|
/*
|
178 |
|
|
* XXX d_strategy seems to be unused for cdevs that aren't associated with
|
179 |
|
|
* bdevs and called without checking for it being non-NULL for bdevs.
|
180 |
|
|
*/
|
181 |
|
|
#define nostrategy ((d_strategy_t *)NULL)
|
182 |
|
|
|
183 |
|
|
d_dump_t nodump;
|
184 |
|
|
|
185 |
|
|
/*
|
186 |
|
|
* nopsize is little used, so not worth having dummy functions for.
|
187 |
|
|
*/
|
188 |
|
|
#define nopsize ((d_psize_t *)NULL)
|
189 |
|
|
|
190 |
|
|
d_open_t nullopen;
|
191 |
|
|
d_close_t nullclose;
|
192 |
|
|
#define nullstop nostop /* one void return is as good as another */
|
193 |
|
|
#define nullreset noreset /* one unused function is as good as another */
|
194 |
|
|
|
195 |
|
|
d_open_t nxopen;
|
196 |
|
|
d_close_t nxclose;
|
197 |
|
|
d_read_t nxread;
|
198 |
|
|
d_write_t nxwrite;
|
199 |
|
|
d_ioctl_t nxioctl;
|
200 |
|
|
#define nxstop nostop /* one void return is as good as another */
|
201 |
|
|
#define nxreset noreset /* one unused function is as good as another */
|
202 |
|
|
#define nxdevtotty nodevtotty /* one NULL return is as good as another */
|
203 |
|
|
d_select_t nxselect;
|
204 |
|
|
#define nxmmap nommap /* one -1 return is as good as another */
|
205 |
|
|
#define nxstrategy nostrategy /* one NULL value is as good as another */
|
206 |
|
|
d_dump_t nxdump;
|
207 |
|
|
#define nxpsize nopsize /* one NULL value is as good as another */
|
208 |
|
|
|
209 |
|
|
d_read_t rawread;
|
210 |
|
|
d_write_t rawwrite;
|
211 |
|
|
|
212 |
|
|
l_read_t l_noread;
|
213 |
|
|
l_write_t l_nowrite;
|
214 |
|
|
|
215 |
|
|
int bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw **old));
|
216 |
|
|
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw **old));
|
217 |
|
|
void cdevsw_make __P((struct bdevsw *from));
|
218 |
|
|
void bdevsw_add_generic __P((int bdev, int cdev, struct bdevsw *bdevsw));
|
219 |
|
|
dev_t chrtoblk __P((dev_t dev));
|
220 |
|
|
int isdisk __P((dev_t dev, int type));
|
221 |
|
|
int iskmemdev __P((dev_t dev));
|
222 |
|
|
int iszerodev __P((dev_t dev));
|
223 |
|
|
void setconf __P((void));
|
224 |
|
|
#endif /* KERNEL */
|
225 |
|
|
|
226 |
|
|
#include <machine/conf.h>
|
227 |
|
|
|
228 |
|
|
#endif /* !_SYS_CONF_H_ */
|