Restore this driver to a working state. The control device has

to be created at init time. The unit devices are created at
ctor when new instances are created and bound and destroyed
when that instance is closed. As such, there is just s single
static control dev_t for this driver (the per-unit dev_t's are
still in the softc).

When we have decommissionable periph drivers, a destroy_device
on the control device will have to called.
This commit is contained in:
mjacob 1999-12-29 22:55:01 +00:00
parent 36e5c77845
commit b0a78551fe

View File

@ -133,7 +133,6 @@ struct targ_softc {
struct buf_queue_head rcv_buf_queue;
struct devstat device_stats;
dev_t targ_dev;
dev_t ctl_dev;
struct selinfo snd_select;
struct selinfo rcv_select;
targ_state state;
@ -232,11 +231,11 @@ static struct periph_driver targdriver =
DATA_SET(periphdriver_set, targdriver);
static struct extend_array *targperiphs;
static dev_t targ_ctl_dev;
static void
targinit(void)
{
/*
* Create our extend array for storing the devices we attach to.
*/
@ -245,6 +244,11 @@ targinit(void)
printf("targ: Failed to alloc extend array!\n");
return;
}
targ_ctl_dev = make_dev(&targ_cdevsw, TARG_CONTROL_UNIT, UID_ROOT,
GID_OPERATOR, 0600, "%s.ctl", "targ");
if (targ_ctl_dev == (dev_t) 0) {
printf("targ: failed to create control dev\n");
}
}
static void
@ -491,10 +495,6 @@ targctor(struct cam_periph *periph, void *arg)
softc->targ_dev = make_dev(&targ_cdevsw, periph->unit_number, UID_ROOT,
GID_OPERATOR, 0600, "%s%d",
periph->periph_name, periph->unit_number);
softc->ctl_dev = make_dev(&targ_cdevsw, TARG_CONTROL_UNIT, UID_ROOT,
GID_OPERATOR, 0600, "%s%d.ctl",
periph->periph_name, periph->unit_number);
softc->init_level++;
return (CAM_REQ_CMP);
}
@ -518,7 +518,6 @@ targdtor(struct cam_periph *periph)
case 2:
free(softc->inq_data, M_DEVBUF);
destroy_dev(softc->targ_dev);
destroy_dev(softc->ctl_dev);
/* FALLTHROUGH */
case 1:
free(softc, M_DEVBUF);