tty_conf.c revision 1.17 1 /* $NetBSD: tty_conf.c,v 1.17 1996/02/04 02:17:22 christos 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.4 (Berkeley) 1/21/94
41 */
42
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/buf.h>
46 #include <sys/ioctl.h>
47 #include <sys/proc.h>
48 #include <sys/tty.h>
49 #include <sys/conf.h>
50
51 #define ttynodisc ((int (*) __P((dev_t, struct tty *)))enodev)
52 #define ttyerrclose ((int (*) __P((struct tty *, int flags)))enodev)
53 #define ttyerrio ((int (*) __P((struct tty *, struct uio *, int)))enodev)
54 #define ttyerrinput ((int (*) __P((int c, struct tty *)))enodev)
55 #define ttyerrstart ((int (*) __P((struct tty *)))enodev)
56
57 int nullioctl __P((struct tty *, u_long, caddr_t, int, struct proc *));
58
59 #include "tb.h"
60 #if NTB > 0
61 int tbopen __P((dev_t dev, struct tty *tp));
62 int tbclose __P((struct tty *tp, int flags));
63 int tbread __P((struct tty *tp, struct uio *uio, int flags));
64 int tbtioctl __P((struct tty *tp, u_long cmd, caddr_t data,
65 int flag, struct proc *p));
66 int tbinput __P((int c, struct tty *tp));
67 #endif
68
69 #include "sl.h"
70 #if NSL > 0
71 int slopen __P((dev_t dev, struct tty *tp));
72 int slclose __P((struct tty *tp, int flags));
73 int sltioctl __P((struct tty *tp, u_long cmd, caddr_t data,
74 int flag, struct proc *p));
75 int slinput __P((int c, struct tty *tp));
76 int slstart __P((struct tty *tp));
77 #endif
78
79 #include "ppp.h"
80 #if NPPP > 0
81 int pppopen __P((dev_t dev, struct tty *tp));
82 int pppclose __P((struct tty *tp, int flags));
83 int ppptioctl __P((struct tty *tp, u_long cmd, caddr_t data,
84 int flag, struct proc *p));
85 int pppinput __P((int c, struct tty *tp));
86 int pppstart __P((struct tty *tp));
87 int pppread __P((struct tty *tp, struct uio *uio, int flag));
88 int pppwrite __P((struct tty *tp, struct uio *uio, int flag));
89 #endif
90
91 struct linesw linesw[] =
92 {
93 { ttyopen, ttylclose, ttread, ttwrite, nullioctl,
94 ttyinput, ttstart, ttymodem }, /* 0- termios */
95
96 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
97 ttyerrinput, ttyerrstart, nullmodem }, /* 1- defunct */
98
99 #if defined(COMPAT_43) || defined(COMPAT_FREEBSD)
100 { ttyopen, ttylclose, ttread, ttwrite, nullioctl,
101 ttyinput, ttstart, ttymodem }, /* 2- old NTTYDISC */
102 #else
103 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
104 ttyerrinput, ttyerrstart, nullmodem }, /* 2- defunct */
105 #endif
106
107 #if NTB > 0
108 { tbopen, tbclose, tbread, ttyerrio, tbtioctl,
109 tbinput, ttstart, nullmodem }, /* 3- TABLDISC */
110 #else
111 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
112 ttyerrinput, ttyerrstart, nullmodem },
113 #endif
114
115 #if NSL > 0
116 { slopen, slclose, ttyerrio, ttyerrio, sltioctl,
117 slinput, slstart, nullmodem }, /* 4- SLIPDISC */
118 #else
119 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
120 ttyerrinput, ttyerrstart, nullmodem },
121 #endif
122
123 #if NPPP > 0
124 { pppopen, pppclose, pppread, pppwrite, ppptioctl,
125 pppinput, pppstart, ttymodem }, /* 5- PPPDISC */
126 #else
127 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
128 ttyerrinput, ttyerrstart, nullmodem },
129 #endif
130 };
131
132 int nlinesw = sizeof (linesw) / sizeof (linesw[0]);
133
134 /*
135 * Do nothing specific version of line
136 * discipline specific ioctl command.
137 */
138 /*ARGSUSED*/
139 int
140 nullioctl(tp, cmd, data, flags, p)
141 struct tty *tp;
142 u_long cmd;
143 char *data;
144 int flags;
145 struct proc *p;
146 {
147
148 #ifdef lint
149 tp = tp; data = data; flags = flags; p = p;
150 #endif
151 return (-1);
152 }
153