Source-Changes-HG archive

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

[src/pgoyette-compat]: src Separate the compat_50 and compat_80 dispatching c...



details:   https://anonhg.NetBSD.org/src/rev/b3357260e032
branches:  pgoyette-compat
changeset: 321082:b3357260e032
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sat Mar 24 01:59:15 2018 +0000

description:
Separate the compat_50 and compat_80 dispatching code from the main
body of raidframe, and place into the appropriate compat modules.

Enable building of the compat_80 module.

diffstat:

 distrib/sets/lists/modules/mi      |   4 +-
 sys/compat/common/Makefile.sysio   |  10 ++-
 sys/compat/common/compat_80_mod.c  |   6 +-
 sys/compat/common/files.common     |   3 +-
 sys/dev/raidframe/rf_compat50.c    |  39 +++++++++++++++-
 sys/dev/raidframe/rf_compat50.h    |   7 ++-
 sys/dev/raidframe/rf_compat80.c    |  62 ++++++++++++++++++++++++-
 sys/dev/raidframe/rf_compat80.h    |   7 ++-
 sys/dev/raidframe/rf_netbsdkintf.c |  93 +++++++++++++++++--------------------
 sys/kern/compat_stub.c             |  20 +++++--
 sys/modules/Makefile               |   8 +-
 sys/modules/compat_50/Makefile     |   6 ++-
 sys/modules/compat_80/Makefile     |   8 ++-
 sys/sys/compat_stub.h              |  18 ++++++-
 14 files changed, 209 insertions(+), 82 deletions(-)

diffs (truncated from 546 to 300 lines):

diff -r dbf0a05f3d7d -r b3357260e032 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Fri Mar 23 09:41:10 2018 +0000
+++ b/distrib/sets/lists/modules/mi     Sat Mar 24 01:59:15 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.5 2018/03/19 21:55:17 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.6 2018/03/24 01:59:15 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -74,6 +74,8 @@
 ./@MODULEDIR@/compat_60/compat_60.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_70                                base-kernel-modules     kmod
 ./@MODULEDIR@/compat_70/compat_70.kmod         base-kernel-modules     kmod
+./@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_sysv                      base-kernel-modules     kmod
diff -r dbf0a05f3d7d -r b3357260e032 sys/compat/common/Makefile.sysio
--- a/sys/compat/common/Makefile.sysio  Fri Mar 23 09:41:10 2018 +0000
+++ b/sys/compat/common/Makefile.sysio  Sat Mar 24 01:59:15 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.sysio,v 1.7.18.9 2018/03/23 09:41:10 pgoyette Exp $
+#      $NetBSD: Makefile.sysio,v 1.7.18.10 2018/03/24 01:59:15 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -44,10 +44,12 @@
 # Compatibility code for NetBSD 7.0
 SRCS+= rtsock_70.c uipc_usrreq_70.c
 
-# Compatability code for NetBSD 8.0
-#SRCS+=        raidframe80.c
-
 # More compatibility code for NetBSD 5.0
 .PATH: ${S}/opencrypto
 SRCS+= ocryptodev.c
 
+# Raidframe compatibility code for NetBSD 5.0 and 8.0
+.PATH: ${S}/dev/raidframe
+SRCS+= rf_compat50.c
+SRCS+= rf_compat80.c
+
diff -r dbf0a05f3d7d -r b3357260e032 sys/compat/common/compat_80_mod.c
--- a/sys/compat/common/compat_80_mod.c Fri Mar 23 09:41:10 2018 +0000
+++ b/sys/compat/common/compat_80_mod.c Sat Mar 24 01:59:15 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_80_mod.c,v 1.1.2.3 2018/03/23 09:38:48 pgoyette Exp $   */
+/*     $NetBSD: compat_80_mod.c,v 1.1.2.4 2018/03/24 01:59:15 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.1.2.3 2018/03/23 09:38:48 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.1.2.4 2018/03/24 01:59:15 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -86,7 +86,7 @@
 MODULE(MODULE_CLASS_EXEC, compat_80, REQD_80);
 
 static int
-compat_70_modcmd(modcmd_t cmd, void *arg)
+compat_80_modcmd(modcmd_t cmd, void *arg)
 {
 
        switch (cmd) {
diff -r dbf0a05f3d7d -r b3357260e032 sys/compat/common/files.common
--- a/sys/compat/common/files.common    Fri Mar 23 09:41:10 2018 +0000
+++ b/sys/compat/common/files.common    Sat Mar 24 01:59:15 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.common,v 1.1.2.17 2018/03/23 09:38:48 pgoyette Exp $
+#      $NetBSD: files.common,v 1.1.2.18 2018/03/24 01:59:15 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -83,7 +83,6 @@
 
 # Compatability code for NetBSD 8.0
 file   compat/common/compat_80_mod.c           compat_80
-#file  compat/common/raidframe80.c             compat_80 & raid
 
 #
 # Sources for sysv ipc compatibility across the versions.
diff -r dbf0a05f3d7d -r b3357260e032 sys/dev/raidframe/rf_compat50.c
--- a/sys/dev/raidframe/rf_compat50.c   Fri Mar 23 09:41:10 2018 +0000
+++ b/sys/dev/raidframe/rf_compat50.c   Sat Mar 24 01:59:15 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_compat50.c,v 1.3 2018/01/18 00:32:49 mrg Exp $      */
+/*     $NetBSD: rf_compat50.c,v 1.3.2.1 2018/03/24 01:59:15 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -40,6 +40,8 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <sys/compat_stub.h>
+
 #include <dev/raidframe/raidframeio.h>
 #include <dev/raidframe/raidframevar.h>
 
@@ -214,3 +216,38 @@
        RF_Free(d_cfg, sizeof(RF_DeviceConfig50_t));
        return error;
 }
+
+int
+raidframe_ioctl_50(int cmd, int initted, RF_Raid_t *raidPtr, int unit,
+    void *data, RF_Config_t **k_cfg)
+{
+       int error;
+
+       switch (cmd) {
+       case RAIDFRAME_GET_INFO50:
+               if (initted == 0)
+                       return ENXIO;
+               return rf_get_info50(raidPtr, data);
+
+       case RAIDFRAME_CONFIGURE50:
+               error = rf_config50(raidPtr, unit, data, k_cfg);
+               if (error != 0)
+                       return error;
+               return EAGAIN;  /* flag mainline to call generic config */
+       }
+       return EPASSTHROUGH;
+}
+
+void
+raidframe_50_init(void)
+{
+
+       raidframe50_ioctl = raidframe_ioctl_50;
+}
+
+void
+raidframe_50_fini(void)
+{
+
+       raidframe50_ioctl = (void *)enosys;
+}
diff -r dbf0a05f3d7d -r b3357260e032 sys/dev/raidframe/rf_compat50.h
--- a/sys/dev/raidframe/rf_compat50.h   Fri Mar 23 09:41:10 2018 +0000
+++ b/sys/dev/raidframe/rf_compat50.h   Sat Mar 24 01:59:15 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_compat50.h,v 1.2 2015/09/06 06:01:00 dholland Exp $ */
+/*     $NetBSD: rf_compat50.h,v 1.2.16.1 2018/03/24 01:59:15 pgoyette Exp $    */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -47,4 +47,9 @@
 int rf_config50(RF_Raid_t *, int, void *, RF_Config_t **);
 int rf_get_info50(RF_Raid_t *, void *);
 
+int raidframe_ioctl_50(int, int, RF_Raid_t *, int, void *, RF_Config_t **);
+
+void raidframe_50_fini(void);
+void raidframe_50_init(void);
+
 #endif /* _RF_COMPAT50_H_ */
diff -r dbf0a05f3d7d -r b3357260e032 sys/dev/raidframe/rf_compat80.c
--- a/sys/dev/raidframe/rf_compat80.c   Fri Mar 23 09:41:10 2018 +0000
+++ b/sys/dev/raidframe/rf_compat80.c   Sat Mar 24 01:59:15 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_compat80.c,v 1.2 2018/01/20 01:32:45 mrg Exp $      */
+/*     $NetBSD: rf_compat80.c,v 1.2.2.1 2018/03/24 01:59:15 pgoyette Exp $     */
 
 /*
  * Copyright (c) 2017 Matthew R. Green
@@ -32,6 +32,8 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <sys/compat_stub.h>
+
 #include <dev/raidframe/raidframeio.h>
 #include <dev/raidframe/raidframevar.h>
 
@@ -217,3 +219,61 @@
        *k_cfgp = k_cfg;
        return 0;
 }
+
+int
+raidframe_ioctl_80(int cmd, int initted, RF_Raid_t *raidPtr, int unit,
+    void *data, RF_Config_t **k_cfg)  
+{
+int error;
+ 
+       switch (cmd) {
+       case RAIDFRAME_CHECK_RECON_STATUS_EXT80:
+       case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT80:
+       case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT80:
+       case RAIDFRAME_GET_INFO80:
+       case RAIDFRAME_GET_COMPONENT_LABEL80:
+               if (initted == 0)
+                       return ENXIO;
+               break;
+       case RAIDFRAME_CONFIGURE80:
+               break;
+       case RAIDFRAME_FAIL_DISK80:
+               return EPASSTHROUGH;
+       default:
+               return EINVAL;
+       }
+
+       switch (cmd) {
+       case RAIDFRAME_CHECK_RECON_STATUS_EXT80:
+               return rf_check_recon_status_ext80(raidPtr, data);
+       case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT80:
+               return rf_check_parityrewrite_status_ext80(raidPtr, data);
+       case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT80:
+               return rf_check_copyback_status_ext80(raidPtr, data);
+       case RAIDFRAME_GET_INFO80:
+               return rf_get_info80(raidPtr, data);
+       case RAIDFRAME_GET_COMPONENT_LABEL80:
+               return rf_get_component_label80(raidPtr, data);
+       case RAIDFRAME_CONFIGURE80:
+               error = rf_config80(raidPtr, unit, data, k_cfg);
+               if (error != 0)
+                       return error;
+               return EAGAIN;  /* flag mainline to call generic config */ 
+       }
+       return EPASSTHROUGH;
+}
+ 
+void  
+raidframe_80_init(void)
+{ 
+ 
+       raidframe80_ioctl = raidframe_ioctl_80;
+}
+ 
+void
+raidframe_80_fini(void)
+{
+ 
+       raidframe80_ioctl = (void *)enosys;
+}
+
diff -r dbf0a05f3d7d -r b3357260e032 sys/dev/raidframe/rf_compat80.h
--- a/sys/dev/raidframe/rf_compat80.h   Fri Mar 23 09:41:10 2018 +0000
+++ b/sys/dev/raidframe/rf_compat80.h   Sat Mar 24 01:59:15 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_compat80.h,v 1.2 2018/01/20 01:32:45 mrg Exp $      */
+/*     $NetBSD: rf_compat80.h,v 1.2.2.1 2018/03/24 01:59:15 pgoyette Exp $     */
 
 /*
  * Copyright (c) 2017 Matthew R. Green
@@ -132,4 +132,9 @@
 int rf_get_component_label80(RF_Raid_t *, void *);
 int rf_config80(RF_Raid_t *, int, void *, RF_Config_t **);
 
+int raidframe_ioctl_80(int, int, RF_Raid_t *, int, void *, RF_Config_t **);
+
+void raidframe_80_init(void);
+void raidframe_80_fini(void);
+
 #endif /* _RF_COMPAT80_H_ */
diff -r dbf0a05f3d7d -r b3357260e032 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Fri Mar 23 09:41:10 2018 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Sat Mar 24 01:59:15 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.356 2018/01/23 22:42:29 pgoyette Exp $    */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.356.2.1 2018/03/24 01:59:15 pgoyette Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.356 2018/01/23 22:42:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.356.2.1 2018/03/24 01:59:15 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -128,6 +128,7 @@
 #include <sys/reboot.h>
 #include <sys/kauth.h>
 #include <sys/module.h>
+#include <sys/compat_stub.h>
 
 #include <prop/proplib.h>
 
@@ -149,13 +150,9 @@
 #include "rf_parityscan.h"
 #include "rf_threadstuff.h"
 
-#ifdef COMPAT_50
 #include "rf_compat50.h"
-#endif
-
-#ifdef COMPAT_80
+
 #include "rf_compat80.h"
-#endif



Home | Main Index | Thread Index | Old Index