Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/dev/wscons Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/09b47dc7344f
branches:  netbsd-9
changeset: 963765:09b47dc7344f
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Apr 06 14:44:15 2020 +0000

description:
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:

 sys/dev/wscons/wsevent.c |  39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)

diffs (78 lines):

diff -r 5a646c576f14 -r 09b47dc7344f sys/dev/wscons/wsevent.c
--- a/sys/dev/wscons/wsevent.c  Fri Apr 03 12:28:24 2020 +0000
+++ b/sys/dev/wscons/wsevent.c  Mon Apr 06 14:44:15 2020 +0000
@@ -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 @@
 #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 @@
     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 @@
 #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 @@
        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);
+}



Home | Main Index | Thread Index | Old Index