summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>1999-11-17 04:59:09 +0000
committerken <ken@FreeBSD.org>1999-11-17 04:59:09 +0000
commit14a15966c5f7192bb612a331a2ef1676644cf864 (patch)
tree61cfe0d4b52fcaca77724bd95a5d2db18f441123 /sys/cam
parentbf227e92603cc9a64762a4466805ae399af01617 (diff)
downloadFreeBSD-src-14a15966c5f7192bb612a331a2ef1676644cf864.zip
FreeBSD-src-14a15966c5f7192bb612a331a2ef1676644cf864.tar.gz
Convert the xpt, pass, pt and target drivers to use the new
make_dev()/destroy_dev() interface.
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/cam_xpt.c2
-rw-r--r--sys/cam/scsi/scsi_pass.c12
-rw-r--r--sys/cam/scsi/scsi_pt.c17
-rw-r--r--sys/cam/scsi/scsi_target.c14
4 files changed, 27 insertions, 18 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 2aad3a7..1fd1296 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -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
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index dc843d2..5922f5d 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -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.
diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c
index efb019b..ceb6fbc 100644
--- a/sys/cam/scsi/scsi_pt.c
+++ b/sys/cam/scsi/scsi_pt.c
@@ -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");
diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c
index fe188c4..d594260 100644
--- a/sys/cam/scsi/scsi_target.c
+++ b/sys/cam/scsi/scsi_target.c
@@ -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);
OpenPOWER on IntegriCloud