summaryrefslogtreecommitdiffstats
path: root/sys/opencrypto
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2002-10-16 14:31:34 +0000
committermarkm <markm@FreeBSD.org>2002-10-16 14:31:34 +0000
commit658a7ab8f2d91da8b2da85980436fd500accaf92 (patch)
tree15423431124b67e918f64aee072db86a94386607 /sys/opencrypto
parent98e716a4fe3c11b8fa3a358acb490ca6d58d7ff6 (diff)
downloadFreeBSD-src-658a7ab8f2d91da8b2da85980436fd500accaf92.zip
FreeBSD-src-658a7ab8f2d91da8b2da85980436fd500accaf92.tar.gz
Module-ize the 'core' crypto stuff. This may still need to be compiled
into the kernel by default (if required), but other modules can now depend() on this. Fix inter-module dependancy. Earlier version OK'ed by: sam
Diffstat (limited to 'sys/opencrypto')
-rw-r--r--sys/opencrypto/crypto.c33
-rw-r--r--sys/opencrypto/cryptodev.c1
2 files changed, 31 insertions, 3 deletions
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index 9bd2e84..a4e2f5e 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -123,7 +123,34 @@ crypto_init(void)
TAILQ_INIT(&crp_ret_kq);
mtx_init(&crypto_ret_q_mtx, "crypto return queues", NULL, MTX_DEF);
}
-SYSINIT(crypto_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, crypto_init, NULL)
+
+/*
+ * Initialization code, both for static and dynamic loading.
+ */
+static int
+crypto_modevent(module_t mod, int type, void *unused)
+{
+ switch (type) {
+ case MOD_LOAD:
+ crypto_init();
+ if (bootverbose)
+ printf("crypto: <crypto core>\n");
+ return 0;
+ case MOD_UNLOAD:
+ /*XXX disallow if active sessions */
+ /*XXX kill kthreads */
+ return 0;
+ }
+ return EINVAL;
+}
+
+static moduledata_t crypto_mod = {
+ "crypto",
+ crypto_modevent,
+ 0
+};
+MODULE_VERSION(crypto, 1);
+DECLARE_MODULE(crypto, crypto_mod, SI_SUB_PSEUDO, SI_ORDER_SECOND);
/*
* Create a new session.
@@ -910,7 +937,7 @@ static struct kproc_desc crypto_kp = {
crypto_proc,
&cryptoproc
};
-SYSINIT(crypto_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY,
+SYSINIT(crypto_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_THIRD,
kproc_start, &crypto_kp)
static struct proc *cryptoretproc;
@@ -972,5 +999,5 @@ static struct kproc_desc crypto_ret_kp = {
crypto_ret_proc,
&cryptoretproc
};
-SYSINIT(crypto_ret_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY,
+SYSINIT(crypto_ret_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_THIRD,
kproc_start, &crypto_ret_kp)
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c
index 6612cef..4967d16 100644
--- a/sys/opencrypto/cryptodev.c
+++ b/sys/opencrypto/cryptodev.c
@@ -794,3 +794,4 @@ static moduledata_t cryptodev_mod = {
};
MODULE_VERSION(cryptodev, 1);
DECLARE_MODULE(cryptodev, cryptodev_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+MODULE_DEPEND(cryptodev, crypto, 1, 1, 1);
OpenPOWER on IntegriCloud