summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-10-18 13:54:10 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-10-18 13:54:10 +0000
commit4f55dcff0a28e263b548fe8048682b41a7affa3e (patch)
tree58ef36f04f1dc7af59ff598ae6b86aa86ea8a462 /sys
parent0e724c882678c61297f6e6523cd47110e62f5597 (diff)
Introduce a dedicated private header file to control the optional features
of wscons (which usually get disabled for installation kernels, to save space), instead of duplicating parts of it to too many places. No functional change.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/wscons/wscons_features.h29
-rw-r--r--sys/dev/wscons/wsdisplay.c59
-rw-r--r--sys/dev/wscons/wsemul_sun.c13
-rw-r--r--sys/dev/wscons/wsemul_vt100.c13
-rw-r--r--sys/dev/wscons/wskbd.c14
-rw-r--r--sys/dev/wscons/wsmouse.c9
6 files changed, 74 insertions, 63 deletions
diff --git a/sys/dev/wscons/wscons_features.h b/sys/dev/wscons/wscons_features.h
new file mode 100644
index 00000000000..459059d3fe9
--- /dev/null
+++ b/sys/dev/wscons/wscons_features.h
@@ -0,0 +1,29 @@
+/* $OpenBSD: wscons_features.h,v 1.1 2013/10/18 13:54:08 miod Exp $ */
+/* public domain */
+
+/*
+ * This file contains the logic used to enable several optional features
+ * of the wscons framework:
+ *
+ * HAVE_WSMOUSED_SUPPORT
+ * defined to enable support for wsmoused(8)
+ * HAVE_BURNER_SUPPORT
+ * defined to enable screen blanking functionnality, controlled by
+ * wsconsctl(8)
+ * HAVE_SCROLLBACK_SUPPORT
+ * defined to enable xterm-like shift-PgUp scrollback if the underlying
+ * wsdisplay supports this
+ * HAVE_JUMP_SCROLL
+ * defined to enable jump scroll in the textmode emulation code
+ */
+
+#ifdef _KERNEL
+
+#ifndef SMALL_KERNEL
+#define HAVE_WSMOUSED_SUPPORT
+#define HAVE_BURNER_SUPPORT
+#define HAVE_SCROLLBACK_SUPPORT
+#define HAVE_JUMP_SCROLL
+#endif
+
+#endif
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index bb260788ac3..867be152a9f 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.112 2013/07/06 14:35:45 kettenis Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.113 2013/10/18 13:54:08 miod Exp $ */
/* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -31,12 +31,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SMALL_KERNEL
-#define WSMOUSED_SUPPORT
-#define BURNER_SUPPORT
-#define SCROLLBACK_SUPPORT
-#endif
-
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/device.h>
@@ -54,6 +48,7 @@
#include <sys/timeout.h>
#include <sys/poll.h>
+#include <dev/wscons/wscons_features.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsksymvar.h>
@@ -115,7 +110,7 @@ struct wsscreen {
struct wsdisplay_softc *sc;
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/* mouse console support via wsmoused(8) */
u_int mouse; /* mouse cursor position */
u_int cursor; /* selection cursor position (if
@@ -144,7 +139,7 @@ struct wsscreen {
#define IS_SEL_BY_CHAR(scr) ((scr)->mouse_flags & SEL_BY_CHAR)
#define IS_SEL_BY_WORD(scr) ((scr)->mouse_flags & SEL_BY_WORD)
#define IS_SEL_BY_LINE(scr) ((scr)->mouse_flags & SEL_BY_LINE)
-#endif /* WSMOUSED_SUPPORT */
+#endif /* HAVE_WSMOUSED_SUPPORT */
};
struct wsscreen *wsscreen_attach(struct wsdisplay_softc *, int, const char *,
@@ -173,7 +168,7 @@ struct wsdisplay_softc {
int sc_focusidx; /* available only if sc_focus isn't null */
struct wsscreen *sc_focus;
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
struct timeout sc_burner;
int sc_burnoutintvl;
int sc_burninintvl;
@@ -199,7 +194,7 @@ struct wsdisplay_softc {
#endif
#endif /* NWSKBD > 0 */
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
dev_t wsmoused_dev; /* device opened by wsmoused(8), when active */
int wsmoused_sleep; /* true when wsmoused(8) is sleeping */
@@ -415,7 +410,7 @@ wsdisplay_addscreen(struct wsdisplay_softc *sc, int idx,
}
splx(s);
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
allocate_copybuffer(sc); /* enlarge the copy buffer if necessary */
#endif
return (0);
@@ -618,7 +613,7 @@ wsdisplay_common_detach(struct wsdisplay_softc *sc, int flags)
return (rc);
}
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
timeout_del(&sc->sc_burner);
#endif
@@ -773,7 +768,7 @@ wsdisplay_common_attach(struct wsdisplay_softc *sc, int console, int kbdmux,
if (i > start)
wsdisplay_addscreen_print(sc, start, i-start);
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
sc->sc_burnoutintvl = (hz * WSDISPLAY_DEFBURNOUT) / 1000;
sc->sc_burninintvl = (hz * WSDISPLAY_DEFBURNIN ) / 1000;
sc->sc_burnflags = 0; /* off by default */
@@ -950,7 +945,7 @@ wsdisplayclose(dev_t dev, int flag, int mode, struct proc *p)
scr->scr_flags &= ~SCR_OPEN;
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/* remove the selection at logout */
if (sc->sc_copybuffer != NULL)
bzero(sc->sc_copybuffer, sc->sc_copybuffer_size);
@@ -1121,7 +1116,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
switch (cmd) {
case WSDISPLAYIO_SMODE:
case WSDISPLAYIO_USEFONT:
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
case WSDISPLAYIO_SVIDEO:
case WSDISPLAYIO_SBURNER:
#endif
@@ -1154,7 +1149,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
scr->scr_flags |= SCR_GRAPHICS |
((d == WSDISPLAYIO_MODE_DUMBFB) ? SCR_DUMBFB : 0);
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/*
* wsmoused cohabitation with X-Window support
* X-Window is starting
@@ -1166,7 +1161,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
(*scr->scr_dconf->wsemul->reset)
(scr->scr_dconf->wsemulcookie, WSEMUL_CLEARCURSOR);
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
/* enable video _immediately_ if it nedes to be... */
if (sc->sc_burnman)
wsdisplay_burner(sc);
@@ -1177,7 +1172,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
}
#endif
} else {
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
/* reenable the burner after exiting from X */
if (!sc->sc_burnman) {
sc->sc_burnout = sc->sc_burnoutintvl;
@@ -1185,7 +1180,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
}
#endif
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/*
* wsmoused cohabitation with X-Window support
* X-Window is ending
@@ -1212,7 +1207,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
(scr->scr_dconf->wsemulcookie, WSEMUL_SYNCFONT);
return (error);
#undef d
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
case WSDISPLAYIO_GVIDEO:
*(u_int *)data = !sc->sc_burnman;
break;
@@ -1271,7 +1266,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
}
return (error);
#undef d
-#endif /* BURNER_SUPPORT */
+#endif /* HAVE_BURNER_SUPPORT */
case WSDISPLAYIO_GETSCREEN:
return (wsdisplay_getscreen(sc,
(struct wsdisplay_addscreendata *)data));
@@ -1319,7 +1314,7 @@ wsdisplay_cfg_ioctl(struct wsdisplay_softc *sc, u_long cmd, caddr_t data,
#endif
switch (cmd) {
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
case WSDISPLAYIO_WSMOUSED:
error = wsmoused(sc, cmd, data, flag, p);
return (error);
@@ -1496,10 +1491,10 @@ wsdisplaystart(struct tty *tp)
buf = tp->t_outq.c_cf;
if (!(scr->scr_flags & SCR_GRAPHICS)) {
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
wsdisplay_burn(sc, WSDISPLAY_BURN_OUTPUT);
#endif
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
if (scr == sc->sc_focus) {
if (ISSET(scr->mouse_flags, SEL_EXISTS))
/* hide a potential selection */
@@ -1891,7 +1886,7 @@ wsdisplay_switch(struct device *dev, int no, int waitok)
sc->sc_oldscreen = sc->sc_focusidx;
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/*
* wsmoused cohabitation with X-Window support
*
@@ -1934,7 +1929,7 @@ wsdisplay_switch(struct device *dev, int no, int waitok)
wsmoused_wakeup(sc);
}
-#endif /* WSMOUSED_SUPPORT */
+#endif /* HAVE_WSMOUSED_SUPPORT */
#ifdef WSDISPLAY_COMPAT_USL
#define wsswitch_cb1 ((void (*)(void *, int, int))wsdisplay_switch1)
@@ -2155,7 +2150,7 @@ wsdisplay_cnputc(dev_t dev, int i)
return;
dc = &wsdisplay_console_conf;
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
/*wsdisplay_burn(wsdisplay_console_device, WSDISPLAY_BURN_OUTPUT);*/
#endif
(void)(*dc->wsemul->output)(dc->wsemulcookie, &c, 1, 1);
@@ -2319,7 +2314,7 @@ wsdisplay_resume_device(struct device *dev)
}
}
-#ifdef SCROLLBACK_SUPPORT
+#ifdef HAVE_SCROLLBACK_SUPPORT
void
wsscrollback(void *arg, int op)
{
@@ -2344,7 +2339,7 @@ wsscrollback(void *arg, int op)
}
#endif
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
void
wsdisplay_burn(void *v, u_int flags)
{
@@ -2381,7 +2376,7 @@ wsdisplay_burner(void *v)
}
#endif
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/*
* wsmoused(8) support functions
*/
@@ -3463,4 +3458,4 @@ wsmoused_wakeup(struct wsdisplay_softc *sc)
}
#endif /* NWSMOUSE > 0 */
}
-#endif /* WSMOUSED_SUPPORT */
+#endif /* HAVE_WSMOUSED_SUPPORT */
diff --git a/sys/dev/wscons/wsemul_sun.c b/sys/dev/wscons/wsemul_sun.c
index 43cac5af2db..d490894077b 100644
--- a/sys/dev/wscons/wsemul_sun.c
+++ b/sys/dev/wscons/wsemul_sun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsemul_sun.c,v 1.28 2009/09/05 16:51:19 miod Exp $ */
+/* $OpenBSD: wsemul_sun.c,v 1.29 2013/10/18 13:54:09 miod Exp $ */
/* $NetBSD: wsemul_sun.c,v 1.11 2000/01/05 11:19:36 drochner Exp $ */
/*
@@ -38,16 +38,13 @@
* Color support from NetBSD's rcons color code, and wsemul_vt100.
*/
-#ifndef SMALL_KERNEL
-#define JUMP_SCROLL
-#endif
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/malloc.h>
#include <sys/fcntl.h>
+#include <dev/wscons/wscons_features.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsemulvar.h>
@@ -593,7 +590,7 @@ wsemul_sun_output(void *cookie, const u_char *data, u_int count, int kernel)
struct wsemul_sun_emuldata *edp = cookie;
u_int processed = 0;
u_char c;
-#ifdef JUMP_SCROLL
+#ifdef HAVE_JUMP_SCROLL
int lines;
#endif
int rc = 0;
@@ -626,7 +623,7 @@ wsemul_sun_output(void *cookie, const u_char *data, u_int count, int kernel)
}
for (; count > 0; data++, count--) {
-#ifdef JUMP_SCROLL
+#ifdef HAVE_JUMP_SCROLL
switch (edp->abortstate.state) {
case ABORT_FAILED_JUMP_SCROLL:
/*
@@ -738,7 +735,7 @@ wsemul_sun_output(void *cookie, const u_char *data, u_int count, int kernel)
return processed;
}
-#ifdef JUMP_SCROLL
+#ifdef HAVE_JUMP_SCROLL
int
wsemul_sun_jump_scroll(struct wsemul_sun_emuldata *edp, const u_char *data,
u_int count, int kernel)
diff --git a/sys/dev/wscons/wsemul_vt100.c b/sys/dev/wscons/wsemul_vt100.c
index 8fd68469df9..ae6b918fc12 100644
--- a/sys/dev/wscons/wsemul_vt100.c
+++ b/sys/dev/wscons/wsemul_vt100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsemul_vt100.c,v 1.29 2013/06/16 19:04:20 miod Exp $ */
+/* $OpenBSD: wsemul_vt100.c,v 1.30 2013/10/18 13:54:09 miod Exp $ */
/* $NetBSD: wsemul_vt100.c,v 1.13 2000/04/28 21:56:16 mycroft Exp $ */
/*
@@ -27,16 +27,13 @@
*
*/
-#ifndef SMALL_KERNEL
-#define JUMP_SCROLL
-#endif
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/malloc.h>
#include <sys/fcntl.h>
+#include <dev/wscons/wscons_features.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsemulvar.h>
@@ -1010,7 +1007,7 @@ wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int kernel)
struct wsemul_vt100_emuldata *edp = cookie;
u_int processed = 0;
u_char c;
-#ifdef JUMP_SCROLL
+#ifdef HAVE_JUMP_SCROLL
int lines;
#endif
int rc = 0;
@@ -1046,7 +1043,7 @@ wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int kernel)
}
for (; count > 0; data++, count--) {
-#ifdef JUMP_SCROLL
+#ifdef HAVE_JUMP_SCROLL
switch (edp->abortstate.state) {
case ABORT_FAILED_JUMP_SCROLL:
/*
@@ -1145,7 +1142,7 @@ wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int kernel)
return processed;
}
-#ifdef JUMP_SCROLL
+#ifdef HAVE_JUMP_SCROLL
int
wsemul_vt100_jump_scroll(struct wsemul_vt100_emuldata *edp, const u_char *data,
u_int count, int kernel)
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c
index 535a5a57e1c..0fafe4d48c8 100644
--- a/sys/dev/wscons/wskbd.c
+++ b/sys/dev/wscons/wskbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbd.c,v 1.72 2013/01/06 18:07:07 ratchov Exp $ */
+/* $OpenBSD: wskbd.c,v 1.73 2013/10/18 13:54:09 miod Exp $ */
/* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */
/*
@@ -99,6 +99,7 @@
#include <ddb/db_var.h>
+#include <dev/wscons/wscons_features.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wskbdvar.h>
#include <dev/wscons/wsksymdef.h>
@@ -112,11 +113,6 @@
#include "wskbd.h"
#include "wsmux.h"
-#ifndef SMALL_KERNEL
-#define BURNER_SUPPORT
-#define SCROLLBACK_SUPPORT
-#endif
-
#ifdef WSKBD_DEBUG
#define DPRINTF(x) if (wskbddebug) printf x
int wskbddebug = 0;
@@ -618,14 +614,14 @@ wskbd_input(struct device *dev, u_int type, int value)
* send upstream.
*/
if (sc->sc_translating) {
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
if (type == WSCONS_EVENT_KEY_DOWN && sc->sc_displaydv != NULL)
wsdisplay_burn(sc->sc_displaydv, WSDISPLAY_BURN_KBD);
#endif
num = wskbd_translate(sc->id, type, value);
if (num > 0) {
if (sc->sc_displaydv != NULL) {
-#ifdef SCROLLBACK_SUPPORT
+#ifdef HAVE_SCROLLBACK_SUPPORT
/* XXX - Shift_R+PGUP(release) emits PrtSc */
if (sc->id->t_symbols[0] != KS_Print_Screen) {
wsscrollback(sc->sc_displaydv,
@@ -1388,7 +1384,7 @@ internal_command(struct wskbd_softc *sc, u_int *type, keysym_t ksym,
if (*type != WSCONS_EVENT_KEY_DOWN)
return (0);
-#ifdef SCROLLBACK_SUPPORT
+#ifdef HAVE_SCROLLBACK_SUPPORT
#if NWSDISPLAY > 0
switch (ksym) {
case KS_Cmd_ScrollBack:
diff --git a/sys/dev/wscons/wsmouse.c b/sys/dev/wscons/wsmouse.c
index 8985e053185..889c650d69d 100644
--- a/sys/dev/wscons/wsmouse.c
+++ b/sys/dev/wscons/wsmouse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmouse.c,v 1.23 2012/07/22 18:28:36 shadchin Exp $ */
+/* $OpenBSD: wsmouse.c,v 1.24 2013/10/18 13:54:09 miod Exp $ */
/* $NetBSD: wsmouse.c,v 1.35 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -75,10 +75,6 @@
* Mouse driver.
*/
-#ifndef SMALL_KERNEL
-#define BURNER_SUPPORT
-#endif
-
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/ioctl.h>
@@ -93,6 +89,7 @@
#include <sys/vnode.h>
#include <sys/poll.h>
+#include <dev/wscons/wscons_features.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsmousevar.h>
#include <dev/wscons/wseventvar.h>
@@ -481,7 +478,7 @@ out:
sc->sc_ub = ub;
evar->put = put;
WSEVENT_WAKEUP(evar);
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
/* wsdisplay_burn(sc->sc_displaydv, WSDISPLAY_BURN_MOUSE); */
#endif
#if NWSMUX > 0