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