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.
This commit is contained in:
parent
1ec74e2d4c
commit
8a5166927f
@ -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:
|
||||
|
@ -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 @@ ngt_open(struct cdev *dev, struct tty *tp)
|
||||
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 @@ ngt_tioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct thread *td
|
||||
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 @@ ngt_input(int c, struct tty *tp)
|
||||
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();
|
||||
|
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user