conf.h revision 8876
1223519Shselasky/*-
2223519Shselasky * Copyright (c) 1990, 1993
3223519Shselasky *	The Regents of the University of California.  All rights reserved.
4223519Shselasky * (c) UNIX System Laboratories, Inc.
5223519Shselasky * All or some portions of this file are derived from material licensed
6223519Shselasky * to the University of California by American Telephone and Telegraph
7223519Shselasky * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8223519Shselasky * the permission of UNIX System Laboratories, Inc.
9223519Shselasky *
10223519Shselasky * Redistribution and use in source and binary forms, with or without
11223519Shselasky * modification, are permitted provided that the following conditions
12223519Shselasky * are met:
13223519Shselasky * 1. Redistributions of source code must retain the above copyright
14223519Shselasky *    notice, this list of conditions and the following disclaimer.
15223519Shselasky * 2. Redistributions in binary form must reproduce the above copyright
16223519Shselasky *    notice, this list of conditions and the following disclaimer in the
17223519Shselasky *    documentation and/or other materials provided with the distribution.
18223519Shselasky * 3. All advertising materials mentioning features or use of this software
19223519Shselasky *    must display the following acknowledgement:
20223519Shselasky *	This product includes software developed by the University of
21223519Shselasky *	California, Berkeley and its contributors.
22223519Shselasky * 4. Neither the name of the University nor the names of its contributors
23223519Shselasky *    may be used to endorse or promote products derived from this software
24223519Shselasky *    without specific prior written permission.
25223519Shselasky *
26223519Shselasky * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27223519Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28223519Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29223519Shselasky * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30223519Shselasky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31223519Shselasky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32223519Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33223519Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34223519Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35223519Shselasky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36223519Shselasky * SUCH DAMAGE.
37223519Shselasky *
38223519Shselasky *	@(#)conf.h	8.3 (Berkeley) 1/21/94
39223519Shselasky * $Id: conf.h,v 1.14 1995/05/14 03:00:03 davidg Exp $
40223519Shselasky */
41223519Shselasky
42223519Shselasky#ifndef _SYS_CONF_H_
43223519Shselasky#define	_SYS_CONF_H_
44223519Shselasky
45223519Shselasky/*
46223519Shselasky * Definitions of device driver entry switches
47223519Shselasky */
48223519Shselasky
49223519Shselaskystruct buf;
50223519Shselaskystruct proc;
51223519Shselaskystruct tty;
52223519Shselaskystruct uio;
53223519Shselaskystruct vnode;
54223519Shselasky
55223519Shselaskytypedef void d_strategy_t __P((struct buf *));
56223519Shselaskytypedef int d_open_t __P((dev_t, int, int, struct proc *));
57223519Shselaskytypedef int d_close_t __P((dev_t, int, int, struct proc *));
58223519Shselaskytypedef int d_ioctl_t __P((dev_t, int, caddr_t, int, struct proc *));
59223519Shselaskytypedef int d_dump_t __P((dev_t));
60223519Shselaskytypedef int d_psize_t __P((dev_t));
61223519Shselasky
62223519Shselaskytypedef int d_read_t __P((dev_t, struct uio *, int));
63223519Shselaskytypedef int d_write_t __P((dev_t, struct uio *, int));
64223519Shselaskytypedef int d_rdwr_t __P((dev_t, struct uio *, int));
65223519Shselaskytypedef int d_stop_t __P((struct tty *, int));
66223519Shselaskytypedef int d_reset_t __P((int));
67223519Shselaskytypedef int d_select_t __P((dev_t, int, struct proc *));
68223519Shselaskytypedef int d_mmap_t __P((dev_t, int, int));
69223519Shselaskytypedef	struct tty * d_ttycv_t __P((dev_t));
70223519Shselasky
71223519Shselaskystruct bdevsw {
72223519Shselasky	d_open_t	*d_open;
73223519Shselasky	d_close_t	*d_close;
74223519Shselasky	d_strategy_t	*d_strategy;
75223519Shselasky	d_ioctl_t	*d_ioctl;
76223519Shselasky	d_dump_t	*d_dump;
77223519Shselasky	d_psize_t	*d_psize;
78223519Shselasky	int		d_flags;
79223519Shselasky};
80223519Shselasky
81223519Shselasky#ifdef KERNEL
82223519Shselaskyextern struct bdevsw bdevsw[];
83223519Shselasky#endif
84223519Shselasky
85223519Shselaskystruct cdevsw {
86223519Shselasky	d_open_t	*d_open;
87223519Shselasky	d_close_t	*d_close;
88223519Shselasky	d_rdwr_t	*d_read;
89223521Shselasky	d_rdwr_t	*d_write;
90223521Shselasky	d_ioctl_t	*d_ioctl;
91223521Shselasky	d_stop_t	*d_stop;
92223521Shselasky	d_reset_t	*d_reset;
93223521Shselasky	d_ttycv_t	*d_devtotty;
94223521Shselasky	d_select_t	*d_select;
95223521Shselasky	d_mmap_t	*d_mmap;
96223521Shselasky	d_strategy_t	*d_strategy;
97223519Shselasky};
98223519Shselasky
99223519Shselasky#ifdef KERNEL
100223519Shselaskyextern struct cdevsw cdevsw[];
101223519Shselasky
102223519Shselasky/* symbolic sleep message strings */
103223519Shselaskyextern char devopn[], devio[], devwait[], devin[], devout[];
104223519Shselaskyextern char devioc[], devcls[];
105223519Shselasky#endif
106223519Shselasky
107223519Shselaskystruct linesw {
108223519Shselasky	int	(*l_open)	__P((dev_t dev, struct tty *tp));
109223519Shselasky	int	(*l_close)	__P((struct tty *tp, int flag));
110223519Shselasky	int	(*l_read)	__P((struct tty *tp, struct uio *uio,
111223519Shselasky				     int flag));
112223519Shselasky	int	(*l_write)	__P((struct tty *tp, struct uio *uio,
113223519Shselasky				     int flag));
114223519Shselasky	int	(*l_ioctl)	__P((struct tty *tp, int cmd, caddr_t data,
115223519Shselasky				     int flag, struct proc *p));
116223519Shselasky	int	(*l_rint)	__P((int c, struct tty *tp));
117223519Shselasky	int	(*l_start)	__P((struct tty *tp));
118223519Shselasky	int	(*l_modem)	__P((struct tty *tp, int flag));
119223519Shselasky};
120223519Shselasky
121223519Shselasky#ifdef KERNEL
122223519Shselaskyextern struct linesw linesw[];
123223519Shselaskyextern int nlinesw;
124223519Shselasky
125223519Shselaskyint ldisc_register __P((int , struct linesw *));
126223519Shselaskyvoid ldisc_deregister __P((int));
127223519Shselasky#define LDISC_LOAD 	-1		/* Loadable line discipline */
128223519Shselasky#endif
129223519Shselasky
130223519Shselaskystruct swdevt {
131223519Shselasky	dev_t	sw_dev;
132223519Shselasky	int	sw_flags;
133223519Shselasky	int	sw_nblks;
134223519Shselasky	struct	vnode *sw_vp;
135223519Shselasky};
136223519Shselasky#define	SW_FREED	0x01
137223519Shselasky#define	SW_SEQUENTIAL	0x02
138223519Shselasky#define sw_freed	sw_flags	/* XXX compat */
139223519Shselasky
140223519Shselasky#ifdef KERNEL
141223519Shselaskyextern int setdumpdev __P((dev_t));
142223519Shselasky
143223519Shselaskydev_t	chrtoblk __P((dev_t dev));
144223519Shselaskyint	isdisk __P((dev_t dev, int type));
145223519Shselaskyint	iskmemdev __P((dev_t dev));
146223519Shselaskyint	iszerodev __P((dev_t dev));
147223519Shselasky#endif
148223519Shselasky
149223519Shselasky#endif /* !_SYS_CONF_H_ */
150223519Shselasky