summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-09-17 22:26:27 +0000
committerphk <phk@FreeBSD.org>2004-09-17 22:26:27 +0000
commit2ca675d9a88fde7c309b7bdd38263acc90f3dade (patch)
treec9ba1d212146bfd7ea8c0c84066db28dc9e45b41 /sys
parentb3e38752b197d930007a2a1b66ec10a926cee8a9 (diff)
downloadFreeBSD-src-2ca675d9a88fde7c309b7bdd38263acc90f3dade.zip
FreeBSD-src-2ca675d9a88fde7c309b7bdd38263acc90f3dade.tar.gz
Fix an issue with ng_tty which (ab)used the tty->t_sc field which is
reserved for the device drivers: Add a t_lsc field for line discipline private use.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/sio/sio.c10
-rw-r--r--sys/netgraph/ng_tty.c12
-rw-r--r--sys/sys/tty.h1
3 files changed, 13 insertions, 10 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 599f188..9fbfad8 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -1152,8 +1152,10 @@ determined_type: ;
com->devs[5] = make_dev(&sioc_cdevsw,
minorbase | CALLOUT_MASK | CONTROL_LOCK_STATE,
UID_UUCP, GID_DIALER, 0660, "cuala%r", unit);
- for (rid = 0; rid < 6; rid++)
+ for (rid = 0; rid < 6; rid++) {
com->devs[rid]->si_drv1 = com;
+ com->devs[rid]->si_tty = tp;
+ }
com->flags = flags;
com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR;
@@ -1523,7 +1525,7 @@ siowrite(dev, uio, flag)
mynor = minor(dev);
unit = MINOR_TO_UNIT(mynor);
- com = com_addr(unit);
+ com = dev->si_drv1;
if (com == NULL || com->gone)
return (ENODEV);
/*
@@ -1991,10 +1993,10 @@ siocioctl(dev, cmd, data, flag, td)
struct termios *ct;
mynor = minor(dev);
- com = com_addr(MINOR_TO_UNIT(mynor));
- tp = com->tp;
+ com = dev->si_drv1;
if (com == NULL || com->gone)
return (ENODEV);
+ tp = com->tp;
switch (mynor & CONTROL_MASK) {
case CONTROL_INIT_STATE:
diff --git a/sys/netgraph/ng_tty.c b/sys/netgraph/ng_tty.c
index 9ae20a0..f29b75f 100644
--- a/sys/netgraph/ng_tty.c
+++ b/sys/netgraph/ng_tty.c
@@ -239,7 +239,7 @@ ngt_open(struct cdev *dev, struct tty *tp)
/* Set back pointers */
NG_NODE_SET_PRIVATE(sc->node, sc);
- tp->t_sc = (caddr_t) sc;
+ tp->t_lsc = sc;
/*
* Pre-allocate cblocks to the an appropriate amount.
@@ -265,7 +265,7 @@ done:
static int
ngt_close(struct tty *tp, int flag)
{
- const sc_p sc = (sc_p) tp->t_sc;
+ const sc_p sc = (sc_p) tp->t_lsc;
int s;
s = spltty();
@@ -279,7 +279,7 @@ ngt_close(struct tty *tp, int flag)
ngt_nodeop_ok = 1;
ng_rmnode_self(sc->node);
ngt_nodeop_ok = 0;
- tp->t_sc = NULL;
+ tp->t_lsc = NULL;
}
splx(s);
return (0);
@@ -309,7 +309,7 @@ ngt_write(struct tty *tp, struct uio *uio, int flag)
static int
ngt_tioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct thread *td)
{
- const sc_p sc = (sc_p) tp->t_sc;
+ const sc_p sc = (sc_p) tp->t_lsc;
int s, error = 0;
s = spltty();
@@ -343,7 +343,7 @@ done:
static int
ngt_input(int c, struct tty *tp)
{
- const sc_p sc = (sc_p) tp->t_sc;
+ const sc_p sc = (sc_p) tp->t_lsc;
const node_p node = sc->node;
struct mbuf *m;
int s, error = 0;
@@ -408,7 +408,7 @@ done:
static int
ngt_start(struct tty *tp)
{
- const sc_p sc = (sc_p) tp->t_sc;
+ const sc_p sc = (sc_p) tp->t_lsc;
int s;
s = spltty();
diff --git a/sys/sys/tty.h b/sys/sys/tty.h
index eb45490..fdbdc72 100644
--- a/sys/sys/tty.h
+++ b/sys/sys/tty.h
@@ -114,6 +114,7 @@ struct tty {
struct termios t_lock_out; /* ... outgoing */
struct winsize t_winsize; /* Window size. */
void *t_sc; /* driver private softc pointer. */
+ void *t_lsc; /* linedisc private softc pointer. */
int t_column; /* Tty output column. */
int t_rocount, t_rocol; /* Tty. */
int t_ififosize; /* Total size of upstream fifos. */
OpenPOWER on IntegriCloud