conf.h revision 12521
1/*-
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.3 (Berkeley) 1/21/94
39 * $Id: conf.h,v 1.22 1995/11/06 00:36:14 bde Exp $
40 */
41
42#ifndef _SYS_CONF_H_
43#define	_SYS_CONF_H_
44
45/*
46 * Definitions of device driver entry switches
47 */
48
49struct buf;
50struct proc;
51struct tty;
52struct uio;
53struct vnode;
54
55typedef void d_strategy_t __P((struct buf *));
56typedef int d_open_t __P((dev_t, int, int, struct proc *));
57typedef int d_close_t __P((dev_t, int, int, struct proc *));
58typedef int d_ioctl_t __P((dev_t, int, caddr_t, int, struct proc *));
59typedef int d_dump_t __P((dev_t));
60typedef int d_psize_t __P((dev_t));
61
62typedef int d_read_t __P((dev_t, struct uio *, int));
63typedef int d_write_t __P((dev_t, struct uio *, int));
64typedef int d_rdwr_t __P((dev_t, struct uio *, int));
65typedef void d_stop_t __P((struct tty *, int));
66typedef int d_reset_t __P((dev_t));
67typedef struct tty *d_devtotty_t __P((dev_t));
68typedef int d_select_t __P((dev_t, int, struct proc *));
69typedef int d_mmap_t __P((dev_t, int, int));
70typedef	struct tty * d_ttycv_t __P((dev_t));
71
72typedef int l_open_t __P((dev_t dev, struct tty *tp));
73typedef int l_close_t __P((struct tty *tp, int flag));
74typedef int l_read_t __P((struct tty *tp, struct uio *uio, int flag));
75typedef int l_write_t __P((struct tty *tp, struct uio *uio, int flag));
76typedef int l_ioctl_t __P((struct tty *tp, int cmd, caddr_t data, int flag,
77			   struct proc *p));
78typedef int l_rint_t __P((int c, struct tty *tp));
79typedef int l_start_t __P((struct tty *tp));
80typedef int l_modem_t __P((struct tty *tp, int flag));
81
82struct bdevsw {
83	d_open_t	*d_open;
84	d_close_t	*d_close;
85	d_strategy_t	*d_strategy;
86	d_ioctl_t	*d_ioctl;
87	d_dump_t	*d_dump;
88	d_psize_t	*d_psize;
89	int		d_flags;
90};
91
92#ifdef KERNEL
93extern struct bdevsw bdevsw[];
94#endif
95
96struct cdevsw {
97	d_open_t	*d_open;
98	d_close_t	*d_close;
99	d_rdwr_t	*d_read;
100	d_rdwr_t	*d_write;
101	d_ioctl_t	*d_ioctl;
102	d_stop_t	*d_stop;
103	d_reset_t	*d_reset;	/* XXX not used */
104	d_ttycv_t	*d_devtotty;
105	d_select_t	*d_select;
106	d_mmap_t	*d_mmap;
107	d_strategy_t	*d_strategy;
108};
109
110#ifdef KERNEL
111extern struct cdevsw cdevsw[];
112#endif
113
114struct linesw {
115	l_open_t	*l_open;
116	l_close_t	*l_close;
117	l_read_t	*l_read;
118	l_write_t	*l_write;
119	l_ioctl_t	*l_ioctl;
120	l_rint_t	*l_rint;
121	l_start_t	*l_start;
122	l_modem_t	*l_modem;
123};
124
125#ifdef KERNEL
126extern struct linesw linesw[];
127extern int nlinesw;
128
129int ldisc_register __P((int , struct linesw *));
130void ldisc_deregister __P((int));
131#define LDISC_LOAD 	-1		/* Loadable line discipline */
132#endif
133
134struct swdevt {
135	dev_t	sw_dev;
136	int	sw_flags;
137	int	sw_nblks;
138	struct	vnode *sw_vp;
139};
140#define	SW_FREED	0x01
141#define	SW_SEQUENTIAL	0x02
142#define sw_freed	sw_flags	/* XXX compat */
143
144#ifdef KERNEL
145d_open_t	noopen;
146d_close_t	noclose;
147d_read_t	noread;
148d_write_t	nowrite;
149d_ioctl_t	noioctl;
150d_stop_t	nostop;
151d_reset_t	noreset;
152d_devtotty_t	nodevtotty;
153d_select_t	noselect;
154d_mmap_t	nommap;
155
156#ifdef JREMOD
157/* Bogus defines for compatibility. */
158#define	noioc		noioctl
159#define	nostrat		nostrategy
160#define zerosize	nopsize
161#endif /*JREMOD*/
162/*
163 * XXX d_strategy seems to be unused for cdevs that aren't associated with
164 * bdevs and called without checking for it being non-NULL for bdevs.
165 */
166#define	nostrategy	((d_strategy_t *)NULL)
167
168d_dump_t	nodump;
169
170/*
171 * nopsize is little used, so not worth having dummy functions for.
172 */
173#define	nopsize	((d_psize_t *)NULL)
174
175d_open_t	nullopen;
176d_close_t	nullclose;
177#define	nullstop nostop		/* one void return is as good as another */
178#define	nullreset noreset	/* one unused function is as good as another */
179
180d_open_t	nxopen;
181d_close_t	nxclose;
182d_read_t	nxread;
183d_write_t	nxwrite;
184d_ioctl_t	nxioctl;
185#define	nxstop	nostop		/* one void return is as good as another */
186#define	nxreset	noreset		/* one unused function is as good as another */
187#define	nxdevtotty nodevtotty	/* one NULL return is as good as another */
188d_select_t	nxselect;
189#define	nxmmap	nommap		/* one -1 return is as good as another */
190#define	nxstrategy nostrategy	/* one NULL value is as good as another */
191d_dump_t	nxdump;
192#define	nxpsize	nopsize		/* one NULL value is as good as another */
193
194l_read_t	l_noread;
195l_write_t	l_nowrite;
196
197dev_t	chrtoblk __P((dev_t dev));
198int	getmajorbyname __P((const char *name));
199int	isdisk __P((dev_t dev, int type));
200int	iskmemdev __P((dev_t dev));
201int	iszerodev __P((dev_t dev));
202int	register_cdev __P((const char *name, const struct cdevsw *cdp));
203int	setdumpdev __P((dev_t));
204int	unregister_cdev __P((const char *name, const struct cdevsw *cdp));
205#ifdef JREMOD
206int	cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw *old));
207int	bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw *old));
208#endif
209#endif /* KERNEL */
210
211#include <machine/conf.h>
212
213#endif /* !_SYS_CONF_H_ */
214