diff --git a/sys/modules/crypto/Makefile b/sys/modules/crypto/Makefile index 44a82ad7f8f3..218a7b5da457 100644 --- a/sys/modules/crypto/Makefile +++ b/sys/modules/crypto/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2014/01/31 18:12:15 pgoyette Exp $ +# $NetBSD: Makefile,v 1.3 2014/02/03 23:11:40 pgoyette Exp $ .include "../Makefile.inc" @@ -6,8 +6,6 @@ CPPFLAGS+= -DCOMPAT_50 .PATH: ${S}/opencrypto -IOCONF= crypto.ioconf - KMOD= crypto SRCS= cryptodev.c ocryptodev.c diff --git a/sys/modules/crypto/crypto.ioconf b/sys/modules/crypto/crypto.ioconf deleted file mode 100644 index 4693f6da5126..000000000000 --- a/sys/modules/crypto/crypto.ioconf +++ /dev/null @@ -1,7 +0,0 @@ -# $NetBSD: crypto.ioconf,v 1.1 2014/01/31 18:12:15 pgoyette Exp $ - -ioconf crypto - -include "conf/files" - -pseudo-device crypto diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 64633f2ef2a5..fb3337fc3910 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -1,4 +1,4 @@ -/* $NetBSD: cryptodev.c,v 1.76 2014/01/31 18:11:32 pgoyette Exp $ */ +/* $NetBSD: cryptodev.c,v 1.77 2014/02/03 23:11:40 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 -__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.76 2014/01/31 18:11:32 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.77 2014/02/03 23:11:40 pgoyette Exp $"); #include #include @@ -2138,7 +2138,20 @@ CFATTACH_DECL2_NEW(crypto, 0, crypto_match, crypto_attach, crypto_detach, NULL, NULL, NULL); #ifdef _MODULE -#include "ioconf.c" +static int cryptoloc[] = { -1, -1 }; + +static struct cfdata crypto_cfdata[] = { + { + .cf_name = "crypto", + .cf_atname = "crypto", + .cf_unit = 0, + .cf_fstate = 0, + .cf_loc = cryptoloc, + .cf_flags = 0, + .cf_pspec = NULL, + }, + { NULL, NULL, 0, 0, NULL, 0, NULL } +}; #endif static int @@ -2146,46 +2159,66 @@ crypto_modcmd(modcmd_t cmd, void *arg) { int error = 0; #ifdef _MODULE - device_t dev; devmajor_t cmajor = NODEVMAJOR, bmajor = NODEVMAJOR; #endif switch (cmd) { case MODULE_CMD_INIT: #ifdef _MODULE - error = config_init_component(cfdriver_ioconf_crypto, - cfattach_ioconf_crypto, - cfdata_ioconf_crypto); - if (error) + + error = config_cfdriver_attach(&crypto_cd); + if (error) { return error; + } + + error = config_cfattach_attach(crypto_cd.cd_name, &crypto_ca); + if (error) { + config_cfdriver_detach(&crypto_cd); + aprint_error("%s: unable to register cfattach\n", + crypto_cd.cd_name); + + return error; + } + + error = config_cfdata_attach(crypto_cfdata, 1); + if (error) { + config_cfattach_detach(crypto_cd.cd_name, &crypto_ca); + config_cfdriver_detach(&crypto_cd); + aprint_error("%s: unable to register cfdata\n", + crypto_cd.cd_name); + + return error; + } error = devsw_attach(crypto_cd.cd_name, NULL, &bmajor, - &crypto_cdevsw, &cmajor); + &crypto_cdevsw, &cmajor); if (error) { - config_fini_component(cfdriver_ioconf_crypto, - cfattach_ioconf_crypto, - cfdata_ioconf_crypto); + error = config_cfdata_detach(crypto_cfdata); + if (error) { + return error; + } + config_cfattach_detach(crypto_cd.cd_name, &crypto_ca); + config_cfdriver_detach(&crypto_cd); aprint_error("%s: unable to register devsw\n", crypto_cd.cd_name); return error; } - dev = config_attach_pseudo(cfdata_ioconf_crypto); - if (dev) - aprint_normal_dev(dev, "attached\n"); + (void)config_attach_pseudo(crypto_cfdata); #endif return error; case MODULE_CMD_FINI: #ifdef _MODULE - error = devsw_detach(NULL, &crypto_cdevsw); + error = config_cfdata_detach(crypto_cfdata); if (error) { return error; } - error = config_fini_component(cfdriver_ioconf_crypto, - cfattach_ioconf_crypto, - cfdata_ioconf_crypto); + + config_cfattach_detach(crypto_cd.cd_name, &crypto_ca); + config_cfdriver_detach(&crypto_cd); + devsw_detach(NULL, &crypto_cdevsw); #endif return error; diff --git a/sys/rump/dev/lib/libopencrypto/CRYPTO.ioconf b/sys/rump/dev/lib/libopencrypto/CRYPTO.ioconf deleted file mode 100644 index a8795046c073..000000000000 --- a/sys/rump/dev/lib/libopencrypto/CRYPTO.ioconf +++ /dev/null @@ -1,8 +0,0 @@ -# $NetBSD: CRYPTO.ioconf,v 1.1 2014/01/31 18:13:01 pgoyette Exp $ -# - -ioconf crypto - -include "conf/files" - -pseudo-device crypto diff --git a/sys/rump/dev/lib/libopencrypto/Makefile b/sys/rump/dev/lib/libopencrypto/Makefile index d74e6093297d..c7ec89639b17 100644 --- a/sys/rump/dev/lib/libopencrypto/Makefile +++ b/sys/rump/dev/lib/libopencrypto/Makefile @@ -1,10 +1,9 @@ -# $NetBSD: Makefile,v 1.5 2014/01/31 18:13:01 pgoyette Exp $ +# $NetBSD: Makefile,v 1.6 2014/02/03 23:11:40 pgoyette Exp $ # .PATH: ${.CURDIR}/../../../../opencrypto LIB= rumpdev_opencrypto -IOCONF= CRYPTO.ioconf SRCS= component.c