Source-Changes-HG archive

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

[src/trunk]: src/sys Split the module glue out from the rest of opencrypto/oc...



details:   https://anonhg.NetBSD.org/src/rev/f5ea6d32c4d3
branches:  trunk
changeset: 744213:f5ea6d32c4d3
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Mon Jan 27 17:09:17 2020 +0000

description:
Split the module glue out from the rest of opencrypto/ocryptodev to
make rump happy.

Rump doesn't have compat modules (the compat code is included in the
relevant librump*.so), so there's no module compat_50 listed in
link_set_modules, and thus ocryptodev's MODULE(...) can't "require"
it.

This fixes the problem of "built-in module compat_50 not found" when
starting up rump_allserver (or rump_server with -l rumpdev_opencrypto).

XXX This does not resolve the long-standing "crypto: unable to
XXX register devsw, error 17" message noted at line 78 of
XXX sys/rump/dev/lib/libopencrypto/opencrypto_component.c

diffstat:

 sys/compat/common/Makefile.sysio      |   4 +-
 sys/modules/compat_crypto_50/Makefile |   4 +-
 sys/opencrypto/compat_crypto_50.c     |  94 +++++++++++++++++++++++++++++++++++
 sys/opencrypto/files.opencrypto       |   3 +-
 sys/opencrypto/ocryptodev.c           |  37 +-------------
 5 files changed, 102 insertions(+), 40 deletions(-)

diffs (205 lines):

diff -r 49192ad60ec1 -r f5ea6d32c4d3 sys/compat/common/Makefile.sysio
--- a/sys/compat/common/Makefile.sysio  Mon Jan 27 16:25:08 2020 +0000
+++ b/sys/compat/common/Makefile.sysio  Mon Jan 27 17:09:17 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.sysio,v 1.12 2019/05/17 07:37:11 msaitoh Exp $
+#      $NetBSD: Makefile.sysio,v 1.13 2020/01/27 17:09:17 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -51,7 +51,7 @@
 
 # More compatibility code for NetBSD 5.0
 .PATH: ${S}/opencrypto
-SRCS+= ocryptodev.c
+SRCS+= ocryptodev.c  compat_crypto_50.c
 
 # Raidframe compatibility code for NetBSD 5.0 and 8.0
 .PATH: ${S}/dev/raidframe
diff -r 49192ad60ec1 -r f5ea6d32c4d3 sys/modules/compat_crypto_50/Makefile
--- a/sys/modules/compat_crypto_50/Makefile     Mon Jan 27 16:25:08 2020 +0000
+++ b/sys/modules/compat_crypto_50/Makefile     Mon Jan 27 17:09:17 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.2 2019/01/27 02:08:45 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.3 2020/01/27 17:09:17 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -7,6 +7,6 @@
 .PATH: ${S}/opencrypto
 
 KMOD=  compat_crypto_50
-SRCS=  ocryptodev.c
+SRCS=  ocryptodev.c    compat_crypto_50.c
 
 .include <bsd.kmodule.mk>
diff -r 49192ad60ec1 -r f5ea6d32c4d3 sys/opencrypto/compat_crypto_50.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/opencrypto/compat_crypto_50.c Mon Jan 27 17:09:17 2020 +0000
@@ -0,0 +1,94 @@
+/*     $NetBSD: compat_crypto_50.c,v 1.1 2020/01/27 17:09:17 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Coyote Point Systems, 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_crypto_50.c,v 1.1 2020/01/27 17:09:17 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+/* XXX PRG
+#include <sys/kmem.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/pool.h>
+#include <sys/sysctl.h>
+#include <sys/file.h>
+#include <sys/filedesc.h>
+#include <sys/errno.h>
+#include <sys/md5.h>
+#include <sys/sha1.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/kauth.h>
+#include <sys/select.h>
+#include <sys/poll.h>
+#include <sys/atomic.h>
+XXX PRG */
+#include <sys/compat_stub.h> 
+#include <sys/module.h>
+
+#include <opencrypto/cryptodev.h>
+#include <opencrypto/ocryptodev.h>
+
+/* Module glue for compat ioctl's */
+
+static void
+crypto_50_init(void)
+{
+
+       MODULE_HOOK_SET(ocryptof_50_hook, ocryptof_ioctl);
+}
+
+static void
+crypto_50_fini(void)
+{
+
+       MODULE_HOOK_UNSET(ocryptof_50_hook);
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_crypto_50, "crypto,compat_50");
+ 
+static int
+compat_crypto_50_modcmd(modcmd_t cmd, void *arg)
+{
+ 
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               crypto_50_init();
+               return 0;
+       case MODULE_CMD_FINI:
+               crypto_50_fini();
+               return 0;
+       default: 
+               return ENOTTY;
+       }
+}
+
diff -r 49192ad60ec1 -r f5ea6d32c4d3 sys/opencrypto/files.opencrypto
--- a/sys/opencrypto/files.opencrypto   Mon Jan 27 16:25:08 2020 +0000
+++ b/sys/opencrypto/files.opencrypto   Mon Jan 27 17:09:17 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.opencrypto,v 1.27 2019/01/27 02:08:48 pgoyette Exp $
+#      $NetBSD: files.opencrypto,v 1.28 2020/01/27 17:09:17 pgoyette Exp $
 #
 #
 
@@ -26,6 +26,7 @@
 defpseudo crypto: opencrypto
 file   opencrypto/cryptodev.c          crypto
 file   opencrypto/ocryptodev.c         compat_50 & crypto
+file   opencrypto/compat_crypto_50.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 49192ad60ec1 -r f5ea6d32c4d3 sys/opencrypto/ocryptodev.c
--- a/sys/opencrypto/ocryptodev.c       Mon Jan 27 16:25:08 2020 +0000
+++ b/sys/opencrypto/ocryptodev.c       Mon Jan 27 17:09:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ocryptodev.c,v 1.15 2020/01/16 15:29:24 christos Exp $ */
+/*     $NetBSD: ocryptodev.c,v 1.16 2020/01/27 17:09:17 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.15 2020/01/16 15:29:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.16 2020/01/27 17:09:17 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -287,36 +287,3 @@
 
        return 0;
 }
-
-static void
-crypto_50_init(void)
-{
-
-       MODULE_HOOK_SET(ocryptof_50_hook, ocryptof_ioctl);
-}
-
-static void
-crypto_50_fini(void)
-{
-
-       MODULE_HOOK_UNSET(ocryptof_50_hook);
-}
-
-MODULE(MODULE_CLASS_EXEC, compat_crypto_50, "crypto,compat_50");
- 
-static int
-compat_crypto_50_modcmd(modcmd_t cmd, void *arg)
-{
- 
-       switch (cmd) {
-       case MODULE_CMD_INIT:
-               crypto_50_init();
-               return 0;
-       case MODULE_CMD_FINI:
-               crypto_50_fini();
-               return 0;
-       default: 
-               return ENOTTY;
-       }
-}
-



Home | Main Index | Thread Index | Old Index