Source-Changes-HG archive

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

[src/pgoyette-compat]: src Finish separating the compat_09 and compat_43 stuff



details:   https://anonhg.NetBSD.org/src/rev/2fcba7718b63
branches:  pgoyette-compat
changeset: 321156:2fcba7718b63
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Apr 17 07:24:54 2018 +0000

description:
Finish separating the compat_09 and compat_43 stuff

diffstat:

 distrib/sets/lists/modules/mi           |    4 +-
 sys/compat/common/Makefile.sysio        |    3 +-
 sys/compat/common/compat_mod.c          |   35 +-----
 sys/compat/common/compat_mod.h          |   14 +-
 sys/compat/common/compat_sysctl_09_43.c |  166 ++++++++++++++++++++++++++++++++
 sys/compat/common/files.common          |    3 +-
 sys/compat/common/kern_sig_16.c         |    8 +-
 sys/compat/common/kern_sig_43.c         |    9 +-
 sys/compat/common/vfs_syscalls_43.c     |   65 +------------
 sys/kern/compat_stub.c                  |    7 +-
 sys/sys/compat_stub.h                   |    7 +-
 11 files changed, 208 insertions(+), 113 deletions(-)

diffs (truncated from 535 to 300 lines):

diff -r 129c9ff8c05d -r 2fcba7718b63 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Tue Apr 17 06:20:26 2018 +0000
+++ b/distrib/sets/lists/modules/mi     Tue Apr 17 07:24:54 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.15 2018/04/17 00:02:58 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.16 2018/04/17 07:24:55 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_sysctl_09_43              base-kernel-modules     kmod
+./@MODULEDIR@/compat_sysctl_09_43/compat_sysctl_09._43kmod     base-kernel-modules     kmod
 ./@MODULEDIR@/compat_09                                base-kernel-modules     kmod
 ./@MODULEDIR@/compat_09/compat_09.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_10                                base-kernel-modules     kmod
diff -r 129c9ff8c05d -r 2fcba7718b63 sys/compat/common/Makefile.sysio
--- a/sys/compat/common/Makefile.sysio  Tue Apr 17 06:20:26 2018 +0000
+++ b/sys/compat/common/Makefile.sysio  Tue Apr 17 07:24:54 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.sysio,v 1.7.18.20 2018/04/03 08:29:44 pgoyette Exp $
+#      $NetBSD: Makefile.sysio,v 1.7.18.21 2018/04/17 07:24:54 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -8,6 +8,7 @@
 
 # Compatibility code for NetBSD 0.9
 SRCS+= kern_info_09.c
+SRCS+= compat_sysctl_09_43.c           # for compat_43 or compat_09
 
 # Compatability code for NetBSD 1.0
 SRCS+= vfs_syscalls_10.c
diff -r 129c9ff8c05d -r 2fcba7718b63 sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c    Tue Apr 17 06:20:26 2018 +0000
+++ b/sys/compat/common/compat_mod.c    Tue Apr 17 07:24:54 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.c,v 1.24.14.33 2018/04/17 00:02:58 pgoyette Exp $   */
+/*     $NetBSD: compat_mod.c,v 1.24.14.34 2018/04/17 07:24:55 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.33 2018/04/17 00:02:58 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.34 2018/04/17 07:24:55 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -49,15 +49,10 @@
 #include <sys/syscall.h>
 #include <sys/syscallargs.h>
 #include <sys/syscallvar.h>
-#include <sys/sysctl.h>
 
 #include <compat/common/compat_util.h>
 #include <compat/common/compat_mod.h>
 
-#if defined(COMPAT_09) || defined(COMPAT_43)
-static struct sysctllog *compat_clog = NULL;
-#endif
-
 static const char * const compat_includes[] = {
        "compat_80", "compat_70", "compat_60", "compat_50", "compat_40",
        "compat_30", "compat_20", "compat_16", "compat_14", "compat_13",
@@ -108,6 +103,9 @@
 #ifdef COMPAT_10
        { compat_10_init, compat_10_fini },
 #endif
+#if defined(COMPAT_09) || defined(COMPAT_43)
+       { compat_sysctl_09_43_init, compat_sysctl_09_43_fini },
+#endif
 #ifdef COMPAT_09
        { compat_09_init, compat_09_fini },
 #endif
@@ -140,7 +138,6 @@
                        }
                }
 
-               compat_sysctl_init();
                return 0;
 
        case MODULE_CMD_FINI:
@@ -149,7 +146,6 @@
                 * if any component fails to fini(), re-init those
                 * components which had already been disabled
                 */
-               compat_sysctl_fini();
                for (i = __arraycount(init_fini_list) - 1; i >= 0; i--) {
                        error = (*init_fini_list[i].fini)();
                        if (error != 0) {
@@ -166,24 +162,3 @@
                return ENOTTY;
        }
 }
-
-void
-compat_sysctl_init(void)
-{
-
-#if defined(COMPAT_09) || defined(COMPAT_43)
-       compat_sysctl_vfs(&compat_clog);
-#endif
-}
-
-void
-compat_sysctl_fini(void)
-{
- 
-#if defined(COMPAT_09) || defined(COMPAT_43)
-        sysctl_teardown(&compat_clog);
-#endif
-#if defined(COMPAT_43)
-       if_43_fini();
-#endif
-}
diff -r 129c9ff8c05d -r 2fcba7718b63 sys/compat/common/compat_mod.h
--- a/sys/compat/common/compat_mod.h    Tue Apr 17 06:20:26 2018 +0000
+++ b/sys/compat/common/compat_mod.h    Tue Apr 17 07:24:54 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.h,v 1.1.42.20 2018/04/17 00:02:58 pgoyette Exp $    */
+/*     $NetBSD: compat_mod.h,v 1.1.42.21 2018/04/17 07:24:55 pgoyette Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,13 +32,6 @@
 #ifndef        _COMPAT_MOD_H
 #define        _COMPAT_MOD_H
 
-#include <sys/sysctl.h>
-
-void compat_sysctl_init(void);
-void compat_sysctl_fini(void);
-
-void compat_sysctl_vfs(struct sysctllog **);
-
 #ifdef COMPAT_80
 int compat_80_init(void);
 int compat_80_fini(void);
@@ -189,4 +182,9 @@
 int if_43_fini(void);
 #endif
 
+#if defined(COMPAT_09) || defined(COMPAT_43)
+int compat_sysctl_09_43_init(void);
+int compat_sysctl_09_43_fini(void);
+#endif
+
 #endif /* !_COMPAT_MOD_H_ */
diff -r 129c9ff8c05d -r 2fcba7718b63 sys/compat/common/compat_sysctl_09_43.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_sysctl_09_43.c   Tue Apr 17 07:24:54 2018 +0000
@@ -0,0 +1,166 @@
+/*     $NetBSD: compat_sysctl_09_43.c,v 1.1.2.1 2018/04/17 07:24:55 pgoyette Exp $     */
+
+/*
+ * Copyright (c) 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, 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. 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.
+ *
+ *     @(#)vfs_syscalls.c      8.28 (Berkeley) 12/10/94
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.1.2.1 2018/04/17 07:24:55 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/filedesc.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/malloc.h>
+#include <sys/sysctl.h>
+#include <sys/module.h>
+
+#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
+#include <sys/vfs_syscalls.h>
+
+#include <compat/sys/mount.h>
+#include <compat/common/compat_mod.h>
+
+/*
+ * sysctl helper routine for vfs.generic.conf lookups.
+ */
+#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44)
+
+static int
+sysctl_vfs_generic_conf(SYSCTLFN_ARGS)
+{
+        struct vfsconf vfc;
+       struct sysctlnode node;
+       struct vfsops *vfsp;
+       u_int vfsnum;
+
+       if (namelen != 1)
+               return (ENOTDIR);
+       vfsnum = name[0];
+       if (vfsnum >= nmountcompatnames ||
+           mountcompatnames[vfsnum] == NULL)
+               return (EOPNOTSUPP);
+       vfsp = vfs_getopsbyname(mountcompatnames[vfsnum]);
+       if (vfsp == NULL)
+               return (EOPNOTSUPP);
+
+       vfc.vfc_vfsops = vfsp;
+       strncpy(vfc.vfc_name, vfsp->vfs_name, sizeof(vfc.vfc_name));
+       vfc.vfc_typenum = vfsnum;
+       vfc.vfc_refcount = vfsp->vfs_refcount;
+       vfc.vfc_flags = 0;
+       vfc.vfc_mountroot = vfsp->vfs_mountroot;
+       vfc.vfc_next = NULL;
+       vfs_delref(vfsp);
+
+       node = *rnode;
+       node.sysctl_data = &vfc;
+       return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+}
+
+/*
+ * Top level filesystem related information gathering.
+ */
+static int
+compat_sysctl_vfs(struct sysctllog **clog)
+{
+       int error;
+
+       error = sysctl_createv(clog, 0, NULL, NULL,
+                      CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+                      CTLTYPE_INT, "maxtypenum",
+                      SYSCTL_DESCR("Highest valid filesystem type number"),
+                      NULL, nmountcompatnames, NULL, 0,
+                      CTL_VFS, VFS_GENERIC, VFS_MAXTYPENUM, CTL_EOL);
+       if (error == EEXIST)
+               error = 0;
+       if (error != 0)
+               return error;
+
+       error = sysctl_createv(clog, 0, NULL, NULL,
+                      CTLFLAG_PERMANENT,
+                      CTLTYPE_STRUCT, "conf",
+                      SYSCTL_DESCR("Filesystem configuration information"),
+                      sysctl_vfs_generic_conf, 0, NULL,
+                      sizeof(struct vfsconf),
+                      CTL_VFS, VFS_GENERIC, VFS_CONF, CTL_EOL);
+
+       return error;
+}
+#endif
+
+static struct sysctllog *clog = NULL;
+
+int
+compat_sysctl_09_43_init(void)
+{
+
+       return compat_sysctl_vfs(&clog);
+}
+
+int
+compat_sysctl_09_43_fini(void)
+{



Home | Main Index | Thread Index | Old Index