diff options
author | phk <phk@FreeBSD.org> | 2004-06-26 08:44:04 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-06-26 08:44:04 +0000 |
commit | 1aa6c5a754b178a4700e8508f2e7a2f5136fd9b6 (patch) | |
tree | 04c3b44b676c0a500305ae7636bab0655dde9123 /sys/netgraph | |
parent | 772718717b358bd1045f527cb6842b45a4838f18 (diff) | |
download | FreeBSD-src-1aa6c5a754b178a4700e8508f2e7a2f5136fd9b6.zip FreeBSD-src-1aa6c5a754b178a4700e8508f2e7a2f5136fd9b6.tar.gz |
Fix line discipline switching issues: If opening a new ldisc fails,
we have to revert to TTYDISC which we know will successfully open
rather than try the previous ldisc which might also fail to open.
Do not let ldisc implementations muck about with ->t_line, and remove
code which checks for reopens, it should never happen.
Move ldisc->l_hotchar to tty->t_hotchar and have ldisc implementation
initialize it in their open routines. Reset to zero when we enter
TTYDISC. ("no" should really be -1 since zero could be a valid
hotchar for certain old european mainframe protocols.)
Diffstat (limited to 'sys/netgraph')
-rw-r--r-- | sys/netgraph/bluetooth/drivers/h4/ng_h4.c | 11 | ||||
-rw-r--r-- | sys/netgraph/ng_tty.c | 11 |
2 files changed, 3 insertions, 19 deletions
diff --git a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c index 27b6641..1710a4c 100644 --- a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c +++ b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c @@ -97,8 +97,7 @@ static struct linesw ng_h4_disc = { ng_h4_ioctl, /* ioctl */ ng_h4_input, /* input */ ng_h4_start, /* start */ - ttymodem, /* modem */ - 0 /* hotchar (don't really care which one) */ + ttymodem /* modem */ }; /* Netgraph methods */ @@ -161,13 +160,6 @@ ng_h4_open(struct cdev *dev, struct tty *tp) s = splnet(); /* XXX */ spltty(); /* XXX */ - /* Already installed? */ - if (tp->t_line == H4DISC) { - sc = (ng_h4_info_p) tp->t_sc; - if (sc != NULL && sc->tp == tp) - goto out; - } - /* Initialize private struct */ MALLOC(sc, ng_h4_info_p, sizeof(*sc), M_NETGRAPH_H4, M_NOWAIT|M_ZERO); if (sc == NULL) { @@ -243,7 +235,6 @@ ng_h4_close(struct tty *tp, int flag) ttyflush(tp, FREAD | FWRITE); clist_free_cblocks(&tp->t_outq); - tp->t_line = 0; if (sc != NULL) { tp->t_sc = NULL; diff --git a/sys/netgraph/ng_tty.c b/sys/netgraph/ng_tty.c index 0ce67a5..9e4ecc3 100644 --- a/sys/netgraph/ng_tty.c +++ b/sys/netgraph/ng_tty.c @@ -148,8 +148,7 @@ static struct linesw ngt_disc = { ngt_tioctl, ngt_input, ngt_start, - ttymodem, - NG_TTY_DFL_HOTCHAR /* XXX can't change this in serial driver */ + ttymodem }; /* Netgraph node type descriptor */ @@ -193,12 +192,7 @@ ngt_open(struct cdev *dev, struct tty *tp) s = splnet(); (void) spltty(); /* XXX is this necessary? */ - /* Already installed? */ - if (tp->t_line == NETGRAPHDISC) { - sc = (sc_p) tp->t_sc; - if (sc != NULL && sc->tp == tp) - goto done; - } + tp->t_hotchar = NG_TTY_DFL_HOTCHAR; /* Initialize private struct */ MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_WAITOK | M_ZERO); @@ -265,7 +259,6 @@ ngt_close(struct tty *tp, int flag) s = spltty(); ttyflush(tp, FREAD | FWRITE); clist_free_cblocks(&tp->t_outq); - tp->t_line = 0; if (sc != NULL) { if (sc->flags & FLG_TIMEOUT) { untimeout(ngt_timeout, sc, sc->chand); |