Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys Move the compat_50-specific code out of wscons...



details:   https://anonhg.NetBSD.org/src/rev/8091acf9ca9a
branches:  pgoyette-compat
changeset: 321092:8091acf9ca9a
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sat Mar 24 23:52:19 2018 +0000

description:
Move the compat_50-specific code out of wscons/wsevent.c into its own
source file, which is now part of the compat_50 module.

diffstat:

 sys/compat/common/Makefile.sysio  |    6 +-
 sys/compat/common/compat_50_mod.c |    9 +-
 sys/dev/wscons/files.wscons       |    3 +-
 sys/dev/wscons/wsevent.c          |   49 +---------
 sys/dev/wscons/wsevent_50.c       |  159 ++++++++++++++++++++++++++++++++++++++
 sys/dev/wscons/wsevent_50.h       |   38 +++++++++
 sys/kern/compat_stub.c            |    8 +-
 sys/modules/compat_50/Makefile    |    6 +-
 sys/sys/compat_stub.h             |   12 ++-
 9 files changed, 242 insertions(+), 48 deletions(-)

diffs (truncated from 435 to 300 lines):

diff -r 7d164dbe2bc2 -r 8091acf9ca9a sys/compat/common/Makefile.sysio
--- a/sys/compat/common/Makefile.sysio  Sat Mar 24 10:46:13 2018 +0000
+++ b/sys/compat/common/Makefile.sysio  Sat Mar 24 23:52:19 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.sysio,v 1.7.18.11 2018/03/24 08:24:40 pgoyette Exp $
+#      $NetBSD: Makefile.sysio,v 1.7.18.12 2018/03/24 23:52:19 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -56,3 +56,7 @@
 # Puffs compatability code for NetBSD 5.0
 .PATH: ${S}/fs/puffs
 SRCS+= puffs_compat.c
+
+# wsevent compatability code for NetBSD 5.0
+.PATH: ${S}/dev/wscons
+SRCS+= wsevent_50.c
diff -r 7d164dbe2bc2 -r 8091acf9ca9a sys/compat/common/compat_50_mod.c
--- a/sys/compat/common/compat_50_mod.c Sat Mar 24 10:46:13 2018 +0000
+++ b/sys/compat/common/compat_50_mod.c Sat Mar 24 23:52:19 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_50_mod.c,v 1.1.2.6 2018/03/24 08:11:12 pgoyette Exp $   */
+/*     $NetBSD: compat_50_mod.c,v 1.1.2.7 2018/03/24 23:52:19 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.1.2.6 2018/03/24 08:11:12 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.1.2.7 2018/03/24 23:52:19 pgoyette Exp $");
 
 #include <sys/systm.h>
 #include <sys/module.h>
@@ -53,6 +53,8 @@
 
 #include <dev/raidframe/rf_compat50_mod.h>
 
+#include <dev/wscons/wsevent_50.h>
+
 #include <fs/puffs/puffs_sys.h>
 
 int
@@ -83,6 +85,7 @@
        cryptodev_50_init();
        raidframe_50_init();
        puffs_50_init();
+       wsevent_50_init();
 
        return error;
 
@@ -103,6 +106,7 @@
 {
        int error = 0;
 
+       wsevent_50_fini();
        puffs_50_fini();
        raidframe_50_fini();
        cryptodev_50_fini();
@@ -144,6 +148,7 @@
        cryptodev_50_init();
        raidframe_50_init();
        puffs_50_init();
+       wsevent_50_init();
 
        return error;
 }
diff -r 7d164dbe2bc2 -r 8091acf9ca9a sys/dev/wscons/files.wscons
--- a/sys/dev/wscons/files.wscons       Sat Mar 24 10:46:13 2018 +0000
+++ b/sys/dev/wscons/files.wscons       Sat Mar 24 23:52:19 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.wscons,v 1.55 2017/12/18 18:59:32 jmcneill Exp $
+# $NetBSD: files.wscons,v 1.55.2.1 2018/03/24 23:52:19 pgoyette Exp $
 
 #
 # "Workstation Console" glue; attaches frame buffer to emulator & keyboard,
@@ -58,6 +58,7 @@
 file   dev/wscons/wsemul_vt100_chars.c wsdisplay & wsemul_vt100
 file   dev/wscons/wsemul_vt100_keys.c  wsdisplay & wsemul_vt100
 file   dev/wscons/wsevent.c            wsdisplay | wskbd | wsmouse | wsmux
+file   dev/wscons/wsevent_50.c         compat_50
 file   dev/wscons/wskbd.c              wskbd                   needs-flag
 file   dev/wscons/wskbdutil.c          wskbd                   needs-flag
 file   dev/wscons/wsmouse.c            wsmouse                 needs-flag
diff -r 7d164dbe2bc2 -r 8091acf9ca9a sys/dev/wscons/wsevent.c
--- a/sys/dev/wscons/wsevent.c  Sat Mar 24 10:46:13 2018 +0000
+++ b/sys/dev/wscons/wsevent.c  Sat Mar 24 23:52:19 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsevent.c,v 1.37 2017/10/25 08:12:39 maya Exp $ */
+/* $NetBSD: wsevent.c,v 1.37.2.1 2018/03/24 23:52:19 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc.
@@ -104,12 +104,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.37 2017/10/25 08:12:39 maya Exp $");
-
-#ifdef _KERNEL_OPT
-#include "opt_compat_netbsd.h"
-#include "opt_modular.h"
-#endif
+__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.37.2.1 2018/03/24 23:52:19 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -120,6 +115,7 @@
 #include <sys/vnode.h>
 #include <sys/select.h>
 #include <sys/poll.h>
+#include <sys/compat_stub.h>
 
 #include <dev/wscons/wsconsio.h>
 #include <dev/wscons/wseventvar.h>
@@ -188,47 +184,18 @@
        softint_disestablish(ev->sih);
 }
 
-#if defined(COMPAT_50) || defined(MODULAR)
-static int
-wsevent_copyout_events50(const struct wscons_event *events, int cnt,
-    struct uio *uio)
-{
-       int i;
-
-       for (i = 0; i < cnt; i++) {
-               const struct wscons_event *ev = &events[i];
-               struct owscons_event ev50;
-               int error;
-
-               ev50.type = ev->type;
-               ev50.value = ev->value;
-               timespec_to_timespec50(&ev->time, &ev50.time);
-
-               error = uiomove(&ev50, sizeof(ev50), uio);
-               if (error) {
-                       return error;
-               }
-       }
-       return 0;
-}
-#else /* defined(COMPAT_50) || defined(MODULAR) */
-static int
-wsevent_copyout_events50(const struct wscons_event *events, int cnt,
-    struct uio *uio)
-{
-
-       return EINVAL;
-}
-#endif /* defined(COMPAT_50) || defined(MODULAR) */
-
 static int
 wsevent_copyout_events(const struct wscons_event *events, int cnt,
     struct uio *uio, int ver)
 {
+       int error;
 
        switch (ver) {
        case 0:
-               return wsevent_copyout_events50(events, cnt, uio);
+               error = (*wsevent_50_copyout_events)(events, cnt, uio);
+               if (error == ENOSYS)
+                       error = EINVAL;
+               return error;
        case WSEVENT_VERSION:
                return uiomove(__UNCONST(events), cnt * sizeof(*events), uio);
        default:
diff -r 7d164dbe2bc2 -r 8091acf9ca9a sys/dev/wscons/wsevent_50.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/wscons/wsevent_50.c       Sat Mar 24 23:52:19 2018 +0000
@@ -0,0 +1,159 @@
+/* $NetBSD: wsevent_50.c,v 1.1.2.1 2018/03/24 23:52:19 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Julio M. Merino Vidal.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou
+ *     for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)event.c     8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * Internal "wscons_event" queue interface for the keyboard and mouse drivers.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: wsevent_50.c,v 1.1.2.1 2018/03/24 23:52:19 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/fcntl.h>
+#include <sys/kmem.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/vnode.h>
+#include <sys/select.h>
+#include <sys/poll.h>
+#include <sys/compat_stub.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wseventvar.h>
+#include <dev/wscons/wsevent_50.h>
+
+static int
+wsevent_copyout_events50(const struct wscons_event *events, int cnt,
+    struct uio *uio)
+{



Home | Main Index | Thread Index | Old Index