summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>1999-09-19 08:58:53 +0000
committeryokota <yokota@FreeBSD.org>1999-09-19 08:58:53 +0000
commitcd2631e4e8965f8c2fc68bdcc77143651bb8ffbe (patch)
tree94e722f104dbc677e48996bb1b7ed161aa97f5f6 /sys
parent385f21dad749b72b6d4126069fb4d243fb9b6fb4 (diff)
downloadFreeBSD-src-cd2631e4e8965f8c2fc68bdcc77143651bb8ffbe.zip
FreeBSD-src-cd2631e4e8965f8c2fc68bdcc77143651bb8ffbe.tar.gz
- Hang the scr_stat struct from dev_t.
- Remove sc_get_scr_stat(). It's not necessary anymore. - Call ttymalloc() to allocate the struct tty for each vty, rather than statically declaring an array of struct tty. We still need a statically allocated struct tty for the first vty which is used for the kernel console I/O, though. - Likewise, call ttymalloc() for /dev/sysmouse and /dev/consolectl. - Delete unnecessary test on the pointer struct tty *tp in some functions. - Delete unused code in scmouse.c. WARNING: this change requires you to recompile screen savers!
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/syscons/schistory.c3
-rw-r--r--sys/dev/syscons/scmouse.c45
-rw-r--r--sys/dev/syscons/scvesactl.c2
-rw-r--r--sys/dev/syscons/scvidctl.c3
-rw-r--r--sys/dev/syscons/syscons.c177
-rw-r--r--sys/dev/syscons/syscons.h6
6 files changed, 97 insertions, 139 deletions
diff --git a/sys/dev/syscons/schistory.c b/sys/dev/syscons/schistory.c
index 71c8991..054345a 100644
--- a/sys/dev/syscons/schistory.c
+++ b/sys/dev/syscons/schistory.c
@@ -38,6 +38,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
#include <sys/tty.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
@@ -282,7 +283,7 @@ sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
switch (cmd) {
case CONS_HISTORY: /* set history size */
- scp = sc_get_scr_stat(tp->t_dev);
+ scp = SC_STAT(tp->t_dev);
if (*(int *)data <= 0)
return EINVAL;
if (scp->status & BUFFER_SAVED)
diff --git a/sys/dev/syscons/scmouse.c b/sys/dev/syscons/scmouse.c
index cc5f328..1c576cd 100644
--- a/sys/dev/syscons/scmouse.c
+++ b/sys/dev/syscons/scmouse.c
@@ -251,27 +251,31 @@ sc_remove_cutmarking(scr_stat *scp)
void
sc_remove_all_cutmarkings(sc_softc_t *sc)
{
+ scr_stat *scp;
int i;
/* delete cut markings in all vtys */
for (i = 0; i < sc->vtys; ++i) {
- if (sc->console[i] == NULL)
+ scp = SC_STAT(sc->dev[i]);
+ if (scp == NULL)
continue;
- sc_remove_cutmarking(sc->console[i]);
+ sc_remove_cutmarking(scp);
}
}
void
sc_remove_all_mouse(sc_softc_t *sc)
{
+ scr_stat *scp;
int i;
for (i = 0; i < sc->vtys; ++i) {
- if (sc->console[i] == NULL)
+ scp = SC_STAT(sc->dev[i]);
+ if (scp == NULL)
continue;
- if (sc->console[i]->status & MOUSE_VISIBLE) {
- sc->console[i]->status &= ~MOUSE_VISIBLE;
- mark_all(sc->console[i]);
+ if (scp->status & MOUSE_VISIBLE) {
+ scp->status &= ~MOUSE_VISIBLE;
+ mark_all(scp);
}
}
}
@@ -605,7 +609,7 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
int i;
/* scp == NULL, if tp == sc_get_mouse_tty() (/dev/sysmouse) */
- scp = sc_get_scr_stat(tp->t_dev);
+ scp = SC_STAT(tp->t_dev);
switch (cmd) {
@@ -695,21 +699,6 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
return EINVAL;
}
break;
-#if 0
- if (!(scp->status & MOUSE_ENABLED)) {
- scp->mouse_oldpos = scp->mouse_pos;
- scp->status |= MOUSE_ENABLED;
- if (!ISGRAPHSC(scp))
- scp->status |= MOUSE_VISIBLE;
- splx(s);
- mark_all(scp);
- return 0;
- } else {
- splx(s);
- return EINVAL;
- }
- break;
-#endif
case MOUSE_HIDE:
s = spltty();
@@ -723,18 +712,6 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
return EINVAL;
}
break;
-#if 0
- if (scp->status & MOUSE_ENABLED) {
- scp->status &= ~(MOUSE_ENABLED | MOUSE_VISIBLE);
- mark_all(scp);
- splx(s);
- return 0;
- } else {
- splx(s);
- return EINVAL;
- }
- break;
-#endif
case MOUSE_MOVEABS:
s = spltty();
diff --git a/sys/dev/syscons/scvesactl.c b/sys/dev/syscons/scvesactl.c
index c8333d5..21295a4 100644
--- a/sys/dev/syscons/scvesactl.c
+++ b/sys/dev/syscons/scvesactl.c
@@ -62,7 +62,7 @@ vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
tp = scdevtotty(dev);
if (!tp)
return ENXIO;
- scp = sc_get_scr_stat(tp->t_dev);
+ scp = SC_STAT(tp->t_dev);
switch (cmd) {
diff --git a/sys/dev/syscons/scvidctl.c b/sys/dev/syscons/scvidctl.c
index e9716c3..305e6f7 100644
--- a/sys/dev/syscons/scvidctl.c
+++ b/sys/dev/syscons/scvidctl.c
@@ -33,6 +33,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
#include <sys/signalvar.h>
#include <sys/tty.h>
#include <sys/kernel.h>
@@ -486,7 +487,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
int error;
int s;
- scp = sc_get_scr_stat(tp->t_dev);
+ scp = SC_STAT(tp->t_dev);
if (scp == NULL) /* tp == SC_MOUSE */
return ENOIOCTL;
adp = scp->sc->adp;
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 188cb75..3af6134 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -84,6 +84,10 @@ static default_attr kernel_default = {
static int sc_console_unit = -1;
static scr_stat *sc_console;
+static struct tty *sc_console_tty;
+#ifndef SC_NO_SYSMOUSE
+static struct tty *sc_mouse_tty;
+#endif
static term_stat kernel_console;
static default_attr *current_default;
@@ -110,13 +114,10 @@ static void (*current_saver)(sc_softc_t *, int) = none_saver;
static bios_values_t bios_value;
-static struct tty sccons[2];
#define SC_MOUSE 128
#define SC_CONSOLECTL 255
-#define VIRTUAL_TTY(sc, x) (&((sc)->tty[(x) - (sc)->first_vty]))
-#define CONSOLE_TTY (&sccons[0])
-#define MOUSE_TTY (&sccons[1])
+#define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x))->si_tty)
#define debugger FALSE
@@ -314,7 +315,7 @@ sc_attach_unit(int unit, int flags)
scinit(unit, flags);
sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE);
sc->config = flags;
- scp = sc->console[0];
+ scp = SC_STAT(sc->dev[0]);
if (sc_console == NULL) /* sc_console_unit < 0 */
sc_console = scp;
@@ -370,21 +371,27 @@ sc_attach_unit(int unit, int flags)
*/
cdevsw_add(&sc_cdevsw); /* XXX do this just once... */
- for (vc = 0; vc < MAXCONS; vc++) {
- dev = make_dev(&sc_cdevsw, vc,
+ for (vc = 0; vc < sc->vtys; vc++) {
+ dev = make_dev(&sc_cdevsw, vc + unit * MAXCONS,
UID_ROOT, GID_WHEEL, 0600, "ttyv%r", vc + unit * MAXCONS);
- dev->si_tty = &sc->tty[vc];
+ sc->dev[vc] = dev;
+ /*
+ * The first vty already has struct tty and scr_stat initialized
+ * in scinit(). The other vtys will have these structs when
+ * first opened.
+ */
}
- if (scp == sc_console) {
+
#ifndef SC_NO_SYSMOUSE
- dev = make_dev(&sc_cdevsw, SC_MOUSE,
- UID_ROOT, GID_WHEEL, 0600, "sysmouse");
- dev->si_tty = MOUSE_TTY;
+ dev = make_dev(&sc_cdevsw, SC_MOUSE,
+ UID_ROOT, GID_WHEEL, 0600, "sysmouse");
+ dev->si_tty = sc_mouse_tty = ttymalloc(sc_mouse_tty);
+ /* sysmouse doesn't have scr_stat */
#endif /* SC_NO_SYSMOUSE */
- dev = make_dev(&sc_cdevsw, SC_CONSOLECTL,
- UID_ROOT, GID_WHEEL, 0600, "consolectl");
- dev->si_tty = CONSOLE_TTY;
- }
+ dev = make_dev(&sc_cdevsw, SC_CONSOLECTL,
+ UID_ROOT, GID_WHEEL, 0600, "consolectl");
+ dev->si_tty = sc_console_tty = ttymalloc(sc_console_tty);
+ SC_STAT(dev) = sc_console;
return 0;
}
@@ -459,21 +466,26 @@ scdevtounit(dev_t dev)
int
scopen(dev_t dev, int flag, int mode, struct proc *p)
{
- struct tty *tp = dev->si_tty;
int unit = scdevtounit(dev);
sc_softc_t *sc;
+ struct tty *tp;
+ scr_stat *scp;
keyarg_t key;
int error;
- if (!tp)
- return(ENXIO);
-
DPRINTF(5, ("scopen: dev:%d,%d, unit:%d, vty:%d\n",
major(dev), minor(dev), unit, SC_VTY(dev)));
/* sc == NULL, if SC_VTY(dev) == SC_MOUSE */
sc = sc_get_softc(unit, (sc_console_unit == unit) ? SC_KERNEL_CONSOLE : 0);
+#ifndef SC_NO_SYSMOUSE
+ if ((SC_VTY(dev) != SC_MOUSE) && (sc == NULL))
+#else
+ if (sc == NULL)
+#endif
+ return ENXIO;
+ tp = dev->si_tty = ttymalloc(dev->si_tty);
tp->t_oproc = (SC_VTY(dev) == SC_MOUSE) ? scmousestart : scstart;
tp->t_param = scparam;
tp->t_dev = dev;
@@ -504,20 +516,17 @@ scopen(dev_t dev, int flag, int mode, struct proc *p)
error = (*linesw[tp->t_line].l_open)(dev, tp);
- if ((SC_VTY(dev) != SC_CONSOLECTL) && (SC_VTY(dev) != SC_MOUSE)) {
+ if (SC_VTY(dev) != SC_MOUSE) {
/* assert(sc != NULL) */
- if (sc->console[SC_VTY(dev) - sc->first_vty] == NULL) {
- sc->console[SC_VTY(dev) - sc->first_vty]
- = alloc_scp(sc, SC_VTY(dev));
- if (ISGRAPHSC(sc->console[SC_VTY(dev) - sc->first_vty]))
- sc_set_pixel_mode(sc->console[SC_VTY(dev) - sc->first_vty],
- NULL, COL, ROW, 16);
+ scp = SC_STAT(dev);
+ if (scp == NULL) {
+ scp = SC_STAT(dev) = alloc_scp(sc, SC_VTY(dev));
+ if (ISGRAPHSC(scp))
+ sc_set_pixel_mode(scp, NULL, COL, ROW, 16);
}
if (!tp->t_winsize.ws_col && !tp->t_winsize.ws_row) {
- tp->t_winsize.ws_col
- = sc->console[SC_VTY(dev) - sc->first_vty]->xsize;
- tp->t_winsize.ws_row
- = sc->console[SC_VTY(dev) - sc->first_vty]->ysize;
+ tp->t_winsize.ws_col = scp->xsize;
+ tp->t_winsize.ws_row = scp->ysize;
}
}
return error;
@@ -530,10 +539,8 @@ scclose(dev_t dev, int flag, int mode, struct proc *p)
struct scr_stat *scp;
int s;
- if (!tp)
- return(ENXIO);
if ((SC_VTY(dev) != SC_CONSOLECTL) && (SC_VTY(dev) != SC_MOUSE)) {
- scp = sc_get_scr_stat(tp->t_dev);
+ scp = SC_STAT(tp->t_dev);
/* were we in the middle of the VT switching process? */
DPRINTF(5, ("sc%d: scclose(), ", scp->sc->unit));
s = spltty();
@@ -562,7 +569,6 @@ scclose(dev_t dev, int flag, int mode, struct proc *p)
sc_vtb_destroy(&scp->scr);
sc_free_history_buffer(scp, scp->ysize);
free(scp, M_DEVBUF);
- sc->console[SC_VTY(dev) - sc->first_vty] = NULL;
}
#else
scp->pid = 0;
@@ -586,8 +592,6 @@ scread(dev_t dev, struct uio *uio, int flag)
{
struct tty *tp = dev->si_tty;
- if (!tp)
- return(ENXIO);
sc_touch_scrn_saver();
return((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
@@ -597,8 +601,6 @@ scwrite(dev_t dev, struct uio *uio, int flag)
{
struct tty *tp = dev->si_tty;
- if (!tp)
- return(ENXIO);
return((*linesw[tp->t_line].l_write)(tp, uio, flag));
}
@@ -636,7 +638,8 @@ sckbdevent(keyboard_t *thiskbd, int event, void *arg)
cur_tty = VIRTUAL_TTY(sc, sc->cur_scp->index);
/* XXX */
if (!(cur_tty->t_state & TS_ISOPEN))
- if (!((cur_tty = CONSOLE_TTY)->t_state & TS_ISOPEN))
+ if (((cur_tty = sc_console_tty) == NULL)
+ || !(cur_tty->t_state & TS_ISOPEN))
continue;
switch (KEYFLAGS(c)) {
@@ -692,8 +695,6 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
int s;
tp = dev->si_tty;
- if (!tp)
- return ENXIO;
/* If there is a user_ioctl function call that first */
if (sc_user_ioctl) {
@@ -727,7 +728,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
}
#endif
- scp = sc_get_scr_stat(tp->t_dev);
+ scp = SC_STAT(tp->t_dev);
/* assert(scp != NULL) */
/* scp is sc_console, if SC_VTY(dev) == SC_CONSOLECTL. */
sc = scp->sc;
@@ -979,7 +980,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
case VT_OPENQRY: /* return free virtual console */
for (i = sc->first_vty; i < sc->first_vty + sc->vtys; i++) {
tp = VIRTUAL_TTY(sc, i);
- if (!(tp->t_state & TS_ISOPEN)) {
+ if ((tp == NULL) || !(tp->t_state & TS_ISOPEN)) {
*(int *)data = i + 1;
return 0;
}
@@ -1002,7 +1003,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
if (error)
return error;
if (*(int *)data != 0)
- scp = sc->console[*(int *)data - 1 - sc->first_vty];
+ scp = SC_STAT(SC_DEV(sc, *(int *)data - 1));
if (scp == scp->sc->cur_scp)
return 0;
while ((error=tsleep((caddr_t)&scp->smode, PZERO|PCATCH,
@@ -1294,7 +1295,7 @@ scstart(struct tty *tp)
struct clist *rbp;
int s, len;
u_char buf[PCBURST];
- scr_stat *scp = sc_get_scr_stat(tp->t_dev);
+ scr_stat *scp = SC_STAT(tp->t_dev);
if (scp->status & SLKED || scp->sc->blink_in_progress)
return;
@@ -1377,7 +1378,7 @@ sccninit(struct consdev *cp)
sc_get_cons_priority(&unit, &flags);
scinit(unit, flags | SC_KERNEL_CONSOLE);
sc_console_unit = unit;
- sc_console = sc_get_softc(unit, SC_KERNEL_CONSOLE)->console[0];
+ sc_console = SC_STAT(sc_get_softc(unit, SC_KERNEL_CONSOLE)->dev[0]);
#endif /* __i386__ */
#if __alpha__
@@ -1433,7 +1434,7 @@ sccnattach(void)
scinit(unit, flags | SC_KERNEL_CONSOLE);
sc_console_unit = unit;
- sc_console = sc_get_softc(unit, SC_KERNEL_CONSOLE)->console[0];
+ sc_console = SC_STAT(sc_get_softc(unit, SC_KERNEL_CONSOLE)->dev[0]);
consdev.cn_dev = makedev(CDEV_MAJOR, 0);
cn_tab = &consdev;
}
@@ -1600,27 +1601,6 @@ sccnupdate(scr_stat *scp)
scrn_update(scp, TRUE);
}
-scr_stat
-*sc_get_scr_stat(dev_t dev)
-{
- sc_softc_t *sc;
- int vty = SC_VTY(dev);
- int unit;
-
- if (vty < 0)
- return NULL;
- if (vty == SC_CONSOLECTL)
- return sc_console;
-
- unit = scdevtounit(dev);
- sc = sc_get_softc(unit, (sc_console_unit == unit) ? SC_KERNEL_CONSOLE : 0);
- if (sc == NULL)
- return NULL;
- if ((sc->first_vty <= vty) && (vty < sc->first_vty + sc->vtys))
- return sc->console[vty - sc->first_vty];
- return NULL;
-}
-
static void
scrn_timer(void *arg)
{
@@ -2244,7 +2224,7 @@ switch_scr(sc_softc_t *sc, u_int next_scr)
*/
if ((sc_console == NULL) || (next_scr != sc_console->index)) {
tp = VIRTUAL_TTY(sc, next_scr);
- if (!(tp->t_state & TS_ISOPEN)) {
+ if ((tp == NULL) || !(tp->t_state & TS_ISOPEN)) {
splx(s);
do_bell(sc->cur_scp, bios_value.bell_pitch, BELL_DURATION);
DPRINTF(5, ("error 2, requested vty isn't open!\n"));
@@ -2256,7 +2236,7 @@ switch_scr(sc_softc_t *sc, u_int next_scr)
++sc->switch_in_progress;
sc->delayed_next_scr = 0;
sc->old_scp = sc->cur_scp;
- sc->new_scp = sc->console[next_scr - sc->first_vty];
+ sc->new_scp = SC_STAT(SC_DEV(sc, next_scr));
if (sc->new_scp == sc->old_scp) {
sc->switch_in_progress = 0;
wakeup((caddr_t)&sc->new_scp->smode);
@@ -3137,8 +3117,8 @@ scinit(int unit, int flags)
* but is necessry evil for the time being. XXX
*/
static scr_stat main_console;
- static scr_stat *main_vtys[MAXCONS];
- static struct tty main_tty[MAXCONS];
+ static dev_t main_devs[MAXCONS];
+ static struct tty main_tty;
static u_short sc_buffer[ROW*COL]; /* XXX */
#ifndef SC_NO_FONT_LOADING
static u_char font_8[256*8];
@@ -3224,25 +3204,25 @@ scinit(int unit, int flags)
/* set up the first console */
sc->first_vty = unit*MAXCONS;
+ sc->vtys = MAXCONS;
if (flags & SC_KERNEL_CONSOLE) {
- sc->vtys = MAXCONS;
- sc->tty = main_tty;
- sc->console = main_vtys;
- scp = main_vtys[0] = &main_console;
+ sc->dev = main_devs;
+ sc->dev[0] = makedev(CDEV_MAJOR, unit*MAXCONS);
+ sc->dev[0]->si_tty = &main_tty;
+ ttyregister(&main_tty);
+ scp = &main_console;
init_scp(sc, sc->first_vty, scp);
sc_vtb_init(&scp->vtb, VTB_MEMORY, scp->xsize, scp->ysize,
(void *)sc_buffer, FALSE);
} else {
/* assert(sc_malloc) */
- sc->vtys = MAXCONS;
- sc->tty = malloc(sizeof(struct tty)*MAXCONS, M_DEVBUF, M_WAITOK);
- sc->console = malloc(sizeof(struct scr_stat *)*MAXCONS,
- M_DEVBUF, M_WAITOK);
- scp = sc->console[0] = alloc_scp(sc, sc->first_vty);
+ sc->dev = malloc(sizeof(dev_t)*sc->vtys, M_DEVBUF, M_WAITOK);
+ bzero(sc->dev, sizeof(dev_t)*sc->vtys);
+ sc->dev[0] = makedev(CDEV_MAJOR, unit*MAXCONS);
+ sc->dev[0]->si_tty = ttymalloc(sc->dev[0]->si_tty);
+ scp = alloc_scp(sc, sc->first_vty);
}
- bzero(sc->tty, sizeof(struct tty)*MAXCONS);
- for (i = 0; i < MAXCONS; i++)
- ttyregister(&sc->tty[i]);
+ SC_STAT(sc->dev[0]) = scp;
sc->cur_scp = scp;
/* copy screen to temporary buffer */
@@ -3321,10 +3301,6 @@ scinit(int unit, int flags)
if (sc->flags & SC_INIT_DONE)
return;
- /* clear structures */
- for (i = 1; i < sc->vtys; i++)
- sc->console[i] = NULL;
-
/* initialize mapscrn arrays to a one to one map */
for (i = 0; i < sizeof(sc->scr_map); i++)
sc->scr_map[i] = sc->scr_rmap[i] = i;
@@ -3363,7 +3339,8 @@ scterm(int unit, int flags)
/* clear the structure */
if (!(flags & SC_KERNEL_CONSOLE)) {
- free(sc->console, M_DEVBUF);
+ /* XXX: We need delete_dev() for this */
+ free(sc->dev, M_DEVBUF);
#if 0
/* XXX: We need a ttyunregister for this */
free(sc->tty, M_DEVBUF);
@@ -3794,7 +3771,7 @@ next_code:
sc->first_vty + i != this_scr;
i = (i + 1)%sc->vtys) {
struct tty *tp = VIRTUAL_TTY(sc, sc->first_vty + i);
- if (tp->t_state & TS_ISOPEN) {
+ if (tp && tp->t_state & TS_ISOPEN) {
switch_scr(scp->sc, sc->first_vty + i);
break;
}
@@ -3807,7 +3784,7 @@ next_code:
sc->first_vty + i != this_scr;
i = (i + sc->vtys - 1)%sc->vtys) {
struct tty *tp = VIRTUAL_TTY(sc, sc->first_vty + i);
- if (tp->t_state & TS_ISOPEN) {
+ if (tp && tp->t_state & TS_ISOPEN) {
switch_scr(scp->sc, sc->first_vty + i);
break;
}
@@ -3838,13 +3815,13 @@ next_code:
int
scmmap(dev_t dev, vm_offset_t offset, int nprot)
{
- struct tty *tp;
- struct scr_stat *scp;
+ scr_stat *scp;
- tp = dev->si_tty;
- if (!tp)
- return ENXIO;
- scp = sc_get_scr_stat(tp->t_dev);
+ if (SC_VTY(dev) == SC_MOUSE)
+ return -1;
+ scp = SC_STAT(dev);
+ if (scp != scp->sc->cur_scp)
+ return -1;
return (*vidsw[scp->sc->adapter]->mmap)(scp->sc->adp, offset, nprot);
}
@@ -4014,7 +3991,7 @@ copy_font(scr_stat *scp, int operation, int font_size, u_char *buf)
struct tty
*sc_get_mouse_tty(void)
{
- return MOUSE_TTY;
+ return sc_mouse_tty;
}
#endif /* !SC_NO_SYSMOUSE */
@@ -4027,6 +4004,8 @@ sc_paste(scr_stat *scp, u_char *p, int count)
if (scp->status & MOUSE_VISIBLE) {
tp = VIRTUAL_TTY(scp->sc, scp->sc->cur_scp->index);
+ if (!(tp->t_state & TS_ISOPEN))
+ return;
rmap = scp->sc->scr_rmap;
for (; count > 0; --count)
(*linesw[tp->t_line].l_rint)(rmap[*p++], tp);
diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h
index 674371f1..df9fdf3 100644
--- a/sys/dev/syscons/syscons.h
+++ b/sys/dev/syscons/syscons.h
@@ -64,6 +64,8 @@
#define SC_DRIVER_NAME "sc"
#define SC_VTY(dev) minor(dev)
+#define SC_DEV(sc, vty) ((sc)->dev[(vty) - (sc)->first_vty])
+#define SC_STAT(dev) ((scr_stat *)(dev)->si_drv1)
/* printable chars */
#ifndef PRINTABLE
@@ -200,8 +202,7 @@ typedef struct sc_softc {
int first_vty;
int vtys;
- struct tty *tty;
- struct scr_stat **console;
+ dev_t *dev;
struct scr_stat *cur_scp;
struct scr_stat *new_scp;
struct scr_stat *old_scp;
@@ -407,7 +408,6 @@ int sc_attach_unit(int unit, int flags);
int sc_resume_unit(int unit);
int set_mode(scr_stat *scp);
-scr_stat *sc_get_scr_stat(dev_t dev);
void copy_font(scr_stat *scp, int operation, int font_size,
u_char *font_image);
OpenPOWER on IntegriCloud