diff options
| author | martin <martin@NetBSD.org> | 2020-04-06 14:44:15 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2020-04-06 14:44:15 +0000 |
| commit | 3a476ccfc75d10e960523988a8dcdd71487c1ff9 (patch) | |
| tree | 07f5d2cb4208f01277744ae4514c03295ef3b51a /sys/dev | |
| parent | 9c9663c78a5ddbfa732563d2f5409e4db0fac5b2 (diff) | |
Pull up following revision(s) (requested by pgoyette in ticket #820):
sys/dev/wscons/wsevent.c: revision 1.43
sys/dev/wscons/wsevent.c: revision 1.44
Make default protocol version used by wscons selectable and default
to the current version.
Fixes PR 55103.
KNF (Format block comment)
NFCI
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/wscons/wsevent.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c index f6a4ce2a291..4822a73abae 100644 --- a/sys/dev/wscons/wsevent.c +++ b/sys/dev/wscons/wsevent.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsevent.c,v 1.42 2019/03/01 11:06:57 pgoyette Exp $ */ +/* $NetBSD: wsevent.c,v 1.42.4.1 2020/04/06 14:44:15 martin Exp $ */ /*- * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc. @@ -104,7 +104,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.42 2019/03/01 11:06:57 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.42.4.1 2020/04/06 14:44:15 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -121,6 +121,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.42 2019/03/01 11:06:57 pgoyette Exp $" #include <sys/select.h> #include <sys/poll.h> #include <sys/compat_stub.h> +#include <sys/sysctl.h> #include <dev/wscons/wsconsio.h> #include <dev/wscons/wseventvar.h> @@ -138,6 +139,8 @@ __KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.42 2019/03/01 11:06:57 pgoyette Exp $" sizeof(struct owscons_event)) #define EVARRAY(ev, idx) (&(ev)->q[(idx)]) +static int wsevent_default_version = WSEVENT_VERSION; + /* * Priority of code managing wsevent queues. PWSEVENT is set just above * PSOCK, which is just above TTIPRI, on the theory that mouse and keyboard @@ -161,8 +164,17 @@ wsevent_init(struct wseventvar *ev, struct proc *p) #endif return; } - /* For binary compat. New code must call WSxxxIO_SETVERSION */ - ev->version = 0; + /* + * For binary compat set default version and either build with + * COMPAT_50 or load COMPAT_50 module to include the compatibility + * code. + */ + if (wsevent_default_version >= 0 && + wsevent_default_version < WSEVENT_VERSION) + ev->version = wsevent_default_version; + else + ev->version = WSEVENT_VERSION; + ev->get = ev->put = 0; ev->q = kmem_alloc(WSEVENT_QSIZE * sizeof(*ev->q), KM_SLEEP); selinit(&ev->sel); @@ -445,3 +457,22 @@ wsevent_setversion(struct wseventvar *ev, int vers) ev->version = vers; return 0; } + +SYSCTL_SETUP(sysctl_wsevent_setup, "sysctl hw.wsevent subtree setup") +{ + const struct sysctlnode *node = NULL; + + if (sysctl_createv(clog, 0, NULL, &node, + CTLFLAG_PERMANENT, + CTLTYPE_NODE, "wsevent", NULL, + NULL, 0, NULL, 0, + CTL_HW, CTL_CREATE, CTL_EOL) != 0) + return; + + sysctl_createv(clog, 0, &node, NULL, + CTLFLAG_READWRITE, + CTLTYPE_INT, "default_version", + SYSCTL_DESCR("Set default event version for compatibility"), + NULL, 0, &wsevent_default_version, 0, + CTL_CREATE, CTL_EOL); +} |
