Source-Changes-HG archive

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

[src/pgoyette-compat]: src create the compat_12 module



details:   https://anonhg.NetBSD.org/src/rev/cab03b5b264d
branches:  pgoyette-compat
changeset: 321138:cab03b5b264d
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sat Mar 31 09:17:35 2018 +0000

description:
create the compat_12 module

diffstat:

 distrib/sets/lists/modules/mi       |    4 +-
 sys/compat/common/compat_12_mod.c   |  119 ++++++++++++++++++++++++++++++++++++
 sys/compat/common/compat_mod.c      |   16 +---
 sys/compat/common/compat_mod.h      |   13 +++-
 sys/compat/common/files.common      |    3 +-
 sys/compat/common/kern_xxx_12.c     |   33 ++++++++-
 sys/compat/common/vfs_syscalls_12.c |   43 +++++++++++-
 sys/compat/common/vm_12.c           |   34 +++++++++-
 sys/modules/Makefile                |    4 +-
 sys/modules/compat_12/Makefile      |   17 +++++
 10 files changed, 252 insertions(+), 34 deletions(-)

diffs (truncated from 499 to 300 lines):

diff -r 4729c40d5b61 -r cab03b5b264d distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Sat Mar 31 08:34:17 2018 +0000
+++ b/distrib/sets/lists/modules/mi     Sat Mar 31 09:17:35 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.13 2018/03/30 23:57:59 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.14 2018/03/31 09:17:35 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -70,6 +70,8 @@
 ./@MODULEDIR@/compat/compat.kmod               base-kernel-modules     kmod
 ./@MODULEDIR@/compat_util                      base-kernel-modules     kmod
 ./@MODULEDIR@/compat_util/compat_util.kmod     base-kernel-modules     kmod
+./@MODULEDIR@/compat_12                                base-kernel-modules     kmod
+./@MODULEDIR@/compat_12/compat_12.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_13                                base-kernel-modules     kmod
 ./@MODULEDIR@/compat_13/compat_13.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_14                                base-kernel-modules     kmod
diff -r 4729c40d5b61 -r cab03b5b264d sys/compat/common/compat_12_mod.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_12_mod.c Sat Mar 31 09:17:35 2018 +0000
@@ -0,0 +1,119 @@
+/*     $NetBSD: compat_12_mod.c,v 1.1.2.1 2018/03/31 09:17:35 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_12_mod.c,v 1.1.2.1 2018/03/31 09:17:35 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>
+
+int
+compat_12_init(void)
+{
+       int error;
+
+       error = kern_xxx_12_init();
+       if (error != 0)
+               return error;
+
+       error = vm_12_init();
+       if (error != 0) {
+               kern_xxx_12_fini();
+               return error;
+       }
+
+       error = vfs_syscalls_12_init();
+       if (error != 0) {
+               vm_12_fini();
+               kern_xxx_12_fini();
+               return error;
+       }
+
+       return 0;
+}
+
+int
+compat_12_fini(void)
+{
+       int error;
+
+       error = vfs_syscalls_12_fini();
+       if (error != 0)
+               return error;
+
+       error = vm_12_fini();
+       if (error != 0) {
+               vfs_syscalls_12_init();
+               return error;
+       }
+
+       error = kern_xxx_12_fini();
+       if (error != 0) {
+               vm_12_init();
+               vfs_syscalls_12_init();
+               return error;
+       }
+
+       return 0;
+}
+
+#ifdef _MODULE
+
+#define REQD_12_1      "compat_60,compat_50,compat_40,compat_30,"
+#define REQD_12_2      "compat_20,compat_16,compat_14,compat_13"
+
+MODULE(MODULE_CLASS_EXEC, compat_12, REQD_12_1 REQD_12_2);
+
+static int
+compat_12_modcmd(modcmd_t cmd, void *arg)
+{
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               return compat_12_init();
+       case MODULE_CMD_FINI:
+               return compat_12_init();
+       default:
+               return ENOTTY;
+       }
+}
+#endif
diff -r 4729c40d5b61 -r cab03b5b264d sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c    Sat Mar 31 08:34:17 2018 +0000
+++ b/sys/compat/common/compat_mod.c    Sat Mar 31 09:17:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.c,v 1.24.14.29 2018/03/30 11:29:53 pgoyette Exp $   */
+/*     $NetBSD: compat_mod.c,v 1.24.14.30 2018/03/31 09:17:35 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.29 2018/03/30 11:29:53 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.30 2018/03/31 09:17:35 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -130,16 +130,6 @@
        { SYS_compat_09_ouname, 0, (sy_call_t *)compat_09_sys_uname },
 #endif
 
-#if defined(COMPAT_12)
-       { SYS_compat_12_fstat12, 0, (sy_call_t *)compat_12_sys_fstat },
-       { SYS_compat_12_getdirentries, 0, (sy_call_t *)compat_12_sys_getdirentries },
-       { SYS_compat_12_lstat12, 0, (sy_call_t *)compat_12_sys_lstat },
-       { SYS_compat_12_msync, 0, (sy_call_t *)compat_12_sys_msync },
-       { SYS_compat_12_oreboot, 0, (sy_call_t *)compat_12_sys_reboot },
-       { SYS_compat_12_oswapon, 0, (sy_call_t *)compat_12_sys_swapon },
-       { SYS_compat_12_stat12, 0, (sy_call_t *)compat_12_sys_stat },
-#endif
-
        { 0, 0, NULL },
 };
 
@@ -174,10 +164,10 @@
 #ifdef COMPAT_13
        { compat_13_init, compat_13_fini },
 #endif
-#if 0  /* NOT YET */
 #ifdef COMPAT_12
        { compat_12_init, compat_12_fini },
 #endif
+#if 0  /* NOT YET */
 #ifdef COMPAT_10
        { compat_10_init, compat_10_fini },
 #endif
diff -r 4729c40d5b61 -r cab03b5b264d sys/compat/common/compat_mod.h
--- a/sys/compat/common/compat_mod.h    Sat Mar 31 08:34:17 2018 +0000
+++ b/sys/compat/common/compat_mod.h    Sat Mar 31 09:17:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.h,v 1.1.42.16 2018/03/30 11:18:34 pgoyette Exp $    */
+/*     $NetBSD: compat_mod.h,v 1.1.42.17 2018/03/31 09:17:35 pgoyette Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -139,4 +139,15 @@
 void uvm_13_fini(void);
 #endif
 
+#ifdef COMPAT_12
+int compat_12_init(void);
+int compat_12_fini(void);
+int kern_xxx_12_init(void);
+int kern_xxx_12_fini(void);
+int vm_12_init(void);
+int vm_12_fini(void);
+int vfs_syscalls_12_init(void);
+int vfs_syscalls_12_fini(void);
+#endif
+
 #endif /* !_COMPAT_MOD_H_ */
diff -r 4729c40d5b61 -r cab03b5b264d sys/compat/common/files.common
--- a/sys/compat/common/files.common    Sat Mar 31 08:34:17 2018 +0000
+++ b/sys/compat/common/files.common    Sat Mar 31 09:17:35 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.common,v 1.1.2.28 2018/03/30 11:18:34 pgoyette Exp $
+#      $NetBSD: files.common,v 1.1.2.29 2018/03/31 09:17:35 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -29,6 +29,7 @@
 file   compat/common/vfs_syscalls_10.c         compat_10
 
 # Compatibility code for NetBSD 1.2
+file   compat/common/compat_12_mod.c           compat_12
 file   compat/common/kern_xxx_12.c             compat_12
 file   compat/common/vfs_syscalls_12.c         compat_12
 file   compat/common/vm_12.c                   compat_12
diff -r 4729c40d5b61 -r cab03b5b264d sys/compat/common/kern_xxx_12.c
--- a/sys/compat/common/kern_xxx_12.c   Sat Mar 31 08:34:17 2018 +0000
+++ b/sys/compat/common/kern_xxx_12.c   Sat Mar 31 09:17:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_xxx_12.c,v 1.15 2011/01/19 10:21:16 tsutsui Exp $ */
+/*     $NetBSD: kern_xxx_12.c,v 1.15.56.1 2018/03/31 09:17:35 pgoyette Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -33,20 +33,28 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_xxx_12.c,v 1.15 2011/01/19 10:21:16 tsutsui Exp $");
-
-/*#ifdef COMPAT_12*/
+__KERNEL_RCSID(0, "$NetBSD: kern_xxx_12.c,v 1.15.56.1 2018/03/31 09:17:35 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
 #include <sys/reboot.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
 #include <sys/syscallargs.h>
 #include <sys/kauth.h>
 
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package kern_xxx_12_syscalls[] = {
+       { SYS_compat_12_oreboot, 0, (sy_call_t *)compat_12_sys_reboot },
+       { 0, 0, NULL }
+};
+
 /* ARGSUSED */
 int
-compat_12_sys_reboot(struct lwp *l, const struct compat_12_sys_reboot_args *uap, register_t *retval)
+compat_12_sys_reboot(struct lwp *l,
+    const struct compat_12_sys_reboot_args *uap, register_t *retval)
 {
        /* {
                syscallarg(int) opt;
@@ -61,4 +69,17 @@
        KERNEL_UNLOCK_ONE(NULL);
        return (0);
 }
-/*#endif COMPAT_12 */
+
+int
+kern_xxx_12_init(void)
+{
+
+       return syscall_establish(NULL, kern_xxx_12_syscalls);
+}
+
+int
+kern_xxx_12_fini(void)
+{
+
+       return syscall_disestablish(NULL, kern_xxx_12_syscalls);
+}
diff -r 4729c40d5b61 -r cab03b5b264d sys/compat/common/vfs_syscalls_12.c
--- a/sys/compat/common/vfs_syscalls_12.c       Sat Mar 31 08:34:17 2018 +0000
+++ b/sys/compat/common/vfs_syscalls_12.c       Sat Mar 31 09:17:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls_12.c,v 1.35 2017/12/03 15:23:30 christos Exp $    */
+/*     $NetBSD: vfs_syscalls_12.c,v 1.35.2.1 2018/03/31 09:17:35 pgoyette Exp $        */
 
 /*
  * Copyright (c) 1989, 1993



Home | Main Index | Thread Index | Old Index