conf.h revision 12071
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.18 1995/10/04 03:43:18 julian 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((int));
67typedef int d_select_t __P((dev_t, int, struct proc *));
68typedef int d_mmap_t __P((dev_t, int, int));
69typedef	struct tty * d_ttycv_t __P((dev_t));
70
71struct bdevsw {
72	d_open_t	*d_open;
73	d_close_t	*d_close;
74	d_strategy_t	*d_strategy;
75	d_ioctl_t	*d_ioctl;
76	d_dump_t	*d_dump;
77	d_psize_t	*d_psize;
78	int		d_flags;
79};
80
81#ifdef KERNEL
82extern struct bdevsw bdevsw[];
83#endif
84
85struct cdevsw {
86	d_open_t	*d_open;
87	d_close_t	*d_close;
88	d_rdwr_t	*d_read;
89	d_rdwr_t	*d_write;
90	d_ioctl_t	*d_ioctl;
91	d_stop_t	*d_stop;
92	d_reset_t	*d_reset;
93	d_ttycv_t	*d_devtotty;
94	d_select_t	*d_select;
95	d_mmap_t	*d_mmap;
96	d_strategy_t	*d_strategy;
97};
98
99#ifdef KERNEL
100extern struct cdevsw cdevsw[];
101
102/* symbolic sleep message strings */
103extern char devopn[], devio[], devwait[], devin[], devout[];
104extern char devioc[], devcls[];
105#endif
106
107struct linesw {
108	int	(*l_open)	__P((dev_t dev, struct tty *tp));
109	int	(*l_close)	__P((struct tty *tp, int flag));
110	int	(*l_read)	__P((struct tty *tp, struct uio *uio,
111				     int flag));
112	int	(*l_write)	__P((struct tty *tp, struct uio *uio,
113				     int flag));
114	int	(*l_ioctl)	__P((struct tty *tp, int cmd, caddr_t data,
115				     int flag, struct proc *p));
116	int	(*l_rint)	__P((int c, struct tty *tp));
117	int	(*l_start)	__P((struct tty *tp));
118	int	(*l_modem)	__P((struct tty *tp, int flag));
119};
120
121#ifdef KERNEL
122extern struct linesw linesw[];
123extern int nlinesw;
124
125int ldisc_register __P((int , struct linesw *));
126void ldisc_deregister __P((int));
127#define LDISC_LOAD 	-1		/* Loadable line discipline */
128#endif
129
130struct swdevt {
131	dev_t	sw_dev;
132	int	sw_flags;
133	int	sw_nblks;
134	struct	vnode *sw_vp;
135};
136#define	SW_FREED	0x01
137#define	SW_SEQUENTIAL	0x02
138#define sw_freed	sw_flags	/* XXX compat */
139
140#ifdef KERNEL
141d_reset_t	noreset;
142d_mmap_t	nommap;
143d_strategy_t	nostrategy;
144
145d_open_t	nullopen;
146d_close_t	nullclose;
147d_stop_t	nullstop;
148d_reset_t	nullreset;
149/*
150 * XXX d_strategy seems to be unused for cdevs and called without checking
151 * for it being non-NULL for bdevs.
152 */
153#define	nullstrategy	((d_strategy *)NULL)
154
155dev_t	chrtoblk __P((dev_t dev));
156int	getmajorbyname __P((const char *name));
157int	isdisk __P((dev_t dev, int type));
158int	iskmemdev __P((dev_t dev));
159int	iszerodev __P((dev_t dev));
160int	register_cdev __P((const char *name, const struct cdevsw *cdp));
161int	setdumpdev __P((dev_t));
162int	unregister_cdev __P((const char *name, const struct cdevsw *cdp));
163#ifdef JREMOD
164int	cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw *old));
165int	bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw *old));
166#endif
167#endif
168
169#include <machine/conf.h>
170
171#endif /* !_SYS_CONF_H_ */
172