tty_conf.c revision 1.23 1 /* $NetBSD: tty_conf.c,v 1.23 1998/07/31 22:50:52 perry Exp $ */
2
3 /*-
4 * Copyright (c) 1982, 1986, 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. All advertising materials mentioning features or use of this software
21 * must display the following acknowledgement:
22 * This product includes software developed by the University of
23 * California, Berkeley and its contributors.
24 * 4. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 * @(#)tty_conf.c 8.5 (Berkeley) 1/9/95
41 */
42
43 #include "opt_compat_freebsd.h"
44
45 #include <sys/param.h>
46 #include <sys/systm.h>
47 #include <sys/buf.h>
48 #include <sys/ioctl.h>
49 #include <sys/proc.h>
50 #include <sys/tty.h>
51 #include <sys/conf.h>
52
53 #define ttynodisc ((int (*) __P((dev_t, struct tty *)))enodev)
54 #define ttyerrclose ((int (*) __P((struct tty *, int flags)))enodev)
55 #define ttyerrio ((int (*) __P((struct tty *, struct uio *, int)))enodev)
56 #define ttyerrinput ((int (*) __P((int c, struct tty *)))enodev)
57 #define ttyerrstart ((int (*) __P((struct tty *)))enodev)
58
59 int nullioctl __P((struct tty *, u_long, caddr_t, int, struct proc *));
60
61 #include "tb.h"
62 #if NTB > 0
63 int tbopen __P((dev_t dev, struct tty *tp));
64 int tbclose __P((struct tty *tp, int flags));
65 int tbread __P((struct tty *tp, struct uio *uio, int flags));
66 int tbtioctl __P((struct tty *tp, u_long cmd, caddr_t data,
67 int flag, struct proc *p));
68 int tbinput __P((int c, struct tty *tp));
69 #endif
70
71 #include "sl.h"
72 #if NSL > 0
73 int slopen __P((dev_t dev, struct tty *tp));
74 int slclose __P((struct tty *tp, int flags));
75 int sltioctl __P((struct tty *tp, u_long cmd, caddr_t data,
76 int flag, struct proc *p));
77 int slinput __P((int c, struct tty *tp));
78 int slstart __P((struct tty *tp));
79 #endif
80
81 #include "ppp.h"
82 #if NPPP > 0
83 int pppopen __P((dev_t dev, struct tty *tp));
84 int pppclose __P((struct tty *tp, int flags));
85 int ppptioctl __P((struct tty *tp, u_long cmd, caddr_t data,
86 int flag, struct proc *p));
87 int pppinput __P((int c, struct tty *tp));
88 int pppstart __P((struct tty *tp));
89 int pppread __P((struct tty *tp, struct uio *uio, int flag));
90 int pppwrite __P((struct tty *tp, struct uio *uio, int flag));
91 #endif
92
93 #include "strip.h"
94 #if NSTRIP > 0
95 int stripopen __P((dev_t dev, struct tty *tp));
96 int stripclose __P((struct tty *tp, int flags));
97 int striptioctl __P((struct tty *tp, u_long cmd, caddr_t data,
98 int flag, struct proc *p));
99 int stripinput __P((int c, struct tty *tp));
100 int stripstart __P((struct tty *tp));
101 #endif
102
103 struct linesw linesw[] =
104 {
105 { ttylopen, ttylclose, ttread, ttwrite, nullioctl,
106 ttyinput, ttstart, ttymodem }, /* 0- termios */
107
108 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
109 ttyerrinput, ttyerrstart, nullmodem }, /* 1- defunct */
110
111 #if defined(COMPAT_43) || defined(COMPAT_FREEBSD)
112 { ttylopen, ttylclose, ttread, ttwrite, nullioctl,
113 ttyinput, ttstart, ttymodem }, /* 2- old NTTYDISC */
114 #else
115 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
116 ttyerrinput, ttyerrstart, nullmodem }, /* 2- defunct */
117 #endif
118
119 #if NTB > 0
120 { tbopen, tbclose, tbread, ttyerrio, tbtioctl,
121 tbinput, ttstart, nullmodem }, /* 3- TABLDISC */
122 #else
123 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
124 ttyerrinput, ttyerrstart, nullmodem },
125 #endif
126
127 #if NSL > 0
128 { slopen, slclose, ttyerrio, ttyerrio, sltioctl,
129 slinput, slstart, nullmodem }, /* 4- SLIPDISC */
130 #else
131 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
132 ttyerrinput, ttyerrstart, nullmodem },
133 #endif
134
135 #if NPPP > 0
136 { pppopen, pppclose, pppread, pppwrite, ppptioctl,
137 pppinput, pppstart, ttymodem }, /* 5- PPPDISC */
138 #else
139 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
140 ttyerrinput, ttyerrstart, nullmodem },
141 #endif
142
143 #if NSTRIP > 0
144 { stripopen, stripclose, ttyerrio, ttyerrio, striptioctl,
145 stripinput, stripstart, nullmodem }, /* 6- STRIPDISC */
146 #else
147 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
148 ttyerrinput, ttyerrstart, nullmodem },
149 #endif
150 };
151
152 int nlinesw = sizeof(linesw) / sizeof(linesw[0]);
153
154 /*
155 * Do nothing specific version of line
156 * discipline specific ioctl command.
157 */
158 /*ARGSUSED*/
159 int
160 nullioctl(tp, cmd, data, flags, p)
161 struct tty *tp;
162 u_long cmd;
163 char *data;
164 int flags;
165 struct proc *p;
166 {
167
168 #ifdef lint
169 tp = tp; data = data; flags = flags; p = p;
170 #endif
171 return (-1);
172 }
173