Convert the xpt, pass, pt and target drivers to use the new

make_dev()/destroy_dev() interface.
This commit is contained in:
ken 1999-11-17 04:59:09 +00:00
parent bf227e9260
commit 14a15966c5
4 changed files with 27 additions and 18 deletions

View File

@ -825,7 +825,7 @@ dev_allocq_is_runnable(struct cam_devq *devq)
static void
xpt_periph_init()
{
cdevsw_add(&xpt_cdevsw);
make_dev(&xpt_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0600, "xpt0");
}
static void

View File

@ -78,6 +78,7 @@ struct pass_softc {
struct buf_queue_head buf_queue;
union ccb saved_ccb;
struct devstat device_stats;
dev_t dev;
};
#ifndef MIN
@ -170,9 +171,6 @@ passinit(void)
if (status != CAM_REQ_CMP) {
printf("pass: Failed to attach master async callback "
"due to status 0x%x!\n", status);
} else {
/* If we were successfull, register our devsw */
cdevsw_add(&pass_cdevsw);
}
}
@ -237,6 +235,8 @@ passcleanup(struct cam_periph *periph)
devstat_remove_entry(&softc->device_stats);
destroy_dev(softc->dev);
cam_extend_release(passperiphs, periph->unit_number);
if (bootverbose) {
@ -331,6 +331,12 @@ passregister(struct cam_periph *periph, void *arg)
DEVSTAT_TYPE_IF_SCSI |
DEVSTAT_TYPE_PASS,
DEVSTAT_PRIORITY_PASS);
/* Register the device */
softc->dev = make_dev(&pass_cdevsw, periph->unit_number, UID_ROOT,
GID_OPERATOR, 0600, "%s%d", periph->periph_name,
periph->unit_number);
/*
* Add an async callback so that we get
* notified if this device goes away.

View File

@ -83,6 +83,7 @@ struct pt_softc {
pt_flags flags;
union ccb saved_ccb;
int io_timeout;
dev_t dev;
};
static d_open_t ptopen;
@ -306,9 +307,6 @@ ptinit(void)
if (status != CAM_REQ_CMP) {
printf("pt: Failed to attach master async callback "
"due to status 0x%x!\n", status);
} else {
/* If we were successfull, register our devsw */
cdevsw_add(&pt_cdevsw);
}
}
@ -349,20 +347,15 @@ ptctor(struct cam_periph *periph, void *arg)
cam_extend_set(ptperiphs, periph->unit_number, periph);
/*
* The DA driver supports a blocksize, but
* we don't know the blocksize until we do
* a read capacity. So, set a flag to
* indicate that the blocksize is
* unavailable right now. We'll clear the
* flag as soon as we've done a read capacity.
*/
devstat_add_entry(&softc->device_stats, "pt",
periph->unit_number, 0,
DEVSTAT_NO_BLOCKSIZE,
cgd->pd_type | DEVSTAT_TYPE_IF_SCSI,
DEVSTAT_PRIORITY_OTHER);
softc->dev = make_dev(&pt_cdevsw, periph->unit_number, UID_ROOT,
GID_OPERATOR, 0600, "%s%d", periph->periph_name,
periph->unit_number);
/*
* Add async callbacks for bus reset and
* bus device reset calls. I don't bother
@ -442,6 +435,8 @@ ptdtor(struct cam_periph *periph)
devstat_remove_entry(&softc->device_stats);
destroy_dev(softc->dev);
cam_extend_release(ptperiphs, periph->unit_number);
xpt_print_path(periph->path);
printf("removing device entry\n");

View File

@ -132,6 +132,8 @@ 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;
@ -243,9 +245,6 @@ targinit(void)
printf("targ: Failed to alloc extend array!\n");
return;
}
/* If we were successfull, register our devsw */
cdevsw_add(&targ_cdevsw);
}
static void
@ -489,6 +488,13 @@ targctor(struct cam_periph *periph, void *arg)
strncpy(softc->inq_data->vendor, "FreeBSD ", SID_VENDOR_SIZE);
strncpy(softc->inq_data->product, "TM-PT ", SID_PRODUCT_SIZE);
strncpy(softc->inq_data->revision, "0.0 ", SID_REVISION_SIZE);
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);
}
@ -511,6 +517,8 @@ targdtor(struct cam_periph *periph)
/* FALLTHROUGH */
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);