Undo previous - it still needs a lot more work.
For now, we'll use the hand-crafted cf* structures and directly call all the config routines.
This commit is contained in:
parent
27e029a426
commit
f496b70ec7
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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 <sys/cdefs.h>
|
||||
__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 <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -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;
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue