Source-Changes-HG archive

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

[src/pgoyette-compat]: src Create a compat_40 module



details:   https://anonhg.NetBSD.org/src/rev/abd2eefa3f54
branches:  pgoyette-compat
changeset: 321109:abd2eefa3f54
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Mar 27 07:29:43 2018 +0000

description:
Create a compat_40 module

diffstat:

 distrib/sets/lists/modules/mi       |    4 +-
 sys/compat/common/compat_40_mod.c   |  100 ++++++++++++++++++++++++++++++++++
 sys/compat/common/compat_mod.c      |   20 +-----
 sys/compat/common/compat_mod.h      |   13 ++++-
 sys/compat/common/files.common      |    4 +-
 sys/compat/common/sysmon_power_40.c |  103 ++++++++++++++++++++++++++++++++++++
 sys/compat/common/vfs_syscalls_40.c |   27 ++++++++-
 sys/dev/sysmon/sysmon_power.c       |   16 +---
 sys/kern/compat_stub.c              |    8 ++-
 sys/modules/Makefile                |    4 +-
 sys/modules/compat_40/Makefile      |   18 ++++++
 sys/sys/compat_stub.h               |   12 +++-
 12 files changed, 292 insertions(+), 37 deletions(-)

diffs (truncated from 525 to 300 lines):

diff -r 10b96b5b1d7b -r abd2eefa3f54 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Tue Mar 27 03:57:37 2018 +0000
+++ b/distrib/sets/lists/modules/mi     Tue Mar 27 07:29:43 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.6 2018/03/24 01:59:15 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.7 2018/03/27 07:29:43 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -68,6 +68,8 @@
 ./@MODULEDIR@/coda5/coda5.kmod                 base-kernel-modules     kmod
 ./@MODULEDIR@/compat                           base-kernel-modules     kmod
 ./@MODULEDIR@/compat/compat.kmod               base-kernel-modules     kmod
+./@MODULEDIR@/compat_40                                base-kernel-modules     kmod
+./@MODULEDIR@/compat_40/compat_40.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_50                                base-kernel-modules     kmod
 ./@MODULEDIR@/compat_50/compat_50.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_60                                base-kernel-modules     kmod
diff -r 10b96b5b1d7b -r abd2eefa3f54 sys/compat/common/compat_40_mod.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_40_mod.c Tue Mar 27 07:29:43 2018 +0000
@@ -0,0 +1,100 @@
+/*     $NetBSD: compat_40_mod.c,v 1.1.2.1 2018/03/27 07:29:43 pgoyette Exp $   */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for 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.
+ */
+
+/*
+ * Linkage for the compat module: spaghetti.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_40_mod.c,v 1.1.2.1 2018/03/27 07:29:43 pgoyette Exp $");
+
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/sysctl.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+
+#include <compat/common/if_40.h>
+
+int
+compat_40_init(void)
+{
+       int error = 0;
+
+       error = vfs_syscalls_40_init();
+       if (error != 0)
+               return error;
+       if_40_init();
+       sysmon_power_40_init();
+
+       return error;
+}
+
+int
+compat_40_fini(void)
+{
+       int error = 0;
+
+       sysmon_power_40_fini();
+       if_40_fini();
+       error = vfs_syscalls_40_fini();
+       if (error != 0) {
+               if_40_init();
+               sysmon_power_40_init();
+       }
+
+       return error;
+}
+
+#ifdef _MODULE
+
+#define REQD_40        "compat_80,compat_70,compat_60,compat_50"
+
+MODULE(MODULE_CLASS_EXEC, compat_40, REQD_40);
+
+static int
+compat_40_modcmd(modcmd_t cmd, void *arg)
+{
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               return compat_40_init();
+       case MODULE_CMD_FINI:
+               return compat_40_init();
+       default:
+               return ENOTTY;
+       }
+}
+#endif
diff -r 10b96b5b1d7b -r abd2eefa3f54 sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c    Tue Mar 27 03:57:37 2018 +0000
+++ b/sys/compat/common/compat_mod.c    Tue Mar 27 07:29:43 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.c,v 1.24.14.20 2018/03/25 08:03:26 pgoyette Exp $   */
+/*     $NetBSD: compat_mod.c,v 1.24.14.21 2018/03/27 07:29:43 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.20 2018/03/25 08:03:26 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.21 2018/03/27 07:29:43 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -70,10 +70,6 @@
 static struct sysctllog *compat_clog = NULL;
 #endif
 
-#ifdef COMPAT_40
-#include <compat/common/if_40.h>
-#endif
-
 #ifdef COMPAT_70
 #include <net/route.h>
 #include <compat/net/route.h>
@@ -189,10 +185,6 @@
        { SYS_compat_30_getfh, 0, (sy_call_t *)compat_30_sys_getfh },
        { SYS_compat_30_socket, 0, (sy_call_t *)compat_30_sys_socket },
 #endif
-
-#if defined(COMPAT_40)
-       { SYS_compat_40_mount, 0, (sy_call_t *)compat_40_sys_mount },
-#endif
        { 0, 0, NULL },
 };
 
@@ -209,10 +201,10 @@
 #ifdef COMPAT_50
        { compat_50_init, compat_50_fini },
 #endif
-#if 0  /* NOT YET */
 #ifdef COMPAT_40
        { compat_40_init, compat_40_fini },
 #endif
+#if 0  /* NOT YET */
 #ifdef COMPAT_30
        { compat_30_init, compat_30_fini },
 #endif
@@ -289,9 +281,6 @@
  * XXX */
 #endif
 #endif /* XXX NOTYET */
-#ifdef COMPAT_40
-               if_40_init();
-#endif
 #ifdef COMPAT_13
                uvm_13_init();
 #endif
@@ -375,9 +364,6 @@
                rw_exit(&exec_lock);
 #endif
 #endif /* COMPAT_16 */
-#ifdef COMPAT_40
-               if_40_fini();
-#endif
                /*
                 * Disable included components in reverse order;
                 * if any component fails to fini(), re-init those
diff -r 10b96b5b1d7b -r abd2eefa3f54 sys/compat/common/compat_mod.h
--- a/sys/compat/common/compat_mod.h    Tue Mar 27 03:57:37 2018 +0000
+++ b/sys/compat/common/compat_mod.h    Tue Mar 27 07:29:43 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.h,v 1.1.42.8 2018/03/23 09:38:48 pgoyette Exp $     */
+/*     $NetBSD: compat_mod.h,v 1.1.42.9 2018/03/27 07:29:44 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -77,4 +77,15 @@
 void if_50_fini(void);
 #endif
 
+#ifdef COMPAT_40
+int compat_40_init(void);
+int compat_40_fini(void);
+void if_40_init(void);
+void if_40_fini(void);
+int vfs_syscalls_40_init(void);
+int vfs_syscalls_40_fini(void);
+void sysmon_power_40_init(void);
+void sysmon_power_40_fini(void);
+#endif
+
 #endif /* !_COMPAT_MOD_H_ */
diff -r 10b96b5b1d7b -r abd2eefa3f54 sys/compat/common/files.common
--- a/sys/compat/common/files.common    Tue Mar 27 03:57:37 2018 +0000
+++ b/sys/compat/common/files.common    Tue Mar 27 07:29:43 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.common,v 1.1.2.18 2018/03/24 01:59:15 pgoyette Exp $
+#      $NetBSD: files.common,v 1.1.2.19 2018/03/27 07:29:44 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -52,8 +52,10 @@
 file   compat/common/uipc_syscalls_30.c        compat_30
 
 # Compatibility code for NetBSD 4.0
+file   compat/common/compat_40_mod.c           compat_40
 file   compat/common/vfs_syscalls_40.c         compat_40
 file   compat/common/uipc_syscalls_40.c        compat_40
+file   compat/common/sysmon_power_40.c         compat_40
 
 # Compatibility code for NetBSD 5.0
 file   compat/common/compat_50_mod.c           compat_50
diff -r 10b96b5b1d7b -r abd2eefa3f54 sys/compat/common/sysmon_power_40.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/sysmon_power_40.c       Tue Mar 27 07:29:43 2018 +0000
@@ -0,0 +1,103 @@
+/*     $NetBSD: sysmon_power_40.c,v 1.1.2.1 2018/03/27 07:29:44 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2007 Juan Romero Pardines.
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2003 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * 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 for the NetBSD Project by
+ *     Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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



Home | Main Index | Thread Index | Old Index