Fix the dumb and sc terminal emulators to compile and work.

First remove ifdefs of the unsupported option SC_DUMB_TERMINAL which
prevented building using both in the same kernel and broke regression
tests.  This option will be replaced by per-emulator supported options.

The dumb emulator rotted with KSE in r83366, but usually compiled since
it is ifdefed to nothing unless SC_DUMB_TERMINAL is defined.  The type
of an unused function parameter changed.

Both emulators rotted when 2 new methods were added while the emulators
were removed.  Only null methods are needed, but null function pointers
give panics instead.

The wildcard in the default for the unsupported option SC_DFLT_TERM
never really worked.  It tends to prefer the dumb emulator when multiple
emulators are configured.  Change it to prefer scteken for compatibility.
This commit is contained in:
bde 2019-02-21 19:19:30 +00:00
parent 992b29a96b
commit 543fd0f706
3 changed files with 34 additions and 10 deletions

View File

@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/consio.h>
#if defined(__sparc64__) || defined(__powerpc__)
@ -42,8 +44,6 @@ __FBSDID("$FreeBSD$");
#include <dev/syscons/syscons.h>
#include <dev/syscons/sctermvar.h>
#ifdef SC_DUMB_TERMINAL
/* dumb terminal emulator */
static sc_term_init_t dumb_init;
@ -53,6 +53,8 @@ static sc_term_ioctl_t dumb_ioctl;
static sc_term_clear_t dumb_clear;
static sc_term_input_t dumb_input;
static void dumb_nop(void);
static sc_term_fkeystr_t dumb_fkeystr;
static sc_term_sync_t dumb_sync;
static sc_term_sw_t sc_term_dumb = {
{ NULL, NULL },
@ -70,6 +72,8 @@ static sc_term_sw_t sc_term_dumb = {
dumb_clear,
(sc_term_notify_t *)dumb_nop,
dumb_input,
dumb_fkeystr,
dumb_sync,
};
SCTERM_MODULE(dumb, sc_term_dumb);
@ -108,7 +112,7 @@ dumb_puts(scr_stat *scp, u_char *buf, int len)
static int
dumb_ioctl(scr_stat *scp, struct tty *tp, u_long cmd, caddr_t data,
int flag, struct proc *p)
struct thread *td)
{
vid_info_t *vi;
@ -146,10 +150,19 @@ dumb_input(scr_stat *scp, int c, struct tty *tp)
return FALSE;
}
static const char *
dumb_fkeystr(scr_stat *scp, int c)
{
return (NULL);
}
static void
dumb_sync(scr_stat *scp)
{
}
static void
dumb_nop(void)
{
/* nothing */
}
#endif /* SC_DUMB_TERMINAL */

View File

@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$");
#include <dev/syscons/syscons.h>
#include <dev/syscons/sctermvar.h>
#ifndef SC_DUMB_TERMINAL
#define MAX_ESC_PAR 5
/* attribute flags */
@ -89,6 +87,8 @@ static sc_term_default_attr_t scterm_default_attr;
static sc_term_clear_t scterm_clear;
static sc_term_notify_t scterm_notify;
static sc_term_input_t scterm_input;
static sc_term_fkeystr_t scterm_fkeystr;
static sc_term_sync_t scterm_sync;
static sc_term_sw_t sc_term_sc = {
{ NULL, NULL },
@ -106,6 +106,8 @@ static sc_term_sw_t sc_term_sc = {
scterm_clear,
scterm_notify,
scterm_input,
scterm_fkeystr,
scterm_sync,
};
SCTERM_MODULE(sc, sc_term_sc);
@ -780,6 +782,17 @@ scterm_input(scr_stat *scp, int c, struct tty *tp)
return FALSE;
}
static const char *
scterm_fkeystr(scr_stat *scp, int c)
{
return (NULL);
}
static void
scterm_sync(scr_stat *scp)
{
}
/*
* Calculate hardware attributes word using logical attributes mask and
* hardware colors
@ -807,5 +820,3 @@ mask2attr(term_stat *tcp)
return (attr << 8);
}
#endif /* SC_DUMB_TERMINAL */

View File

@ -378,7 +378,7 @@ typedef struct sc_ttysoftc {
/* terminal emulator */
#ifndef SC_DFLT_TERM
#define SC_DFLT_TERM "*" /* any */
#define SC_DFLT_TERM "scteken"
#endif
typedef int sc_term_init_t(scr_stat *scp, void **tcp, int code);