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 swapstats compat code into the compat...
details: https://anonhg.NetBSD.org/src/rev/31c3d3e29321
branches: pgoyette-compat
changeset: 360131:31c3d3e29321
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Tue Mar 13 09:10:31 2018 +0000
description:
Move the swapstats compat code into the compat_netbsd module.
Without this, a kernel configured without COMPAT_13 and/or COMPAT_50
could not execute the compat swapstats code, even if the compat_netbsd
module had been loaded.
diffstat:
sys/compat/common/Makefile.sysio | 8 +-
sys/compat/common/compat_mod.c | 20 +++++-
sys/compat/common/files.common | 4 +-
sys/compat/common/uvm_stats_13.c | 80 +++++++++++++++++++++++++
sys/compat/common/uvm_stats_13.h | 51 ++++++++++++++++
sys/compat/common/uvm_stats_50.c | 83 ++++++++++++++++++++++++++
sys/compat/common/uvm_stats_50.h | 52 ++++++++++++++++
sys/uvm/uvm_swap.c | 124 ++++++++++++++++----------------------
sys/uvm/uvm_swap.h | 33 ++++++++++-
9 files changed, 376 insertions(+), 79 deletions(-)
diffs (truncated from 638 to 300 lines):
diff -r e36e0a0a7051 -r 31c3d3e29321 sys/compat/common/Makefile.sysio
--- a/sys/compat/common/Makefile.sysio Tue Mar 13 09:07:20 2018 +0000
+++ b/sys/compat/common/Makefile.sysio Tue Mar 13 09:10:31 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.7.18.1 2018/03/13 09:10:31 pgoyette 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_stats_13.c
# Compatibility code for NetBSD 1.6
SRCS+= kern_sig_16.c
@@ -31,8 +31,8 @@
SRCS+= vfs_syscalls_40.c uipc_syscalls_40.c
# 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
+SRCS+= kern_50.c kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c
+SRCS+= vfs_syscalls_50.c uipc_syscalls_50.c uvm_stats_50.c
# Compatibility code for NetBSD 6.0
SRCS+= kern_sa_60.c tty_60.c kern_time_60.c
diff -r e36e0a0a7051 -r 31c3d3e29321 sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c Tue Mar 13 09:07:20 2018 +0000
+++ b/sys/compat/common/compat_mod.c Tue Mar 13 09:10:31 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_mod.c,v 1.24.14.4 2018/03/08 01:07:13 pgoyette Exp $ */
+/* $NetBSD: compat_mod.c,v 1.24.14.5 2018/03/13 09:10:31 pgoyette 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.14.4 2018/03/08 01:07:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.5 2018/03/13 09:10:31 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -62,6 +62,8 @@
#include <compat/common/compat_util.h>
#include <compat/common/compat_mod.h>
#include <compat/common/if_43.h>
+#include <compat/common/uvm_stats_13.h>
+#include <compat/common/uvm_stats_50.h>
#include <compat/sys/sockio.h>
@@ -251,11 +253,15 @@
ttcompatvec = ttcompat;
if_43_init();
#endif
+#ifdef COMPAT_13
+ swapstats_13_init();
+#endif
#ifdef COMPAT_40
if_40_init();
#endif
#ifdef COMPAT_50
if_50_init();
+ swapstats_50_init();
#endif
#ifdef COMPAT_16
#if defined(COMPAT_SIGCONTEXT)
@@ -326,6 +332,16 @@
rw_exit(&exec_lock);
#endif
#endif /* COMPAT_16 */
+#ifdef COMPAT_13
+ swapstats_13_fini();
+#endif
+#ifdef COMPAT_40
+ if_40_fini();
+#endif
+#ifdef COMPAT_50
+ if_50_fini();
+ swapstats_50_fini();
+#endif
compat_sysctl_fini();
return 0;
diff -r e36e0a0a7051 -r 31c3d3e29321 sys/compat/common/files.common
--- a/sys/compat/common/files.common Tue Mar 13 09:07:20 2018 +0000
+++ b/sys/compat/common/files.common Tue Mar 13 09:10:31 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.common,v 1.1.2.6 2018/03/12 01:59:31 pgoyette Exp $
+# $NetBSD: files.common,v 1.1.2.7 2018/03/13 09:10:31 pgoyette Exp $
#
# Generic files, used by all compat options.
@@ -32,6 +32,7 @@
# Compatibility code for NetBSD 1.3
file compat/common/kern_sig_13.c compat_netbsd
+file compat/common/uvm_stats_13.c compat_netbsd
# Compatibility code for NetBSD 1.4
file compat/common/rtsock_14.c compat_netbsd
@@ -59,6 +60,7 @@
file compat/common/rtsock_50.c compat_netbsd
file compat/common/vfs_syscalls_50.c compat_netbsd
file compat/common/uipc_syscalls_50.c compat_netbsd
+file compat/common/uvm_stats_50.c compat_netbsd
# Compatibility code for NetBSD 6.0
file compat/common/kern_sa_60.c compat_netbsd
diff -r e36e0a0a7051 -r 31c3d3e29321 sys/compat/common/uvm_stats_13.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/uvm_stats_13.c Tue Mar 13 09:10:31 2018 +0000
@@ -0,0 +1,80 @@
+/* $NetBSD: uvm_stats_13.c,v 1.1.2.1 2018/03/13 09:10:31 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
+ * 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.
+ *
+ * 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.
+ *
+ * from: NetBSD: uvm_swap.c,v 1.175 2017/10/28 00:37:13 pgoyette Exp
+ * from: NetBSD: vm_swap.c,v 1.52 1997/12/02 13:47:37 pk Exp
+ * from: Id: uvm_swap.c,v 1.1.2.42 1998/02/02 20:38:06 chuck Exp
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: uvm_stats_13.c,v 1.1.2.1 2018/03/13 09:10:31 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/swap.h>
+
+#include <uvm/uvm.h>
+
+#include <compat/common/uvm_stats_13.h>
+
+static void (*orig_swapstats_copy_13)(int, int, struct swapdev *,
+ struct swapent13 *);
+
+static void swapstats_copy_13(int, int, struct swapdev *, struct swapent13 *);
+
+void
+swapstats_13_init(void)
+{
+
+ swapstats_len_13 = sizeof(struct swapent13);
+
+ orig_swapstats_copy_13 = vec_swapstats_copy_13;
+ vec_swapstats_copy_13 = swapstats_copy_13;
+}
+
+void
+swapstats_13_fini(void)
+{
+
+ swapstats_len_13 = 0;
+ vec_swapstats_copy_13 = orig_swapstats_copy_13;
+}
+
+static void
+swapstats_copy_13(int cmd, int inuse, struct swapdev *sdp,
+ struct swapent13 *sep13)
+{
+
+ if (cmd == SWAP_STATS13) {
+ sep13->se13_dev = sdp->swd_dev;
+ sep13->se13_flags = sdp->swd_flags;
+ sep13->se13_nblks = sdp->swd_nblks;
+ sep13->se13_inuse = inuse;
+ sep13->se13_priority = sdp->swd_priority;
+ }
+}
diff -r e36e0a0a7051 -r 31c3d3e29321 sys/compat/common/uvm_stats_13.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/uvm_stats_13.h Tue Mar 13 09:10:31 2018 +0000
@@ -0,0 +1,51 @@
+/* $NetBSD: uvm_stats_13.h,v 1.1.2.1 2018/03/13 09:10:31 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 1997 Matthew R. Green
+ * 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.
+ *
+ * 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.
+ *
+ * from: Id: uvm_swap.h,v 1.1.2.6 1997/12/15 05:39:31 mrg Exp
+ */
+
+#ifndef _COMPAT_COMMON_UVM_STATS_13_H
+#define _COMPAT_COMMON_UVM_STATS_13_H
+
+struct swapent13 {
+ int32_t se13_dev; /* device id */
+ int se13_flags; /* flags */
+ int se13_nblks; /* total blocks */
+ int se13_inuse; /* blocks in use */
+ int se13_priority; /* priority of this device */
+};
+
+struct swapdev;
+
+void swapstats_13_init(void);
+void swapstats_13_fini(void);
+
+extern size_t swapstats_len_13;
+extern void (*vec_swapstats_copy_13)(int, int, struct swapdev *,
+ struct swapent13 *);
+
+#endif /* _COMPAT_COMMON_UVM_STATS_13_H */
diff -r e36e0a0a7051 -r 31c3d3e29321 sys/compat/common/uvm_stats_50.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/uvm_stats_50.c Tue Mar 13 09:10:31 2018 +0000
@@ -0,0 +1,83 @@
+/* $NetBSD: uvm_stats_50.c,v 1.1.2.1 2018/03/13 09:10:31 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
+ * 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.
+ *
+ * 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.
+ *
+ * from: NetBSD: uvm_swap.c,v 1.175 2017/10/28 00:37:13 pgoyette Exp
+ * from: NetBSD: vm_swap.c,v 1.52 1997/12/02 13:47:37 pk Exp
+ * from: Id: uvm_swap.c,v 1.1.2.42 1998/02/02 20:38:06 chuck Exp
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: uvm_stats_50.c,v 1.1.2.1 2018/03/13 09:10:31 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/kernel.h>
+#include <sys/swap.h>
+
+#include <uvm/uvm.h>
+
Home |
Main Index |
Thread Index |
Old Index