Module Name:    src
Committed By:   pgoyette
Date:           Sat Mar 24 23:52:19 UTC 2018

Modified Files:
        src/sys/compat/common [pgoyette-compat]: Makefile.sysio compat_50_mod.c
        src/sys/dev/wscons [pgoyette-compat]: files.wscons wsevent.c
        src/sys/kern [pgoyette-compat]: compat_stub.c
        src/sys/modules/compat_50 [pgoyette-compat]: Makefile
        src/sys/sys [pgoyette-compat]: compat_stub.h
Added Files:
        src/sys/dev/wscons [pgoyette-compat]: wsevent_50.c wsevent_50.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.7.18.11 -r1.7.18.12 src/sys/compat/common/Makefile.sysio
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/compat/common/compat_50_mod.c
cvs rdiff -u -r1.55 -r1.55.2.1 src/sys/dev/wscons/files.wscons
cvs rdiff -u -r1.37 -r1.37.2.1 src/sys/dev/wscons/wsevent.c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/dev/wscons/wsevent_50.c \
    src/sys/dev/wscons/wsevent_50.h
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/modules/compat_50/Makefile
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/sys/compat_stub.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.7.18.11 src/sys/compat/common/Makefile.sysio:1.7.18.12
--- src/sys/compat/common/Makefile.sysio:1.7.18.11	Sat Mar 24 08:24:40 2018
+++ src/sys/compat/common/Makefile.sysio	Sat Mar 24 23:52:19 2018
@@ -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 @@ SRCS+=	rf_compat80.c
 # 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

Index: src/sys/compat/common/compat_50_mod.c
diff -u src/sys/compat/common/compat_50_mod.c:1.1.2.6 src/sys/compat/common/compat_50_mod.c:1.1.2.7
--- src/sys/compat/common/compat_50_mod.c:1.1.2.6	Sat Mar 24 08:11:12 2018
+++ src/sys/compat/common/compat_50_mod.c	Sat Mar 24 23:52:19 2018
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: compat_50_mo
 
 #include <dev/raidframe/rf_compat50_mod.h>
 
+#include <dev/wscons/wsevent_50.h>
+
 #include <fs/puffs/puffs_sys.h>
 
 int
@@ -83,6 +85,7 @@ compat_50_init(void)
 	cryptodev_50_init();
 	raidframe_50_init();
 	puffs_50_init();
+	wsevent_50_init();
 
 	return error;
 
@@ -103,6 +106,7 @@ compat_50_fini(void)
 {
 	int error = 0;
 
+	wsevent_50_fini();
 	puffs_50_fini();
 	raidframe_50_fini();
 	cryptodev_50_fini();
@@ -144,6 +148,7 @@ compat_50_fini(void)
 	cryptodev_50_init();
 	raidframe_50_init();
 	puffs_50_init();
+	wsevent_50_init();
 
 	return error;
 }

Index: src/sys/dev/wscons/files.wscons
diff -u src/sys/dev/wscons/files.wscons:1.55 src/sys/dev/wscons/files.wscons:1.55.2.1
--- src/sys/dev/wscons/files.wscons:1.55	Mon Dec 18 18:59:32 2017
+++ src/sys/dev/wscons/files.wscons	Sat Mar 24 23:52:19 2018
@@ -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_subr.c	wsdi
 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

Index: src/sys/dev/wscons/wsevent.c
diff -u src/sys/dev/wscons/wsevent.c:1.37 src/sys/dev/wscons/wsevent.c:1.37.2.1
--- src/sys/dev/wscons/wsevent.c:1.37	Wed Oct 25 08:12:39 2017
+++ src/sys/dev/wscons/wsevent.c	Sat Mar 24 23:52:19 2018
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 
 #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 @@ wsevent_fini(struct wseventvar *ev)
 	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:

Index: src/sys/kern/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.6 src/sys/kern/compat_stub.c:1.1.2.7
--- src/sys/kern/compat_stub.c:1.1.2.6	Sat Mar 24 08:24:40 2018
+++ src/sys/kern/compat_stub.c	Sat Mar 24 23:52:19 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.6 2018/03/24 08:24:40 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.1.2.7 2018/03/24 23:52:19 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -87,3 +87,9 @@ int (*puffs50_compat_outgoing)(struct pu
     ssize_t *) = (void *)enosys;
 void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *) =
     (void *)voidop;
+
+/*
+ * wsevents compatability
+ */
+int (*wsevent_50_copyout_events)(const struct wscons_event *, int,
+    struct uio *) = (void *)enosys;

Index: src/sys/modules/compat_50/Makefile
diff -u src/sys/modules/compat_50/Makefile:1.1.2.6 src/sys/modules/compat_50/Makefile:1.1.2.7
--- src/sys/modules/compat_50/Makefile:1.1.2.6	Sat Mar 24 08:24:40 2018
+++ src/sys/modules/compat_50/Makefile	Sat Mar 24 23:52:19 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1.2.6 2018/03/24 08:24:40 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.1.2.7 2018/03/24 23:52:19 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -26,4 +26,8 @@ SRCS+=	rf_compat50.c
 
 SRCS+=	puffs_compat.c
 
+.PATH:  ${S}/dev/wscons
+
+SRCS+=  wsevent_50.c
+
 .include <bsd.kmodule.mk>

Index: src/sys/sys/compat_stub.h
diff -u src/sys/sys/compat_stub.h:1.1.2.6 src/sys/sys/compat_stub.h:1.1.2.7
--- src/sys/sys/compat_stub.h:1.1.2.6	Sat Mar 24 08:24:40 2018
+++ src/sys/sys/compat_stub.h	Sat Mar 24 23:52:19 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.6 2018/03/24 08:24:40 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.h,v 1.1.2.7 2018/03/24 23:52:19 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -90,4 +90,14 @@ extern int (*puffs50_compat_outgoing)(st
     ssize_t *);
 extern void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *);
 
+/*
+ * wsevents compatability
+ */
+
+struct wscons_event;
+struct uio;
+
+extern int (*wsevent_50_copyout_events)(const struct wscons_event *, int,
+    struct uio *);
+
 #endif	/* _SYS_COMPAT_STUB_H */

Added files:

Index: src/sys/dev/wscons/wsevent_50.c
diff -u /dev/null src/sys/dev/wscons/wsevent_50.c:1.1.2.1
--- /dev/null	Sat Mar 24 23:52:19 2018
+++ src/sys/dev/wscons/wsevent_50.c	Sat Mar 24 23:52:19 2018
@@ -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)
+{
+	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;
+}
+
+void
+wsevent_50_init(void)
+{
+
+	wsevent_50_copyout_events = wsevent_copyout_events50;
+}
+
+void
+wsevent_50_fini(void)
+{
+
+	wsevent_50_copyout_events = (void *)enosys;
+}
Index: src/sys/dev/wscons/wsevent_50.h
diff -u /dev/null src/sys/dev/wscons/wsevent_50.h:1.1.2.1
--- /dev/null	Sat Mar 24 23:52:19 2018
+++ src/sys/dev/wscons/wsevent_50.h	Sat Mar 24 23:52:19 2018
@@ -0,0 +1,38 @@
+/* $NetBSD: wsevent_50.h,v 1.1.2.1 2018/03/24 23:52:19 pgoyette Exp $	*/
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Goyette
+ *
+ * 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.
+ */
+
+#ifndef _DEV_WSCONS_WSEVENT_50_H
+#define _DEV_WSCONS_WSEVENT_50_H
+
+void wsevent_50_init(void);
+void wsevent_50_fini(void);
+
+#endif /* _DEV_WSCONS_WSEVENT_50_H */

Reply via email to