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