xref: /original-bsd/sys/kern/tty_conf.c (revision 333da485)
1 /*-
2  * Copyright (c) 1982, 1986, 1991, 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  * %sccs.include.redist.c%
11  *
12  *	@(#)tty_conf.c	8.4 (Berkeley) 01/21/94
13  */
14 
15 #include <sys/param.h>
16 #include <sys/systm.h>
17 #include <sys/buf.h>
18 #include <sys/ioctl.h>
19 #include <sys/proc.h>
20 #include <sys/tty.h>
21 #include <sys/conf.h>
22 
23 #define	ttynodisc ((int (*) __P((dev_t, struct tty *)))enodev)
24 #define	ttyerrclose ((int (*) __P((struct tty *, int flags)))enodev)
25 #define	ttyerrio ((int (*) __P((struct tty *, struct uio *, int)))enodev)
26 #define	ttyerrinput ((int (*) __P((int c, struct tty *)))enodev)
27 #define	ttyerrstart ((int (*) __P((struct tty *)))enodev)
28 
29 int	nullioctl __P((struct tty *tp, int cmd, caddr_t data,
30 			int flag, struct proc *p));
31 
32 #include "tb.h"
33 #if NTB > 0
34 int	tbopen __P((dev_t dev, struct tty *tp));
35 int	tbclose __P((struct tty *tp, int flags));
36 int	tbread __P((struct tty *, struct uio *, int flags));
37 int	tbioctl __P((struct tty *tp, int cmd, caddr_t data,
38 			int flag, struct proc *p));
39 int	tbinput __P((int c, struct tty *tp));
40 #endif
41 
42 #include "sl.h"
43 #if NSL > 0
44 int	slopen __P((dev_t dev, struct tty *tp));
45 int	slclose __P((struct tty *tp, int flags));
46 int	sltioctl __P((struct tty *tp, int cmd, caddr_t data,
47 			int flag, struct proc *p));
48 int	slinput __P((int c, struct tty *tp));
49 int	slstart __P((struct tty *tp));
50 #endif
51 
52 
53 struct	linesw linesw[] =
54 {
55 	{ ttyopen, ttylclose, ttread, ttwrite, nullioctl,
56 	  ttyinput, ttstart, ttymodem },		/* 0- termios */
57 
58 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
59 	  ttyerrinput, ttyerrstart, nullmodem },	/* 1- defunct */
60 
61 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
62 	  ttyerrinput, ttyerrstart, nullmodem },	/* 2- defunct */
63 
64 #if NTB > 0
65 	{ tbopen, tbclose, tbread, enodev, tbioctl,
66 	  tbinput, ttstart, nullmodem },		/* 3- TABLDISC */
67 #else
68 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
69 	  ttyerrinput, ttyerrstart, nullmodem },
70 #endif
71 
72 #if NSL > 0
73 	{ slopen, slclose, ttyerrio, ttyerrio, sltioctl,
74 	  slinput, slstart, nullmodem },		/* 4- SLIPDISC */
75 #else
76 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
77 	  ttyerrinput, ttyerrstart, nullmodem },
78 #endif
79 };
80 
81 int	nlinesw = sizeof (linesw) / sizeof (linesw[0]);
82 
83 /*
84  * Do nothing specific version of line
85  * discipline specific ioctl command.
86  */
87 /*ARGSUSED*/
88 nullioctl(tp, cmd, data, flags, p)
89 	struct tty *tp;
90 	int cmd;
91 	char *data;
92 	int flags;
93 	struct proc *p;
94 {
95 
96 #ifdef lint
97 	tp = tp; data = data; flags = flags; p = p;
98 #endif
99 	return (-1);
100 }
101