xref: /csrg-svn/sys/kern/tty_conf.c (revision 63178)
149594Sbostic /*-
2*63178Sbostic  * Copyright (c) 1982, 1986, 1991, 1993
3*63178Sbostic  *	The Regents of the University of California.  All rights reserved.
423389Smckusick  *
549594Sbostic  * %sccs.include.redist.c%
649594Sbostic  *
7*63178Sbostic  *	@(#)tty_conf.c	8.1 (Berkeley) 06/10/93
823389Smckusick  */
98553Sroot 
1056517Sbostic #include <sys/param.h>
1156517Sbostic #include <sys/systm.h>
1256517Sbostic #include <sys/buf.h>
1356517Sbostic #include <sys/ioctl.h>
1456517Sbostic #include <sys/proc.h>
1556517Sbostic #include <sys/tty.h>
1656517Sbostic #include <sys/conf.h>
178553Sroot 
1852404Storek #define	ttynodisc ((int (*) __P((dev_t, struct tty *)))enodev)
1952404Storek #define	ttyerrclose ((int (*) __P((struct tty *, int flags)))enodev)
2052404Storek #define	ttyerrio ((int (*) __P((struct tty *, struct uio *, int)))enodev)
2152404Storek #define	ttyerrinput ((int (*) __P((int c, struct tty *)))enodev)
2252404Storek #define	ttyerrstart ((int (*) __P((struct tty *)))enodev)
238553Sroot 
2452404Storek int	ttyopen __P((dev_t dev, struct tty *tp));
2552404Storek int	ttylclose __P((struct tty *tp, int flags));
2652404Storek int	ttread __P((struct tty *, struct uio *, int flags));
2752404Storek int	ttwrite __P((struct tty *, struct uio *, int flags));
2852404Storek int	nullioctl __P((struct tty *tp, int cmd, caddr_t data,
2952404Storek 			int flag, struct proc *p));
3052404Storek int	ttyinput __P((int c, struct tty *tp));
3152404Storek int	ttstart __P((struct tty *tp));
3252404Storek int	ttymodem __P((struct tty *tp, int flags));
3352404Storek int	nullmodem __P((struct tty *tp, int flags));
348553Sroot 
358553Sroot #include "tb.h"
368553Sroot #if NTB > 0
3752404Storek int	tbopen __P((dev_t dev, struct tty *tp));
3852404Storek int	tbclose __P((struct tty *tp, int flags));
3952404Storek int	tbread __P((struct tty *, struct uio *, int flags));
4052404Storek int	tbioctl __P((struct tty *tp, int cmd, caddr_t data,
4152404Storek 			int flag, struct proc *p));
4252404Storek int	tbinput __P((int c, struct tty *tp));
438553Sroot #endif
4446745Smckusick 
4526123Skarels #include "sl.h"
4626123Skarels #if NSL > 0
4752404Storek int	slopen __P((dev_t dev, struct tty *tp));
4852404Storek int	slclose __P((struct tty *tp, int flags));
4952404Storek int	sltioctl __P((struct tty *tp, int cmd, caddr_t data,
5052404Storek 			int flag, struct proc *p));
5152404Storek int	slinput __P((int c, struct tty *tp));
5252404Storek int	slstart __P((struct tty *tp));
5326123Skarels #endif
548553Sroot 
5526123Skarels 
568553Sroot struct	linesw linesw[] =
578553Sroot {
5860516Storek 	{ ttyopen, ttylclose, ttread, ttwrite, nullioctl,
5960516Storek 	  ttyinput, ttstart, ttymodem },		/* 0- termios */
6037587Smarc 
6160516Storek 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
6260516Storek 	  ttyerrinput, ttyerrstart, nullmodem },	/* 1- defunct */
6337587Smarc 
6460516Storek 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
6560516Storek 	  ttyerrinput, ttyerrstart, nullmodem },	/* 2- defunct */
6652404Storek 
678553Sroot #if NTB > 0
6860516Storek 	{ tbopen, tbclose, tbread, enodev, tbioctl,
6960516Storek 	  tbinput, ttstart, nullmodem },		/* 3- TABLDISC */
708553Sroot #else
7160516Storek 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
7260516Storek 	  ttyerrinput, ttyerrstart, nullmodem },
738553Sroot #endif
7452404Storek 
7526123Skarels #if NSL > 0
7660516Storek 	{ slopen, slclose, ttyerrio, ttyerrio, sltioctl,
7760516Storek 	  slinput, slstart, nullmodem },		/* 4- SLIPDISC */
7826123Skarels #else
7960516Storek 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
8060516Storek 	  ttyerrinput, ttyerrstart, nullmodem },
8126123Skarels #endif
828553Sroot };
838553Sroot 
848562Sroot int	nldisp = sizeof (linesw) / sizeof (linesw[0]);
8512753Ssam 
8612753Ssam /*
8712753Ssam  * Do nothing specific version of line
8812753Ssam  * discipline specific ioctl command.
8912753Ssam  */
9012753Ssam /*ARGSUSED*/
9152404Storek nullioctl(tp, cmd, data, flags, p)
9212753Ssam 	struct tty *tp;
9352404Storek 	int cmd;
9412753Ssam 	char *data;
9512753Ssam 	int flags;
9652404Storek 	struct proc *p;
9712753Ssam {
9812753Ssam 
9912753Ssam #ifdef lint
10052404Storek 	tp = tp; data = data; flags = flags; p = p;
10112753Ssam #endif
10212753Ssam 	return (-1);
10312753Ssam }
104