diff --git a/sys/dev/iscsi_initiator/iscsi.c b/sys/dev/iscsi_initiator/iscsi.c index d38cf23ee5af..fd621bdc834e 100644 --- a/sys/dev/iscsi_initiator/iscsi.c +++ b/sys/dev/iscsi_initiator/iscsi.c @@ -706,7 +706,7 @@ free_pdus(struct isc_softc *sc) } } -static void +static int iscsi_start(void) { debug_called(8); @@ -715,8 +715,6 @@ iscsi_start(void) TUNABLE_INT_FETCH("net.iscsi_initiator.max_pdus", &max_pdus); isc = malloc(sizeof(struct isc_softc), M_ISCSI, M_ZERO|M_WAITOK); - isc->dev = make_dev(&iscsi_cdevsw, max_sessions, UID_ROOT, GID_WHEEL, 0600, "iscsi"); - isc->dev->si_drv1 = isc; mtx_init(&isc->isc_mtx, "iscsi-isc", NULL, MTX_DEF); TAILQ_INIT(&isc->isc_sess); @@ -726,10 +724,6 @@ iscsi_start(void) isc->pdu_zone = uma_zcreate("pdu", sizeof(pduq_t), NULL, NULL, NULL, NULL, 0, 0); - if(isc->pdu_zone == NULL) { - xdebug("iscsi_initiator: uma_zcreate failed"); - // XXX: should fail... - } uma_zone_set_max(isc->pdu_zone, max_pdus); isc->unit = new_unrhdr(0, max_sessions-1, NULL); sx_init(&isc->unit_sx, "iscsi sx"); @@ -782,7 +776,16 @@ iscsi_start(void) mtx_init(&iscsi_dbg_mtx, "iscsi_dbg", NULL, MTX_DEF); #endif + isc->dev = make_dev_credf(MAKEDEV_CHECKNAME, &iscsi_cdevsw, max_sessions, + NULL, UID_ROOT, GID_WHEEL, 0600, "iscsi"); + if (isc->dev == NULL) { + xdebug("iscsi_initiator: make_dev_credf failed"); + return (EEXIST); + } + isc->dev->si_drv1 = isc; + printf("iscsi: version %s\n", iscsi_driver_version); + return (0); } /* @@ -830,11 +833,13 @@ iscsi_stop(void) static int iscsi_modevent(module_t mod, int what, void *arg) { + int error = 0; + debug_called(8); switch(what) { case MOD_LOAD: - iscsi_start(); + error = iscsi_start(); break; case MOD_QUIESCE: @@ -854,7 +859,7 @@ iscsi_modevent(module_t mod, int what, void *arg) default: break; } - return 0; + return (error); } moduledata_t iscsi_mod = {