Source-Changes-HG archive

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

[src/pgoyette-compat]: src Split the raidframe compatability code out into se...



details:   https://anonhg.NetBSD.org/src/rev/065823659698
branches:  pgoyette-compat
changeset: 830748:065823659698
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sat Sep 22 22:21:46 2018 +0000

description:
Split the raidframe compatability code out into separate modules, since
the driver is already a module.  This avoids having to pass a bunch of
function pointers as arguments to raidframe's compat_ioctl().

diffstat:

 distrib/sets/lists/modules/mi       |   8 ++-
 sys/compat/common/compat_50_mod.c   |   9 +---
 sys/compat/common/compat_80_mod.c   |   7 +--
 sys/compat/common/compat_raid_50.c  |  83 +++++++++++++++++++++++++++++++++++++
 sys/compat/common/compat_raid_80.c  |  83 +++++++++++++++++++++++++++++++++++++
 sys/modules/Makefile                |   4 +-
 sys/modules/compat_raid_50/Makefile |  17 +++++++
 sys/modules/compat_raid_80/Makefile |  17 +++++++
 8 files changed, 213 insertions(+), 15 deletions(-)

diffs (truncated from 346 to 300 lines):

diff -r 92bd2b5e31ed -r 065823659698 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Sat Sep 22 11:43:24 2018 +0000
+++ b/distrib/sets/lists/modules/mi     Sat Sep 22 22:21:46 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.21 2018/09/10 08:44:50 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.22 2018/09/22 22:21:46 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -101,7 +101,11 @@
 ./@MODULEDIR@/compat_80                                base-kernel-modules     kmod
 ./@MODULEDIR@/compat_80/compat_80.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_ossaudio                  base-kernel-modules     kmod
-./@MODULEDIR@/compat_ossaudio/compat_ossaudio.kmod     base-kernel-modules     kmod
+./@MODULEDIR@/compat_ossaudio/compat_ossaudio.kmod base-kernel-modules kmod
+./@MODULEDIR@/compat_raid_50                   base-kernel-modules     kmod
+./@MODULEDIR@/compat_raid_50/compat_raid_50.kmod base-kernel-modules   kmod
+./@MODULEDIR@/compat_raid_80                   base-kernel-modules     kmod
+./@MODULEDIR@/compat_raid_80/compat_raid_80.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_sysv_10                   base-kernel-modules     kmod
 ./@MODULEDIR@/compat_sysv_10/compat_sysv_10.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_sysv_14                   base-kernel-modules     kmod
diff -r 92bd2b5e31ed -r 065823659698 sys/compat/common/compat_50_mod.c
--- a/sys/compat/common/compat_50_mod.c Sat Sep 22 11:43:24 2018 +0000
+++ b/sys/compat/common/compat_50_mod.c Sat Sep 22 22:21:46 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_50_mod.c,v 1.1.2.13 2018/09/22 04:56:28 pgoyette Exp $  */
+/*     $NetBSD: compat_50_mod.c,v 1.1.2.14 2018/09/22 22:21:46 pgoyette Exp $  */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.1.2.13 2018/09/22 04:56:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.1.2.14 2018/09/22 22:21:46 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -55,8 +55,6 @@
 #include <compat/common/compat_mod.h>
 #include <compat/common/if_spppsubr50.h>
 
-#include <dev/raidframe/rf_compat50_mod.h>
-
 #include <dev/wscons/wsevent_50.h>
 
 #include <fs/puffs/puffs_sys.h>
@@ -87,7 +85,6 @@
        clockctl_50_init();
        if_spppsubr_50_init();
        cryptodev_50_init();
-       raidframe_50_init();
        puffs_50_init();
        wsevent_50_init();
        vnd_50_init();
@@ -114,7 +111,6 @@
        vnd_50_fini();
        wsevent_50_fini();
        puffs_50_fini();
-       raidframe_50_fini();
        cryptodev_50_fini();
        if_spppsubr_50_fini();
        clockctl_50_fini();
@@ -152,7 +148,6 @@
        clockctl_50_init();
        if_spppsubr_50_init();
        cryptodev_50_init();
-       raidframe_50_init();
        puffs_50_init();
        wsevent_50_init();
        vnd_50_init();
diff -r 92bd2b5e31ed -r 065823659698 sys/compat/common/compat_80_mod.c
--- a/sys/compat/common/compat_80_mod.c Sat Sep 22 11:43:24 2018 +0000
+++ b/sys/compat/common/compat_80_mod.c Sat Sep 22 22:21:46 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_80_mod.c,v 1.1.2.10 2018/09/22 04:56:28 pgoyette Exp $  */
+/*     $NetBSD: compat_80_mod.c,v 1.1.2.11 2018/09/22 22:21:46 pgoyette Exp $  */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,20 +38,18 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.1.2.10 2018/09/22 04:56:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.1.2.11 2018/09/22 22:21:46 pgoyette Exp $");
 
 #include <sys/systm.h>
 #include <sys/module.h>
 
 #include <compat/common/compat_util.h>
 #include <compat/common/compat_mod.h>
-#include <dev/raidframe/rf_compat80_mod.h>
 
 int compat_80_init(void)
 {
 
        kern_mod_80_init();
-       raidframe_80_init();
 
        return 0;
 }
@@ -59,7 +57,6 @@
 int compat_80_fini(void)
 {
 
-       raidframe_80_fini();
        kern_mod_80_fini();
 
        return 0;
diff -r 92bd2b5e31ed -r 065823659698 sys/compat/common/compat_raid_50.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_raid_50.c        Sat Sep 22 22:21:46 2018 +0000
@@ -0,0 +1,83 @@
+/*     $NetBSD: compat_raid_50.c,v 1.1.2.1 2018/09/22 22:21:46 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.
+ */
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_raid_50.c,v 1.1.2.1 2018/09/22 22:21:46 pgoyette Exp $");
+
+#include <sys/systm.h>
+#include <sys/module.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+
+#include <dev/raidframe/rf_compat50_mod.h>
+
+int compat_raid_50_init(void)
+{
+
+       raidframe_50_init();
+
+       return 0;
+}
+
+int compat_raid_50_fini(void)
+{
+
+       raidframe_50_fini();
+
+       return 0;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_raid_50, "compat_50,raid");
+
+static int
+compat_50_modcmd(modcmd_t cmd, void *arg)
+{
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               return compat_raid_50_init();
+
+       case MODULE_CMD_FINI:
+               return compat_raid_50_fini();
+
+       default:
+               return ENOTTY;
+       }
+}
diff -r 92bd2b5e31ed -r 065823659698 sys/compat/common/compat_raid_80.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_raid_80.c        Sat Sep 22 22:21:46 2018 +0000
@@ -0,0 +1,83 @@
+/*     $NetBSD: compat_raid_80.c,v 1.1.2.1 2018/09/22 22:21:46 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.
+ */
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_raid_80.c,v 1.1.2.1 2018/09/22 22:21:46 pgoyette Exp $");
+
+#include <sys/systm.h>
+#include <sys/module.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+
+#include <dev/raidframe/rf_compat80_mod.h>
+
+int compat_raid_80_init(void)
+{
+
+       raidframe_80_init();
+
+       return 0;
+}
+
+int compat_raid_80_fini(void)
+{
+
+       raidframe_80_fini();
+
+       return 0;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_raid_80, "compat_80,raid");
+
+static int
+compat_80_modcmd(modcmd_t cmd, void *arg)
+{
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               return compat_raid_80_init();
+
+       case MODULE_CMD_FINI:
+               return compat_raid_80_fini();
+
+       default:
+               return ENOTTY;
+       }
+}
diff -r 92bd2b5e31ed -r 065823659698 sys/modules/Makefile
--- a/sys/modules/Makefile      Sat Sep 22 11:43:24 2018 +0000
+++ b/sys/modules/Makefile      Sat Sep 22 22:21:46 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.202.2.34 2018/09/22 11:43:24 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.202.2.35 2018/09/22 22:21:46 pgoyette Exp $
 
 .include <bsd.own.mk>
 
@@ -14,6 +14,8 @@
 
 SUBDIR+=       compat_sysv_10 compat_sysv_14 compat_sysv_50
 
+SUBDIR+=       compat_raid_80



Home | Main Index | Thread Index | Old Index