From 1dcb420b646ff6fd0ab578e340fd7f26b32ed79d Mon Sep 17 00:00:00 2001 From: pst Date: Sat, 25 Feb 1995 20:09:44 +0000 Subject: (a) remove the pointer to each driver's tty structure array from cdevsw (b) add a function callback vector to tty drivers that will return a pointer to a valid tty structure based upon a dev_t (c) make syscons structures the same size whether or not APM is enabled so utilities don't crash if NAPM changes (and make the damn kernel compile!) (d) rewrite /dev/snp ioctl interface so that it is device driver and i386 independant --- sys/isa/sio.c | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'sys/isa/sio.c') diff --git a/sys/isa/sio.c b/sys/isa/sio.c index c284150..39bec6d 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.65 1995/01/20 07:34:15 wpaul Exp $ + * $Id: sio.c,v 1.66 1995/02/24 00:11:01 ache Exp $ */ #include "sio.h" @@ -1819,15 +1819,50 @@ siostop(tp, rw) enable_intr(); } +struct tty * +siodevtotty(dev) + dev_t dev; +{ + register int mynor, unit; + struct com_s *com; + + mynor = minor(dev); + if (mynor & CONTROL_MASK) + return NULL; + + unit = MINOR_TO_UNIT(mynor); + if (unit >= NSIO) + return NULL; + + com = com_addr(unit); + if (com == NULL) + return NULL; + + return com->tp; +} + int sioselect(dev, rw, p) dev_t dev; int rw; struct proc *p; { - if (minor(dev) & CONTROL_MASK) + register int mynor, unit; + struct com_s *com; + + mynor = minor(dev); + if (mynor & CONTROL_MASK) return (ENODEV); - return (ttselect(dev & ~MINOR_MAGIC_MASK, rw, p)); + + unit = MINOR_TO_UNIT(mynor); + if (unit >= NSIO) + return (ENXIO); + + com = com_addr(unit); + if (com == NULL) + return (ENXIO); + + return (ttyselect(com->tp, rw, p)); } static void -- cgit v1.1