Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat add uvm swap compat code.
details: https://anonhg.NetBSD.org/src/rev/519e9f68bd7c
branches: trunk
changeset: 321408:519e9f68bd7c
user: christos <christos%NetBSD.org@localhost>
date: Thu Mar 15 03:13:51 2018 +0000
description:
add uvm swap compat code.
diffstat:
sys/compat/common/Makefile.sysio | 6 +-
sys/compat/common/compat_mod.c | 17 +++++++-
sys/compat/common/uvm_13.c | 84 +++++++++++++++++++++++++++++++++++++++
sys/compat/common/uvm_50.c | 85 ++++++++++++++++++++++++++++++++++++++++
sys/compat/sys/uvm.h | 69 ++++++++++++++++++++++++++++++++
5 files changed, 256 insertions(+), 5 deletions(-)
diffs (truncated from 339 to 300 lines):
diff -r 9a3c9109ce94 -r 519e9f68bd7c sys/compat/common/Makefile.sysio
--- a/sys/compat/common/Makefile.sysio Thu Mar 15 02:25:31 2018 +0000
+++ b/sys/compat/common/Makefile.sysio Thu Mar 15 03:13:51 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.sysio,v 1.7 2016/11/05 23:30:22 pgoyette Exp $
+# $NetBSD: Makefile.sysio,v 1.8 2018/03/15 03:13:51 christos Exp $
# Sources for syscall and ioctl compatibility across the versions.
@@ -13,7 +13,7 @@
SRCS+= kern_xxx_12.c vfs_syscalls_12.c vm_12.c
# Compatibility code for NetBSD 1.3
-SRCS+= kern_sig_13.c
+SRCS+= kern_sig_13.c uvm_13.c
# Compatibility code for NetBSD 1.6
SRCS+= kern_sig_16.c
@@ -32,7 +32,7 @@
# Compatibility code for NetBSD 5.0
SRCS+= kern_50.c kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c \
- vfs_syscalls_50.c uipc_syscalls_50.c
+ vfs_syscalls_50.c uipc_syscalls_50.c uvm_50.c
# Compatibility code for NetBSD 6.0
SRCS+= kern_sa_60.c tty_60.c kern_time_60.c
diff -r 9a3c9109ce94 -r 519e9f68bd7c sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c Thu Mar 15 02:25:31 2018 +0000
+++ b/sys/compat/common/compat_mod.c Thu Mar 15 03:13:51 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_mod.c,v 1.24 2016/11/05 23:30:22 pgoyette Exp $ */
+/* $NetBSD: compat_mod.c,v 1.25 2018/03/15 03:13:51 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24 2016/11/05 23:30:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.25 2018/03/15 03:13:51 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -60,6 +60,7 @@
#include <compat/common/compat_util.h>
#include <compat/common/compat_mod.h>
#include <compat/common/if_43.h>
+#include <compat/sys/uvm.h>
#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50)
static struct sysctllog *compat_clog = NULL;
@@ -238,6 +239,9 @@
ttcompatvec = ttcompat;
if_43_init();
#endif
+#ifdef COMPAT_13
+ uvm_13_init();
+#endif
#ifdef COMPAT_16
#if defined(COMPAT_SIGCONTEXT)
KASSERT(emul_netbsd.e_sigobject == NULL);
@@ -251,9 +255,15 @@
#endif
#endif
compat_sysctl_init();
+#ifdef COMPAT_50
+ uvm_50_init();
+#endif
return 0;
case MODULE_CMD_FINI:
+#ifdef COMPAT_13
+ uvm_13_fini();
+#endif
#ifdef COMPAT_16
/*
* Ensure sendsig_sigcontext() is not being used.
@@ -308,6 +318,9 @@
#endif
#endif /* COMPAT_16 */
compat_sysctl_fini();
+#ifdef COMPAT_50
+ uvm_50_fini();
+#endif
return 0;
default:
diff -r 9a3c9109ce94 -r 519e9f68bd7c sys/compat/common/uvm_13.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/uvm_13.c Thu Mar 15 03:13:51 2018 +0000
@@ -0,0 +1,84 @@
+/* $NetBSD: uvm_13.c,v 1.1 2018/03/15 03:13:51 christos Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: uvm_13.c,v 1.1 2018/03/15 03:13:51 christos Exp $");
+
+#if defined(_KERNEL) || defined(_MODULE)
+#if defined(_KERNEL_OPT)
+#include "opt_vmswap.h"
+#else
+#define VMSWAP /* XXX */
+#endif
+#endif
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/syscallargs.h>
+#include <sys/swap.h>
+#include <uvm/uvm.h>
+#include <uvm/uvm_swap.h>
+
+#include <compat/sys/uvm.h>
+
+static void
+swapent13_cvt(void *p, const struct swapent *se)
+{
+ struct swapent13 *sep13 = p;
+
+ sep13->se13_dev = se->se_dev;
+ sep13->se13_flags = se->se_flags;
+ sep13->se13_nblks = se->se_nblks;
+ sep13->se13_inuse = se->se_inuse;
+ sep13->se13_priority = se->se_priority;
+}
+
+
+static int
+compat_uvm_swap_stats13(const struct sys_swapctl_args *uap, register_t *retval)
+{
+ return uvm_swap_stats(SCARG(uap, arg), SCARG(uap, misc),
+ swapent13_cvt, sizeof(struct swapent13), retval);
+
+}
+
+void
+uvm_13_init(void)
+{
+ uvm_swap_stats13 = compat_uvm_swap_stats13;
+}
+
+void
+uvm_13_fini(void)
+{
+ uvm_swap_stats13 = (void *)enosys;
+}
diff -r 9a3c9109ce94 -r 519e9f68bd7c sys/compat/common/uvm_50.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/uvm_50.c Thu Mar 15 03:13:51 2018 +0000
@@ -0,0 +1,85 @@
+/* $NetBSD: uvm_50.c,v 1.1 2018/03/15 03:13:51 christos Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: uvm_50.c,v 1.1 2018/03/15 03:13:51 christos Exp $");
+
+#if defined(_KERNEL) || defined(_MODULE)
+#if defined(_KERNEL_OPT)
+#include "opt_vmswap.h"
+#else
+#define VMSWAP /* XXX */
+#endif
+#endif
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/syscallargs.h>
+#include <sys/swap.h>
+#include <uvm/uvm.h>
+
+#include <compat/sys/uvm.h>
+
+static void
+swapent50_cvt(void *p, const struct swapent *se)
+{
+ struct swapent50 *sep50 = p;
+
+ sep50->se50_dev = se->se_dev;
+ sep50->se50_flags = se->se_flags;
+ sep50->se50_nblks = se->se_nblks;
+ sep50->se50_inuse = se->se_inuse;
+ sep50->se50_priority = se->se_priority;
+ KASSERT(sizeof(se->se_path) <= sizeof(sep50->se50_path));
+ strcpy(sep50->se50_path, se->se_path);
+}
+
+
+static int
+compat_uvm_swap_stats50(const struct sys_swapctl_args *uap, register_t *retval)
+{
+ return uvm_swap_stats(SCARG(uap, arg), SCARG(uap, misc),
+ swapent50_cvt, sizeof(struct swapent50), retval);
+
+}
+
+void
+uvm_50_init(void)
+{
+ uvm_swap_stats50 = compat_uvm_swap_stats50;
+}
+
+void
+uvm_50_fini(void)
+{
+ uvm_swap_stats50 = (void *)enosys;
+}
diff -r 9a3c9109ce94 -r 519e9f68bd7c sys/compat/sys/uvm.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/sys/uvm.h Thu Mar 15 03:13:51 2018 +0000
@@ -0,0 +1,69 @@
+/* $NetBSD: uvm.h,v 1.1 2018/03/15 03:13:51 christos Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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.
+ */
Home |
Main Index |
Thread Index |
Old Index