Source-Changes-HG archive

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

[src/pgoyette-compat]: src Split the compat_crypto_50 from the rest of the cr...



details:   https://anonhg.NetBSD.org/src/rev/3ac8dd745d94
branches:  pgoyette-compat
changeset: 830750:3ac8dd745d94
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Sep 23 01:33:25 2018 +0000

description:
Split the compat_crypto_50 from the rest of the crypto module

Cleanup some stuff left over from similar changes to raid modules.

diffstat:

 distrib/sets/lists/modules/mi           |   4 +-
 sys/dev/raidframe/rf_compat50.c         |  21 +++++++-
 sys/modules/Makefile                    |   4 +-
 sys/modules/compat_50/Makefile          |   6 +-
 sys/modules/compat_crypto_50/Makefile   |  12 ++++
 sys/modules/compat_netbsd32_16/Makefile |   4 +-
 sys/modules/compat_raid_50/Makefile     |   6 +-
 sys/modules/crypto/Makefile             |   4 +-
 sys/opencrypto/cryptodev.c              |  14 +---
 sys/opencrypto/files.opencrypto         |   4 +-
 sys/opencrypto/ocryptodev.c             |  86 +++++++++++++++++---------------
 sys/sys/compat_stub.h                   |   8 +--
 12 files changed, 97 insertions(+), 76 deletions(-)

diffs (truncated from 457 to 300 lines):

diff -r 6b019aec01f6 -r 3ac8dd745d94 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Sat Sep 22 22:36:37 2018 +0000
+++ b/distrib/sets/lists/modules/mi     Sun Sep 23 01:33:25 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.22 2018/09/22 22:21:46 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.23 2018/09/23 01:33:25 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -118,6 +118,8 @@
 ./@MODULEDIR@/coredump/coredump.kmod           base-kernel-modules     kmod
 ./@MODULEDIR@/crypto                           base-kernel-modules     kmod
 ./@MODULEDIR@/crypto/crypto.kmod               base-kernel-modules     kmod
+./@MODULEDIR@/crypto_50                                base-kernel-modules     kmod
+./@MODULEDIR@/crypto_50/crypto_50.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/cyclic                           base-kernel-modules     kmod,dtrace
 ./@MODULEDIR@/cyclic/cyclic.kmod               base-kernel-modules     kmod,dtrace
 ./@MODULEDIR@/dbcool                           base-kernel-modules     kmod
diff -r 6b019aec01f6 -r 3ac8dd745d94 sys/dev/raidframe/rf_compat50.c
--- a/sys/dev/raidframe/rf_compat50.c   Sat Sep 22 22:36:37 2018 +0000
+++ b/sys/dev/raidframe/rf_compat50.c   Sun Sep 23 01:33:25 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_compat50.c,v 1.3.2.4 2018/09/18 23:03:54 pgoyette Exp $     */
+/*     $NetBSD: rf_compat50.c,v 1.3.2.5 2018/09/23 01:33:25 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -39,6 +39,7 @@
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/module.h>
 
 #include <sys/compat_stub.h>
 
@@ -255,3 +256,21 @@
 
        raidframe50_ioctl_hook_unset();
 }
+
+MODULE(MODULE_CLASS_EXEC, raid_50, "raid,compat_50");
+
+static int
+raid_50_modcmd(modcmd_t cmd, void *arg)
+{
+
+       switch (cmd) {
+       MODULE_CMD_INIT:
+               raidframe_50_init();
+               return 0;
+       MODULE_CMD_FINI:
+               raidframe_50_fini();
+               return 0;
+       default:
+               return ENOTTY;
+       }
+}
diff -r 6b019aec01f6 -r 3ac8dd745d94 sys/modules/Makefile
--- a/sys/modules/Makefile      Sat Sep 22 22:36:37 2018 +0000
+++ b/sys/modules/Makefile      Sun Sep 23 01:33:25 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.202.2.35 2018/09/22 22:21:46 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.202.2.36 2018/09/23 01:33:25 pgoyette Exp $
 
 .include <bsd.own.mk>
 
@@ -16,6 +16,8 @@
 
 SUBDIR+=       compat_raid_80
 
+SUBDIR+=       compat_crypto_50
+
 SUBDIR+=       accf_dataready
 SUBDIR+=       accf_httpready
 SUBDIR+=       adosfs
diff -r 6b019aec01f6 -r 3ac8dd745d94 sys/modules/compat_50/Makefile
--- a/sys/modules/compat_50/Makefile    Sat Sep 22 22:36:37 2018 +0000
+++ b/sys/modules/compat_50/Makefile    Sun Sep 23 01:33:25 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1.2.9 2018/09/19 04:12:43 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.1.2.10 2018/09/23 01:33:25 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -14,10 +14,6 @@
 SRCS+= rndpseudo_50.c clockctl_50.c if_spppsubr50.c
 SRCS+= rtsock_50.c
 
-.PATH: ${S}/opencrypto
-
-SRCS+= ocryptodev.c
-
 .PATH: ${S}/dev/raidframe
 
 SRCS+= rf_compat50.c
diff -r 6b019aec01f6 -r 3ac8dd745d94 sys/modules/compat_crypto_50/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/compat_crypto_50/Makefile     Sun Sep 23 01:33:25 2018 +0000
@@ -0,0 +1,12 @@
+#      $NetBSD: Makefile,v 1.1.2.1 2018/09/23 01:33:26 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+CPPFLAGS+=     -DCOMPAT_50
+
+.PATH: ${S}/opencrypto
+
+KMOD=  crypto
+SRCS=  ocryptodev.c ocryptodev.c
+
+.include <bsd.kmodule.mk>
diff -r 6b019aec01f6 -r 3ac8dd745d94 sys/modules/compat_netbsd32_16/Makefile
--- a/sys/modules/compat_netbsd32_16/Makefile   Sat Sep 22 22:36:37 2018 +0000
+++ b/sys/modules/compat_netbsd32_16/Makefile   Sun Sep 23 01:33:25 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1.2.3 2018/09/14 08:38:37 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.1.2.4 2018/09/23 01:33:26 pgoyette Exp $
 
 .include "../Makefile.inc"
 .include "../Makefile.assym"
@@ -18,7 +18,7 @@
 SRCS+=  netbsd32_sigcode.S
 .endif
 
-.PATH: ${S}/${MACHINE_CPU}/${MACHINE_CPU}
+.PATH: ${S}/arch/${MACHINE}/${MACHINE}
 SRCS+= netbsd32_machdep_16.c
 
 .include <bsd.kmodule.mk>
diff -r 6b019aec01f6 -r 3ac8dd745d94 sys/modules/compat_raid_50/Makefile
--- a/sys/modules/compat_raid_50/Makefile       Sat Sep 22 22:36:37 2018 +0000
+++ b/sys/modules/compat_raid_50/Makefile       Sun Sep 23 01:33:25 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1.2.1 2018/09/22 22:21:46 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.1.2.2 2018/09/23 01:33:26 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -6,10 +6,6 @@
 
 KMOD=  compat_raid_50
 
-CPPFLAGS+=     -DCOMPAT_50
-
-SRCS+= compat_50_mod.c
-
 .PATH: ${S}/dev/raidframe
 
 SRCS+= rf_compat50.c 
diff -r 6b019aec01f6 -r 3ac8dd745d94 sys/modules/crypto/Makefile
--- a/sys/modules/crypto/Makefile       Sat Sep 22 22:36:37 2018 +0000
+++ b/sys/modules/crypto/Makefile       Sun Sep 23 01:33:25 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.4 2015/08/20 11:05:01 christos Exp $
+#      $NetBSD: Makefile,v 1.4.16.1 2018/09/23 01:33:26 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -8,6 +8,6 @@
 
 KMOD=  crypto
 IOCONF=        crypto.ioconf
-SRCS=  cryptodev.c ocryptodev.c
+SRCS=  cryptodev.c
 
 .include <bsd.kmodule.mk>
diff -r 6b019aec01f6 -r 3ac8dd745d94 sys/opencrypto/cryptodev.c
--- a/sys/opencrypto/cryptodev.c        Sat Sep 22 22:36:37 2018 +0000
+++ b/sys/opencrypto/cryptodev.c        Sun Sep 23 01:33:25 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cryptodev.c,v 1.98.2.5 2018/09/22 10:33:50 pgoyette Exp $ */
+/*     $NetBSD: cryptodev.c,v 1.98.2.6 2018/09/23 01:33:26 pgoyette Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $        */
 /*     $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $   */
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.98.2.5 2018/09/22 10:33:50 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.98.2.6 2018/09/23 01:33:26 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -228,15 +228,9 @@
  * code cannot directly reference them as globals.
  */
 MODULE_CALL_HOOK_DECL(ocryptof_50_hook, f,
-    (struct file *fp, u_long cmd, void *data),
-    (fp, cmd, data, cryptodev_mtx, cryptodev_session, cryptodev_op,
-       cryptodev_mop, cryptodev_csefind),
-    enosys());
+    (struct file *fp, u_long cmd, void *data), (fp, cmd, data), enosys());
 MODULE_CALL_HOOK(ocryptof_50_hook, f,
-    (struct file *fp, u_long cmd, void *data),
-    (fp, cmd, data, &cryptodev_mtx, cryptodev_session, cryptodev_op,
-       cryptodev_mop, cryptodev_csefind),
-    enosys());
+    (struct file *fp, u_long cmd, void *data), (fp, cmd, data), enosys());
 
 /* ARGSUSED */
 int
diff -r 6b019aec01f6 -r 3ac8dd745d94 sys/opencrypto/files.opencrypto
--- a/sys/opencrypto/files.opencrypto   Sat Sep 22 22:36:37 2018 +0000
+++ b/sys/opencrypto/files.opencrypto   Sun Sep 23 01:33:25 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.opencrypto,v 1.26.8.1 2018/09/22 10:30:00 pgoyette Exp $
+#      $NetBSD: files.opencrypto,v 1.26.8.2 2018/09/23 01:33:26 pgoyette Exp $
 #
 #
 
@@ -25,7 +25,7 @@
 # (and thus crypto hardware accelerators).
 defpseudo crypto: opencrypto
 file   opencrypto/cryptodev.c          crypto
-file   opencrypto/ocryptodev.c         compat_50
+file   opencrypto/ocryptodev.c         compat_50 & crypto
 
 defflag opt_ocf.h      CRYPTO_DEBUG CRYPTO_TIMING
 defparam opt_ocf.h     CRYPTO_RET_Q_MAXLEN CRYPTO_RET_KQ_MAXLEN
diff -r 6b019aec01f6 -r 3ac8dd745d94 sys/opencrypto/ocryptodev.c
--- a/sys/opencrypto/ocryptodev.c       Sat Sep 22 22:36:37 2018 +0000
+++ b/sys/opencrypto/ocryptodev.c       Sun Sep 23 01:33:25 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ocryptodev.c,v 1.11.2.5 2018/09/22 10:49:09 pgoyette Exp $ */
+/*     $NetBSD: ocryptodev.c,v 1.11.2.6 2018/09/23 01:33:26 pgoyette Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $        */
 /*     $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $   */
 
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.11.2.5 2018/09/22 10:49:09 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.11.2.6 2018/09/23 01:33:26 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -90,6 +90,7 @@
 #include <sys/poll.h>
 #include <sys/atomic.h>
 #include <sys/compat_stub.h> 
+#include <sys/module.h>
 
 #ifdef _KERNEL_OPT
 #include "opt_ocf.h"
@@ -101,23 +102,14 @@
 #include <opencrypto/xform.h>
 
 static int     ocryptodev_op(struct csession *, struct ocrypt_op *,
-                   struct lwp *, int (*)(struct csession *, 
-                                       struct crypt_op *, struct lwp *));
+                   struct lwp *);
 static int     ocryptodev_mop(struct fcrypt *, struct ocrypt_n_op *, int,
-                   struct lwp *,
-                   int (*real_mop)(struct fcrypt *, struct crypt_n_op *,
-                        int, struct lwp *));
-static int     ocryptodev_session(struct fcrypt *, struct osession_op *,
-                       int(*)(struct fcrypt *, struct session_op *));
-static int     ocryptodev_msession(struct fcrypt *, struct osession_n_op *,
-                       int, int (*)(struct fcrypt *, struct session_op *));
+                   struct lwp *);
+static int     ocryptodev_session(struct fcrypt *, struct osession_op *);
+static int     ocryptodev_msession(struct fcrypt *, struct osession_n_op *);
 
 int
-ocryptof_ioctl(struct file *fp, u_long cmd, void *data, kmutex_t *mtx,
-    int (*real_session)(struct fcrypt *, struct session_op *),
-    int (*real_op)(struct csession *, struct crypt_op *, struct lwp *),
-    int (*real_mop)(struct fcrypt *, struct crypt_n_op *, int, struct lwp *),
-    struct csession * (*real_csefind)(struct fcrypt *, u_int32_t))
+ocryptof_ioctl(struct file *fp, u_long cmd, void *data)
 {
        struct fcrypt *fcr = fp->f_fcrypt;
        struct csession *cse;
@@ -133,7 +125,7 @@
        switch (cmd) {
        case OCIOCGSESSION:
                osop = (struct osession_op *)data;
-               error = ocryptodev_session(fcr, osop, real_session);
+               error = ocryptodev_session(fcr, osop);
                break;
        case CIOCNGSESSION:
                osgop = (struct ocrypt_sgop *)data;
@@ -150,8 +142,7 @@
                        goto mbail;
                }
 
-               error = ocryptodev_msession(fcr, osnop, osgop->count,
-                   real_session);
+               error = ocryptodev_msession(fcr, osnop, osgop->count);
                if (error) {
                        goto mbail;
                }
@@ -164,13 +155,13 @@
        case OCIOCCRYPT:
                mutex_enter(mtx);
                ocop = (struct ocrypt_op *)data;
-               cse = (*real_csefind)(fcr, ocop->ses);
+               cse = cryptodev_csefind)(fcr, ocop->ses);



Home | Main Index | Thread Index | Old Index