summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/cx/if_cx.c24
-rw-r--r--sys/dev/cy/cy.c16
-rw-r--r--sys/dev/digi/digi.c20
-rw-r--r--sys/dev/rc/rc.c25
-rw-r--r--sys/dev/rp/rp.c25
-rw-r--r--sys/dev/si/si.c28
-rw-r--r--sys/dev/sio/sio.c28
-rw-r--r--sys/dev/sx/sx.c30
-rw-r--r--sys/dev/usb/ucom.c27
-rw-r--r--sys/kern/tty.c18
-rw-r--r--sys/pc98/cbus/sio.c28
-rw-r--r--sys/pc98/pc98/sio.c28
-rw-r--r--sys/sys/tty.h1
13 files changed, 66 insertions, 232 deletions
diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c
index 386d418..040d0c5 100644
--- a/sys/dev/cx/if_cx.c
+++ b/sys/dev/cx/if_cx.c
@@ -237,7 +237,9 @@ static void cx_error (cx_chan_t *c, int data);
static void cx_modem (cx_chan_t *c);
static void cx_up (drv_t *d);
static void cx_start (drv_t *d);
-static void disc_optim(struct tty *tp, struct termios *t);
+#if __FreeBSD_version < 502113
+static void ttyldoptim(struct tty *tp);
+#endif
#if __FreeBSD_version < 500000
static swihand_t cx_softintr;
#else
@@ -1660,7 +1662,7 @@ again:
}
error = ttyld_open (&d->tty, dev);
- disc_optim (&d->tty, &d->tty.t_termios);
+ ttyldoptim (&d->tty);
spl0 ();
if (error) {
failed: if (! (d->tty.t_state & TS_ISOPEN)) {
@@ -1701,7 +1703,7 @@ static int cx_close (dev_t dev, int flag, int mode, struct thread *td)
}
s = splhigh ();
ttyld_close(&d->tty, flag);
- disc_optim (&d->tty, &d->tty.t_termios);
+ ttyldoptim (&d->tty);
/* Disable receiver.
* Transmitter continues sending the queued data. */
@@ -2129,7 +2131,7 @@ static int cx_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
if (c->mode == M_ASYNC) {
#if __FreeBSD_version >= 502113
error = ttyioctl (dev, cmd, data, flag, td);
- disc_optim (&d->tty, &d->tty.t_termios);
+ ttyldoptim (&d->tty);
if (error != ENOTTY) {
if (error)
CX_DEBUG2 (d, ("ttioctl: 0x%lx, error %d\n", cmd, error));
@@ -2141,14 +2143,14 @@ static int cx_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct threa
#else
error = (*linesw[d->tty.t_line].l_ioctl) (&d->tty, cmd, data, flag, p);
#endif
- disc_optim (&d->tty, &d->tty.t_termios);
+ ttyldoptim (&d->tty);
if (error != ENOIOCTL) {
if (error)
CX_DEBUG2 (d, ("l_ioctl: 0x%lx, error %d\n", cmd, error));
return error;
}
error = ttioctl (&d->tty, cmd, data, flag);
- disc_optim (&d->tty, &d->tty.t_termios);
+ ttyldoptim (&d->tty);
if (error != ENOIOCTL) {
if (error)
CX_DEBUG2 (d, ("ttioctl: 0x%lx, error %d\n", cmd, error));
@@ -2256,16 +2258,20 @@ static void cx_dtrwakeup (void *arg)
}
+#if __FreeBSD_version < 502113
static void
-disc_optim(tp, t)
+ttyldoptim(tp)
struct tty *tp;
- struct termios *t;
{
+ struct termios *t;
+
+ t = &tp->t_termios;
if (CONDITION(t,tp))
tp->t_state |= TS_CAN_BYPASS_L_RINT;
else
tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
}
+#endif
#if __FreeBSD_version >= 500000
void cx_softintr (void *unused)
@@ -2452,7 +2458,7 @@ static int cx_param (struct tty *tp, struct termios *t)
if (! d->chan->dtr)
cx_set_dtr (d->chan, 1);
- disc_optim (&d->tty, &d->tty.t_termios);
+ ttyldoptim (&d->tty);
cx_set_async_param (d->chan, t->c_ospeed, bits, parity, (t->c_cflag & CSTOPB),
!(t->c_cflag & PARENB), (t->c_cflag & CRTSCTS),
(t->c_iflag & IXON), (t->c_iflag & IXANY),
diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c
index 58abf6a..9dc95b3 100644
--- a/sys/dev/cy/cy.c
+++ b/sys/dev/cy/cy.c
@@ -2585,21 +2585,7 @@ disc_optim(tp, t, com)
u_char opt;
#endif
- /*
- * XXX can skip a lot more cases if Smarts. Maybe
- * (IGNCR | ISTRIP | IXON) in c_iflag. But perhaps we
- * shouldn't skip if (TS_CNTTB | TS_LNCH) is set in t_state.
- */
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON))
- && (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
- && (!(t->c_iflag & PARMRK)
- || (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK))
- && !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN))
- && linesw[tp->t_line].l_rint == ttyinput)
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- else
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
- com->hotchar = linesw[tp->t_line].l_hotchar;
+ com->hotchar = ttyldoptim(tp);
#ifndef SOFT_HOTCHAR
opt = com->cor[2] & ~CD1400_COR3_SCD34;
if (com->hotchar != 0) {
diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c
index d13e50f..e99e737 100644
--- a/sys/dev/digi/digi.c
+++ b/sys/dev/digi/digi.c
@@ -693,20 +693,6 @@ digimctl(struct digi_p *port, int bits, int how)
return (0);
}
-static void
-digi_disc_optim(struct tty *tp, struct termios *t, struct digi_p *port)
-{
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP)) &&
- (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK)) &&
- (!(t->c_iflag & PARMRK) ||
- (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK)) &&
- !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN)) &&
- linesw[tp->t_line].l_rint == ttyinput)
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- else
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
-}
-
static int
digiopen(dev_t dev, int flag, int mode, struct thread *td)
{
@@ -853,7 +839,7 @@ open_top:
DLOG(DIGIDB_OPEN, (sc->dev, "port %d: l_open error = %d\n",
pnum, error));
- digi_disc_optim(tp, &tp->t_termios, port);
+ ttyldoptim(tp);
if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK)
port->active_out = TRUE;
@@ -901,7 +887,7 @@ digiclose(dev_t dev, int flag, int mode, struct thread *td)
s = spltty();
ttyld_close(tp, flag);
- digi_disc_optim(tp, &tp->t_termios, port);
+ ttyldoptim(tp);
digihardclose(port);
ttyclose(tp);
if (--sc->opencnt == 0)
@@ -1278,7 +1264,7 @@ digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
error = ttyioctl(dev, cmd, data, flag, td);
if (error == 0 && cmd == TIOCGETA)
((struct termios *)data)->c_iflag |= port->c_iflag;
- digi_disc_optim(tp, &tp->t_termios, port);
+ ttyldoptim(tp);
if (error >= 0 && error != ENOTTY)
return (error);
s = spltty();
diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c
index 13d00ff..1135faf 100644
--- a/sys/dev/rc/rc.c
+++ b/sys/dev/rc/rc.c
@@ -140,7 +140,6 @@ static void rc_reinit(struct rc_softc *);
static void printrcflags();
#endif
static void rc_dtrwakeup(void *);
-static void disc_optim(struct tty *tp, struct termios *t, struct rc_chans *);
static void rc_wait0(struct rc_softc *sc, int chan, int line);
static d_open_t rcopen;
@@ -932,7 +931,7 @@ again:
goto again;
}
error = ttyld_open(tp, dev);
- disc_optim(tp, &tp->t_termios, rc);
+ rc->rc_hotchar = ttyldoptim(tp);
if ((tp->t_state & TS_ISOPEN) && CALLOUT(dev))
rc->rc_flags |= RC_ACTOUT;
out:
@@ -961,7 +960,7 @@ rcclose(dev_t dev, int flag, int mode, d_thread_t *td)
#endif
s = spltty();
ttyld_close(tp, flag);
- disc_optim(tp, &tp->t_termios, rc);
+ rc->rc_hotchar = ttyldoptim(tp);
rc_hardclose(rc);
ttyclose(tp);
splx(s);
@@ -1151,7 +1150,7 @@ rc_param(struct tty *tp, struct termios *ts)
CCRCMD(sc, rc->rc_chan, CCR_CORCHG1 | CCR_CORCHG2 | CCR_CORCHG3);
- disc_optim(tp, ts, rc);
+ rc->rc_hotchar = ttyldoptim(tp);
/* modem ctl */
val = cflag & CLOCAL ? 0 : MCOR1_CDzd;
@@ -1208,7 +1207,7 @@ rcioctl(dev_t dev, u_long cmd, caddr_t data, int flag, d_thread_t *td)
rc = DEV_TO_RC(dev);
tp = &rc->rc_tp;
error = ttyioctl(dev, cmd, data, flag, td);
- disc_optim(tp, &tp->t_termios, rc);
+ rc->rc_hotchar = ttyldoptim(tp);
if (error != ENOTTY)
return (error);
s = spltty();
@@ -1544,22 +1543,6 @@ rc_discard_output(struct rc_chans *rc)
}
static void
-disc_optim(struct tty *tp, struct termios *t, struct rc_chans *rc)
-{
-
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON))
- && (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
- && (!(t->c_iflag & PARMRK)
- || (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK))
- && !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN))
- && linesw[tp->t_line].l_rint == ttyinput)
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- else
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
- rc->rc_hotchar = linesw[tp->t_line].l_hotchar;
-}
-
-static void
rc_wait0(struct rc_softc *sc, int chan, int line)
{
int rcnt;
diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c
index f99f403..d77c9a1 100644
--- a/sys/dev/rp/rp.c
+++ b/sys/dev/rp/rp.c
@@ -616,7 +616,6 @@ static int rpparam(struct tty *, struct termios *);
static void rpstart(struct tty *);
static void rpstop(struct tty *, int);
static void rphardclose (struct rp_port *);
-static void rp_disc_optim (struct tty *tp, struct termios *t);
static void rp_do_receive(struct rp_port *rp, struct tty *tp,
CHANNEL_t *cp, unsigned int ChanStatus)
@@ -1089,7 +1088,7 @@ open_top:
}
error = ttyld_open(tp, dev);
- rp_disc_optim(tp, &tp->t_termios);
+ ttyldoptim(tp);
if(tp->t_state & TS_ISOPEN && IS_CALLOUT(dev))
rp->active_out = TRUE;
@@ -1131,7 +1130,7 @@ rpclose(dev, flag, mode, td)
oldspl = spltty();
ttyld_close(tp, flag);
- rp_disc_optim(tp, &tp->t_termios);
+ ttyldoptim(tp);
rphardclose(rp);
tp->t_state &= ~TS_BUSY;
@@ -1321,7 +1320,7 @@ rpioctl(dev, cmd, data, flag, td)
t = &tp->t_termios;
error = ttyioctl(dev, cmd, data, flag, td);
- rp_disc_optim(tp, &tp->t_termios);
+ ttyldoptim(tp);
if(error != ENOTTY)
return(error);
oldspl = spltty();
@@ -1543,7 +1542,7 @@ rpparam(tp, t)
} else {
sDisRTSFlowCtl(cp);
}
- rp_disc_optim(tp, t);
+ ttyldoptim(tp);
if((cflag & CLOCAL) || (sGetChanStatusLo(cp) & CD_ACT)) {
tp->t_state |= TS_CARR_ON;
@@ -1563,22 +1562,6 @@ rpparam(tp, t)
}
static void
-rp_disc_optim(tp, t)
-struct tty *tp;
-struct termios *t;
-{
- if(!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON))
- &&(!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
- &&(!(t->c_iflag & PARMRK)
- ||(t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK))
- && !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN))
- && linesw[tp->t_line].l_rint == ttyinput)
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- else
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
-}
-
-static void
rpstart(tp)
struct tty *tp;
{
diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c
index 4411d21..e79c1ca 100644
--- a/sys/dev/si/si.c
+++ b/sys/dev/si/si.c
@@ -99,7 +99,6 @@ static int si_Sioctl(dev_t, u_long, caddr_t, int, struct thread *);
static void si_start(struct tty *);
static void si_stop(struct tty *, int);
static timeout_t si_lstart;
-static void si_disc_optim(struct tty *tp, struct termios *t,struct si_port *pp);
static void sihardclose(struct si_port *pp);
static void sidtrwakeup(void *chan);
@@ -741,7 +740,7 @@ open_top:
}
error = ttyld_open(tp, dev);
- si_disc_optim(tp, &tp->t_termios, pp);
+ pp->sp_hotchar = ttyldoptim(tp);
if (tp->t_state & TS_ISOPEN && IS_CALLOUT(mynor))
pp->sp_active_out = TRUE;
@@ -1017,7 +1016,7 @@ siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
}
error = ttyioctl(dev, cmd, data, flag, td);
- si_disc_optim(tp, &tp->t_termios, pp);
+ pp->sp_hotchar = ttyldoptim(tp);
if (error != ENOTTY)
goto out;
@@ -2075,29 +2074,6 @@ si_command(struct si_port *pp, int cmd, int waitflag)
splx(oldspl);
}
-static void
-si_disc_optim(struct tty *tp, struct termios *t, struct si_port *pp)
-{
- /*
- * XXX can skip a lot more cases if Smarts. Maybe
- * (IGNCR | ISTRIP | IXON) in c_iflag. But perhaps we
- * shouldn't skip if (TS_CNTTB | TS_LNCH) is set in t_state.
- */
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON)) &&
- (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK)) &&
- (!(t->c_iflag & PARMRK) ||
- (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK)) &&
- !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN)) &&
- linesw[tp->t_line].l_rint == ttyinput)
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- else
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
- pp->sp_hotchar = linesw[tp->t_line].l_hotchar;
- DPRINT((pp, DBG_OPTIM, "bypass: %s, hotchar: %x\n",
- (tp->t_state & TS_CAN_BYPASS_L_RINT) ? "on" : "off",
- pp->sp_hotchar));
-}
-
#ifdef SI_DEBUG
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index f384e31..a63625f 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -300,8 +300,6 @@ static int siosetwater(struct com_s *com, speed_t speed);
static void comstart(struct tty *tp);
static void comstop(struct tty *tp, int rw);
static timeout_t comwakeup;
-static void disc_optim(struct tty *tp, struct termios *t,
- struct com_s *com);
char sio_driver_name[] = "sio";
static struct mtx sio_lock;
@@ -1352,7 +1350,7 @@ open_top:
goto open_top;
}
error = ttyld_open(tp, dev);
- disc_optim(tp, &tp->t_termios, com);
+ com->hotchar = ttyldoptim(tp);
if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK)
com->active_out = TRUE;
siosettimeout();
@@ -1384,7 +1382,7 @@ sioclose(dev, flag, mode, td)
tp = com->tp;
s = spltty();
ttyld_close(tp, flag);
- disc_optim(tp, &tp->t_termios, com);
+ com->hotchar = ttyldoptim(tp);
comhardclose(com);
ttyclose(tp);
siosettimeout();
@@ -2049,7 +2047,7 @@ sioioctl(dev, cmd, data, flag, td)
dt->c_ospeed = tp->t_ospeed;
}
error = ttyioctl(dev, cmd, data, flag, td);
- disc_optim(tp, &tp->t_termios, com);
+ com->hotchar = ttyldoptim(tp);
if (error != ENOTTY)
return (error);
s = spltty();
@@ -2333,7 +2331,7 @@ comparam(tp, t)
sio_setreg(com, com_cfcr, com->cfcr_image = cfcr);
/* XXX shouldn't call functions while intrs are disabled. */
- disc_optim(tp, t, com);
+ com->hotchar = ttyldoptim(tp);
mtx_unlock_spin(&sio_lock);
splx(s);
@@ -2695,24 +2693,6 @@ comwakeup(chan)
}
}
-static void
-disc_optim(tp, t, com)
- struct tty *tp;
- struct termios *t;
- struct com_s *com;
-{
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON))
- && (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
- && (!(t->c_iflag & PARMRK)
- || (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK))
- && !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN))
- && linesw[tp->t_line].l_rint == ttyinput)
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- else
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
- com->hotchar = linesw[tp->t_line].l_hotchar;
-}
-
/*
* Following are all routines needed for SIO to act as console
*/
diff --git a/sys/dev/sx/sx.c b/sys/dev/sx/sx.c
index 68266bd..ae50e32 100644
--- a/sys/dev/sx/sx.c
+++ b/sys/dev/sx/sx.c
@@ -71,7 +71,6 @@ static int sx_modem(struct sx_softc *, struct sx_port *, enum sx_mctl, int);
static void sx_write_enable(struct sx_port *, int);
static void sx_start(struct tty *);
static void sx_stop(struct tty *, int);
-static void sx_disc_optim(struct tty *tp, struct termios *t,struct sx_port *pp);
static void sxhardclose(struct sx_port *pp);
static void sxdtrwakeup(void *chan);
static void sx_shutdown_chan(struct sx_port *);
@@ -476,7 +475,7 @@ open_top:
}
error = ttyld_open(tp, dev);
- sx_disc_optim(tp, &tp->t_termios, pp);
+ pp->sp_hotchar = ttyldoptim(tp);
if (tp->t_state & TS_ISOPEN && DEV_IS_CALLOUT(mynor))
pp->sp_active_out = TRUE;
@@ -805,7 +804,7 @@ sxioctl(
}
error = ttyioctl(dev, cmd, data, flag, p);
- sx_disc_optim(tp, &tp->t_termios, pp);
+ pp->sp_hotchar = ttyldoptim(tp);
if (error != ENOTTY)
goto out;
@@ -1921,31 +1920,6 @@ sx_stop(
splx(s);
}
-static void
-sx_disc_optim(
- struct tty *tp,
- struct termios *t,
- struct sx_port *pp)
-{
- /*
- * If we're in "raw" mode, we can bypass ttyinput().
- */
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON)) &&
- (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK)) &&
- (!(t->c_iflag & PARMRK) ||
- (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK)) &&
- !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN)) &&
- linesw[tp->t_line].l_rint == ttyinput)
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- else
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
- pp->sp_hotchar = linesw[tp->t_line].l_hotchar;
- DPRINT((pp, DBG_OPTIM, "sx_disc_optim: bypass %s, hotchar %x\n",
- (tp->t_state & TS_CAN_BYPASS_L_RINT) ? "yes" : "no",
- pp->sp_hotchar));
-}
-
-
#ifdef SX_DEBUG
void
diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c
index 95ac0ab..b28a0f0 100644
--- a/sys/dev/usb/ucom.c
+++ b/sys/dev/usb/ucom.c
@@ -155,7 +155,6 @@ Static usbd_status ucomstartread(struct ucom_softc *);
Static void ucomreadcb(usbd_xfer_handle, usbd_private_handle, usbd_status);
Static void ucomwritecb(usbd_xfer_handle, usbd_private_handle, usbd_status);
Static void ucomstopread(struct ucom_softc *);
-static void disc_optim(struct tty *, struct termios *, struct ucom_softc *);
devclass_t ucom_devclass;
@@ -402,7 +401,7 @@ ucomopen(dev_t dev, int flag, int mode, usb_proc_ptr p)
if (error)
goto bad;
- disc_optim(tp, &tp->t_termios, sc);
+ sc->hotchar = ttyldoptim(tp);
DPRINTF(("%s: ucomopen: success\n", USBDEVNAME(sc->sc_dev)));
@@ -462,7 +461,7 @@ ucomclose(dev_t dev, int flag, int mode, usb_proc_ptr p)
s = spltty();
ttyld_close(tp, flag);
- disc_optim(tp, &tp->t_termios, sc);
+ sc->hotchar = ttyldoptim(tp);
ttyclose(tp);
splx(s);
@@ -564,7 +563,7 @@ ucomioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
#endif
error = ttyioctl(dev, cmd, data, flag, p);
- disc_optim(tp, &tp->t_termios, sc);
+ sc->hotchar = ttyldoptim(tp);
if (error != ENOTTY) {
DPRINTF(("ucomioctl: l_ioctl: error = %d\n", error));
return (error);
@@ -824,7 +823,7 @@ ucomparam(struct tty *tp, struct termios *t)
(void)ucomctl(sc, UMCR_RTS, DMBIS);
}
- disc_optim(tp, t, sc);
+ sc->hotchar = ttyldoptim(tp);
uerr = ucomstartread(sc);
if (uerr != USBD_NORMAL_COMPLETION)
@@ -1168,21 +1167,3 @@ ucomstopread(struct ucom_softc *sc)
DPRINTF(("ucomstopread: leave\n"));
}
-
-static void
-disc_optim(struct tty *tp, struct termios *t, struct ucom_softc *sc)
-{
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON))
- && (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
- && (!(t->c_iflag & PARMRK)
- || (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK))
- && !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN))
- && linesw[tp->t_line].l_rint == ttyinput) {
- DPRINTF(("disc_optim: bypass l_rint\n"));
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- } else {
- DPRINTF(("disc_optim: can't bypass l_rint\n"));
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
- }
- sc->hotchar = linesw[tp->t_line].l_hotchar;
-}
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index d72aec1..da7b696 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -2760,3 +2760,21 @@ ttyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
return (error);
return (ENOTTY);
}
+
+int
+ttyldoptim(struct tty *tp)
+{
+ struct termios *t;
+
+ t = &tp->t_termios;
+ if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON))
+ && (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
+ && (!(t->c_iflag & PARMRK)
+ || (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK))
+ && !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN))
+ && linesw[tp->t_line].l_rint == ttyinput)
+ tp->t_state |= TS_CAN_BYPASS_L_RINT;
+ else
+ tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
+ return (linesw[tp->t_line].l_hotchar);
+}
diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c
index e2c652f..12c8243 100644
--- a/sys/pc98/cbus/sio.c
+++ b/sys/pc98/cbus/sio.c
@@ -386,8 +386,6 @@ static int siosetwater(struct com_s *com, speed_t speed);
static void comstart(struct tty *tp);
static void comstop(struct tty *tp, int rw);
static timeout_t comwakeup;
-static void disc_optim(struct tty *tp, struct termios *t,
- struct com_s *com);
char sio_driver_name[] = "sio";
static struct mtx sio_lock;
@@ -2069,7 +2067,7 @@ open_top:
goto open_top;
}
error = ttyld_open(tp, dev);
- disc_optim(tp, &tp->t_termios, com);
+ com->hotchar = ttyldoptim(tp);
if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK)
com->active_out = TRUE;
siosettimeout();
@@ -2104,7 +2102,7 @@ sioclose(dev, flag, mode, td)
#ifdef PC98
com->modem_checking = 0;
#endif
- disc_optim(tp, &tp->t_termios, com);
+ com->hotchar = ttyldoptim(tp);
comhardclose(com);
ttyclose(tp);
siosettimeout();
@@ -3022,7 +3020,7 @@ sioioctl(dev, cmd, data, flag, td)
dt->c_ospeed = tp->t_ospeed;
}
error = ttyioctl(dev, cmd, data, flag, td);
- disc_optim(tp, &tp->t_termios, com);
+ com->hotchar = ttyldoptim(tp);
if (error != ENOTTY)
return (error);
s = spltty();
@@ -3438,7 +3436,7 @@ comparam(tp, t)
#endif
/* XXX shouldn't call functions while intrs are disabled. */
- disc_optim(tp, t, com);
+ com->hotchar = ttyldoptim(tp);
mtx_unlock_spin(&sio_lock);
splx(s);
@@ -3898,24 +3896,6 @@ commint(dev_t dev)
}
#endif
-static void
-disc_optim(tp, t, com)
- struct tty *tp;
- struct termios *t;
- struct com_s *com;
-{
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON))
- && (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
- && (!(t->c_iflag & PARMRK)
- || (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK))
- && !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN))
- && linesw[tp->t_line].l_rint == ttyinput)
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- else
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
- com->hotchar = linesw[tp->t_line].l_hotchar;
-}
-
/*
* Following are all routines needed for SIO to act as console
*/
diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c
index e2c652f..12c8243 100644
--- a/sys/pc98/pc98/sio.c
+++ b/sys/pc98/pc98/sio.c
@@ -386,8 +386,6 @@ static int siosetwater(struct com_s *com, speed_t speed);
static void comstart(struct tty *tp);
static void comstop(struct tty *tp, int rw);
static timeout_t comwakeup;
-static void disc_optim(struct tty *tp, struct termios *t,
- struct com_s *com);
char sio_driver_name[] = "sio";
static struct mtx sio_lock;
@@ -2069,7 +2067,7 @@ open_top:
goto open_top;
}
error = ttyld_open(tp, dev);
- disc_optim(tp, &tp->t_termios, com);
+ com->hotchar = ttyldoptim(tp);
if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK)
com->active_out = TRUE;
siosettimeout();
@@ -2104,7 +2102,7 @@ sioclose(dev, flag, mode, td)
#ifdef PC98
com->modem_checking = 0;
#endif
- disc_optim(tp, &tp->t_termios, com);
+ com->hotchar = ttyldoptim(tp);
comhardclose(com);
ttyclose(tp);
siosettimeout();
@@ -3022,7 +3020,7 @@ sioioctl(dev, cmd, data, flag, td)
dt->c_ospeed = tp->t_ospeed;
}
error = ttyioctl(dev, cmd, data, flag, td);
- disc_optim(tp, &tp->t_termios, com);
+ com->hotchar = ttyldoptim(tp);
if (error != ENOTTY)
return (error);
s = spltty();
@@ -3438,7 +3436,7 @@ comparam(tp, t)
#endif
/* XXX shouldn't call functions while intrs are disabled. */
- disc_optim(tp, t, com);
+ com->hotchar = ttyldoptim(tp);
mtx_unlock_spin(&sio_lock);
splx(s);
@@ -3898,24 +3896,6 @@ commint(dev_t dev)
}
#endif
-static void
-disc_optim(tp, t, com)
- struct tty *tp;
- struct termios *t;
- struct com_s *com;
-{
- if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP | IXON))
- && (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
- && (!(t->c_iflag & PARMRK)
- || (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK))
- && !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN))
- && linesw[tp->t_line].l_rint == ttyinput)
- tp->t_state |= TS_CAN_BYPASS_L_RINT;
- else
- tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
- com->hotchar = linesw[tp->t_line].l_hotchar;
-}
-
/*
* Following are all routines needed for SIO to act as console
*/
diff --git a/sys/sys/tty.h b/sys/sys/tty.h
index 0d16b6a..a9500cb 100644
--- a/sys/sys/tty.h
+++ b/sys/sys/tty.h
@@ -303,6 +303,7 @@ void ttyfree(struct tty *tp);
void ttyinfo(struct tty *tp);
int ttyinput(int c, struct tty *tp);
int ttylclose(struct tty *tp, int flag);
+int ttyldoptim(struct tty *tp);
struct tty *ttymalloc(struct tty *tp);
int ttymodem(struct tty *tp, int flag);
int ttyopen(dev_t device, struct tty *tp);
OpenPOWER on IntegriCloud