1 /* $NetBSD: tty_conf.c,v 1.15 1994/10/30 21:48:00 cgd 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 *tp, u_long cmd, caddr_t data, 58 int flag, struct proc *p)); 59 60 #include "tb.h" 61 #if NTB > 0 62 int tbopen __P((dev_t dev, struct tty *tp)); 63 int tbclose __P((struct tty *tp, int flags)); 64 int tbread __P((struct tty *tp, struct uio *uio, int flags)); 65 int tbtioctl __P((struct tty *tp, u_long cmd, caddr_t data, 66 int flag, struct proc *p)); 67 int tbinput __P((int c, struct tty *tp)); 68 #endif 69 70 #include "sl.h" 71 #if NSL > 0 72 int slopen __P((dev_t dev, struct tty *tp)); 73 int slclose __P((struct tty *tp, int flags)); 74 int sltioctl __P((struct tty *tp, u_long cmd, caddr_t data, 75 int flag, struct proc *p)); 76 int slinput __P((int c, struct tty *tp)); 77 int slstart __P((struct tty *tp)); 78 #endif 79 80 #include "ppp.h" 81 #if NPPP > 0 82 int pppopen __P((dev_t dev, struct tty *tp)); 83 int pppclose __P((struct tty *tp, int flags)); 84 int ppptioctl __P((struct tty *tp, u_long cmd, caddr_t data, 85 int flag, struct proc *p)); 86 int pppinput __P((int c, struct tty *tp)); 87 int pppstart __P((struct tty *tp)); 88 int pppread __P((struct tty *tp, struct uio *uio, int flag)); 89 int pppwrite __P((struct tty *tp, struct uio *uio, int flag)); 90 #endif 91 92 struct linesw linesw[] = 93 { 94 { ttyopen, ttylclose, ttread, ttwrite, nullioctl, 95 ttyinput, ttstart, ttymodem }, /* 0- termios */ 96 97 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, 98 ttyerrinput, ttyerrstart, nullmodem }, /* 1- defunct */ 99 100 #ifdef COMPAT_43 101 { ttyopen, ttylclose, ttread, ttwrite, nullioctl, 102 ttyinput, ttstart, ttymodem }, /* 2- old NTTYDISC */ 103 #else 104 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, 105 ttyerrinput, ttyerrstart, nullmodem }, /* 2- defunct */ 106 #endif 107 108 #if NTB > 0 109 { tbopen, tbclose, tbread, ttyerrio, tbtioctl, 110 tbinput, ttstart, nullmodem }, /* 3- TABLDISC */ 111 #else 112 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, 113 ttyerrinput, ttyerrstart, nullmodem }, 114 #endif 115 116 #if NSL > 0 117 { slopen, slclose, ttyerrio, ttyerrio, sltioctl, 118 slinput, slstart, nullmodem }, /* 4- SLIPDISC */ 119 #else 120 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, 121 ttyerrinput, ttyerrstart, nullmodem }, 122 #endif 123 124 #if NPPP > 0 125 { pppopen, pppclose, pppread, pppwrite, ppptioctl, 126 pppinput, pppstart, ttymodem }, /* 5- PPPDISC */ 127 #else 128 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, 129 ttyerrinput, ttyerrstart, nullmodem }, 130 #endif 131 }; 132 133 int nlinesw = sizeof (linesw) / sizeof (linesw[0]); 134 135 /* 136 * Do nothing specific version of line 137 * discipline specific ioctl command. 138 */ 139 /*ARGSUSED*/ 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