summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-03-08 21:44:46 +0000
committerphk <phk@FreeBSD.org>2003-03-08 21:44:46 +0000
commitcaaeebfffc5cfa03a16b89c0cc5eb8e80c71558d (patch)
treea44b34cebbe0f538ef7ef5eb4e2de2c088658155 /sys
parentc3b6c02e14d82dfb1de3c7e6ca59ca3f3f79233a (diff)
downloadFreeBSD-src-caaeebfffc5cfa03a16b89c0cc5eb8e80c71558d.zip
FreeBSD-src-caaeebfffc5cfa03a16b89c0cc5eb8e80c71558d.tar.gz
Allocate the devstat structure with devstat_new_entry().
Diffstat (limited to 'sys')
-rw-r--r--sys/cam/scsi/scsi_cd.c28
-rw-r--r--sys/cam/scsi/scsi_ch.c28
-rw-r--r--sys/cam/scsi/scsi_pass.c8
-rw-r--r--sys/cam/scsi/scsi_pt.c10
-rw-r--r--sys/cam/scsi/scsi_sa.c54
-rw-r--r--sys/pc98/cbus/fdc.c12
-rw-r--r--sys/pc98/pc98/fd.c12
-rw-r--r--sys/pc98/pc98/wd_cd.c19
8 files changed, 81 insertions, 90 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index a76ec02..0472e81 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -143,7 +143,7 @@ struct cd_softc {
struct cd_params params;
union ccb saved_ccb;
cd_quirks quirks;
- struct devstat device_stats;
+ struct devstat *device_stats;
STAILQ_ENTRY(cd_softc) changer_links;
struct cdchanger *changer;
int bufs_left;
@@ -524,7 +524,7 @@ cdcleanup(struct cam_periph *periph)
free(softc->changer, M_DEVBUF);
num_changers--;
}
- devstat_remove_entry(&softc->device_stats);
+ devstat_remove_entry(softc->device_stats);
destroy_dev(softc->dev);
EVENTHANDLER_DEREGISTER(dev_clone, softc->clonetag);
free(softc, M_DEVBUF);
@@ -736,7 +736,7 @@ cdregister(struct cam_periph *periph, void *arg)
* WORM peripheral driver. WORM drives will also have the WORM
* driver attached to them.
*/
- devstat_add_entry(&softc->device_stats, "cd",
+ softc->device_stats = devstat_new_entry("cd",
periph->unit_number, 0,
DEVSTAT_BS_UNAVAILABLE,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_SCSI,
@@ -1057,7 +1057,7 @@ cdclose(dev_t dev, int flag, int fmt, struct thread *td)
* Since we're closing this CD, mark the blocksize as unavailable.
* It will be marked as available when the CD is opened again.
*/
- softc->device_stats.flags |= DEVSTAT_BS_UNAVAILABLE;
+ softc->device_stats->flags |= DEVSTAT_BS_UNAVAILABLE;
/*
* We'll check the media and toc again at the next open().
@@ -1088,7 +1088,7 @@ cdshorttimeout(void *arg)
* this device. If not, move it out of the active slot.
*/
if ((bioq_first(&changer->cur_device->bio_queue) == NULL)
- && (changer->cur_device->device_stats.busy_count == 0)) {
+ && (changer->cur_device->device_stats->busy_count == 0)) {
changer->flags |= CHANGER_MANUAL_CALL;
cdrunchangerqueue(changer);
}
@@ -1187,10 +1187,10 @@ cdrunchangerqueue(void *arg)
*/
if (changer->devq.qfrozen_cnt > 0) {
- if (changer->cur_device->device_stats.busy_count > 0) {
+ if (changer->cur_device->device_stats->busy_count > 0) {
changer->cur_device->flags |= CD_FLAG_SCHED_ON_COMP;
changer->cur_device->bufs_left =
- changer->cur_device->device_stats.busy_count;
+ changer->cur_device->device_stats->busy_count;
if (called_from_timeout) {
changer->long_handle =
timeout(cdrunchangerqueue, changer,
@@ -1297,7 +1297,7 @@ cdchangerschedule(struct cd_softc *softc)
cdrunchangerqueue(softc->changer);
}
} else if ((bioq_first(&softc->bio_queue) == NULL)
- && (softc->device_stats.busy_count == 0)) {
+ && (softc->device_stats->busy_count == 0)) {
softc->changer->flags |= CHANGER_MANUAL_CALL;
cdrunchangerqueue(softc->changer);
}
@@ -1351,7 +1351,7 @@ cdrunccb(union ccb *ccb, int (*error_routine)(union ccb *ccb,
softc = (struct cd_softc *)periph->softc;
error = cam_periph_runccb(ccb, error_routine, cam_flags, sense_flags,
- &softc->device_stats);
+ softc->device_stats);
if (softc->flags & CD_FLAG_CHANGER)
cdchangerschedule(softc);
@@ -1507,7 +1507,7 @@ cdstart(struct cam_periph *periph, union ccb *start_ccb)
} else {
bioq_remove(&softc->bio_queue, bp);
- devstat_start_transaction(&softc->device_stats);
+ devstat_start_transaction(softc->device_stats);
scsi_read_write(&start_ccb->csio,
/*retries*/4,
@@ -1666,7 +1666,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb)
if (softc->flags & CD_FLAG_CHANGER)
cdchangerschedule(softc);
- biofinish(bp, &softc->device_stats, 0);
+ biofinish(bp, softc->device_stats, 0);
break;
}
case CD_CCB_PROBE:
@@ -2828,9 +2828,9 @@ bailout:
* XXX problems here if some slice or partition is still
* open with the old size?
*/
- if ((softc->device_stats.flags & DEVSTAT_BS_UNAVAILABLE) != 0)
- softc->device_stats.flags &= ~DEVSTAT_BS_UNAVAILABLE;
- softc->device_stats.block_size = softc->params.blksize;
+ if ((softc->device_stats->flags & DEVSTAT_BS_UNAVAILABLE) != 0)
+ softc->device_stats->flags &= ~DEVSTAT_BS_UNAVAILABLE;
+ softc->device_stats->block_size = softc->params.blksize;
return (error);
}
diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c
index d64b78c..520976e 100644
--- a/sys/cam/scsi/scsi_ch.c
+++ b/sys/cam/scsi/scsi_ch.c
@@ -142,7 +142,7 @@ struct ch_softc {
ch_state state;
ch_quirks quirks;
union ccb saved_ccb;
- struct devstat device_stats;
+ struct devstat *device_stats;
dev_t dev;
int sc_picker; /* current picker */
@@ -283,7 +283,7 @@ chcleanup(struct cam_periph *periph)
softc = (struct ch_softc *)periph->softc;
- devstat_remove_entry(&softc->device_stats);
+ devstat_remove_entry(softc->device_stats);
destroy_dev(softc->dev);
xpt_print_path(periph->path);
printf("removing device entry\n");
@@ -369,7 +369,7 @@ chregister(struct cam_periph *periph, void *arg)
* Changers don't have a blocksize, and obviously don't support
* tagged queueing.
*/
- devstat_add_entry(&softc->device_stats, "ch",
+ softc->device_stats = devstat_new_entry("ch",
periph->unit_number, 0,
DEVSTAT_NO_BLOCKSIZE | DEVSTAT_NO_ORDERED_TAGS,
SID_TYPE(&cgd->inq_data)| DEVSTAT_TYPE_IF_SCSI,
@@ -845,7 +845,7 @@ chmove(struct cam_periph *periph, struct changer_move *cm)
error = cam_periph_runccb(ccb, cherror, /*cam_flags*/CAM_RETRY_SELTO,
/*sense_flags*/ SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
xpt_release_ccb(ccb);
@@ -908,7 +908,7 @@ chexchange(struct cam_periph *periph, struct changer_exchange *ce)
error = cam_periph_runccb(ccb, cherror, /*cam_flags*/CAM_RETRY_SELTO,
/*sense_flags*/ SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
xpt_release_ccb(ccb);
@@ -954,7 +954,7 @@ chposition(struct cam_periph *periph, struct changer_position *cp)
error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO,
/*sense_flags*/ SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
xpt_release_ccb(ccb);
@@ -1110,7 +1110,7 @@ chgetelemstatus(struct cam_periph *periph,
error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO,
/*sense_flags*/ SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
if (error)
goto done;
@@ -1146,7 +1146,7 @@ chgetelemstatus(struct cam_periph *periph,
error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO,
/*sense_flags*/ SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
if (error)
goto done;
@@ -1225,7 +1225,7 @@ chielem(struct cam_periph *periph,
error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO,
/*sense_flags*/ SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
xpt_release_ccb(ccb);
@@ -1312,7 +1312,7 @@ chsetvoltag(struct cam_periph *periph,
error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO,
/*sense_flags*/ SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
xpt_release_ccb(ccb);
@@ -1376,7 +1376,7 @@ chgetparams(struct cam_periph *periph)
error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO,
/* sense_flags */ SF_RETRY_UA|SF_NO_PRINT,
- &softc->device_stats);
+ softc->device_stats);
if (error) {
if (dbd) {
@@ -1389,7 +1389,7 @@ chgetparams(struct cam_periph *periph)
error = cam_periph_runccb(ccb, cherror,
/*cam_flags*/ CAM_RETRY_SELTO,
/*sense_flags*/ SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
} else {
/*
* Since we disabled sense printing above, print
@@ -1439,7 +1439,7 @@ chgetparams(struct cam_periph *periph)
error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO,
/* sense_flags */ SF_RETRY_UA | SF_NO_PRINT,
- &softc->device_stats);
+ softc->device_stats);
if (error) {
if (dbd) {
@@ -1452,7 +1452,7 @@ chgetparams(struct cam_periph *periph)
error = cam_periph_runccb(ccb, cherror,
/*cam_flags*/ CAM_RETRY_SELTO,
/*sense_flags*/ SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
} else {
/*
* Since we disabled sense printing above, print
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index bbe9939..a788a48 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -72,7 +72,7 @@ struct pass_softc {
pass_flags flags;
u_int8_t pd_type;
union ccb saved_ccb;
- struct devstat device_stats;
+ struct devstat *device_stats;
dev_t dev;
};
@@ -186,7 +186,7 @@ passcleanup(struct cam_periph *periph)
softc = (struct pass_softc *)periph->softc;
- devstat_remove_entry(&softc->device_stats);
+ devstat_remove_entry(softc->device_stats);
destroy_dev(softc->dev);
@@ -284,7 +284,7 @@ passregister(struct cam_periph *periph, void *arg)
* it even has a blocksize.
*/
no_tags = (cgd->inq_data.flags & SID_CmdQue) == 0;
- devstat_add_entry(&softc->device_stats, "pass", periph->unit_number, 0,
+ softc->device_stats = devstat_new_entry("pass", periph->unit_number, 0,
DEVSTAT_NO_BLOCKSIZE
| (no_tags ? DEVSTAT_NO_ORDERED_TAGS : 0),
softc->pd_type |
@@ -596,7 +596,7 @@ passsendccb(struct cam_periph *periph, union ccb *ccb, union ccb *inccb)
passerror : NULL,
/* cam_flags */ CAM_RETRY_SELTO,
/* sense_flags */SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
if (need_unmap != 0)
cam_periph_unmapmem(ccb, &mapinfo);
diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c
index ec3409b..c02a426 100644
--- a/sys/cam/scsi/scsi_pt.c
+++ b/sys/cam/scsi/scsi_pt.c
@@ -76,7 +76,7 @@ typedef enum {
struct pt_softc {
struct bio_queue_head bio_queue;
- struct devstat device_stats;
+ struct devstat *device_stats;
LIST_HEAD(, ccb_hdr) pending_ccbs;
pt_state state;
pt_flags flags;
@@ -316,7 +316,7 @@ ptctor(struct cam_periph *periph, void *arg)
periph->softc = softc;
- devstat_add_entry(&softc->device_stats, "pt",
+ softc->device_stats = devstat_new_entry("pt",
periph->unit_number, 0,
DEVSTAT_NO_BLOCKSIZE,
SID_TYPE(&cgd->inq_data) | DEVSTAT_TYPE_IF_SCSI,
@@ -402,7 +402,7 @@ ptdtor(struct cam_periph *periph)
softc = (struct pt_softc *)periph->softc;
- devstat_remove_entry(&softc->device_stats);
+ devstat_remove_entry(softc->device_stats);
destroy_dev(softc->dev);
@@ -502,7 +502,7 @@ ptstart(struct cam_periph *periph, union ccb *start_ccb)
bioq_remove(&softc->bio_queue, bp);
- devstat_start_transaction(&softc->device_stats);
+ devstat_start_transaction(softc->device_stats);
scsi_send_receive(&start_ccb->csio,
/*retries*/4,
@@ -631,7 +631,7 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb)
LIST_REMOVE(&done_ccb->ccb_h, periph_links.le);
splx(oldspl);
- biofinish(bp, &softc->device_stats, 0);
+ biofinish(bp, softc->device_stats, 0);
break;
}
case PT_CCB_WAITING:
diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c
index 6ab3b5a..3a8a03a 100644
--- a/sys/cam/scsi/scsi_sa.c
+++ b/sys/cam/scsi/scsi_sa.c
@@ -206,7 +206,7 @@ struct sa_softc {
sa_quirks quirks;
struct bio_queue_head bio_queue;
int queue_count;
- struct devstat device_stats;
+ struct devstat *device_stats;
struct sa_devs devs;
int blk_gran;
int blk_mask;
@@ -1333,7 +1333,7 @@ sacleanup(struct cam_periph *periph)
softc = (struct sa_softc *)periph->softc;
- devstat_remove_entry(&softc->device_stats);
+ devstat_remove_entry(softc->device_stats);
destroy_dev(softc->devs.ctl_dev);
@@ -1450,7 +1450,7 @@ saregister(struct cam_periph *periph, void *arg)
* blocksize until we media is inserted. So, set a flag to
* indicate that the blocksize is unavailable right now.
*/
- devstat_add_entry(&softc->device_stats, "sa", periph->unit_number, 0,
+ softc->device_stats = devstat_new_entry("sa", periph->unit_number, 0,
DEVSTAT_BS_UNAVAILABLE, SID_TYPE(&cgd->inq_data) |
DEVSTAT_TYPE_IF_SCSI, DEVSTAT_PRIORITY_TAPE);
@@ -1620,7 +1620,7 @@ again:
CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_INFO,
("Variable Record Count is %d\n", length));
}
- devstat_start_transaction(&softc->device_stats);
+ devstat_start_transaction(softc->device_stats);
/*
* Some people have theorized that we should
* suppress illegal length indication if we are
@@ -1767,7 +1767,7 @@ sadone(struct cam_periph *periph, union ccb *done_ccb)
bp->bio_resid, bp->bio_bcount));
}
#endif
- biofinish(bp, &softc->device_stats, 0);
+ biofinish(bp, softc->device_stats, 0);
break;
}
case SA_CCB_WAITING:
@@ -1814,14 +1814,14 @@ samount(struct cam_periph *periph, int oflags, dev_t dev)
scsi_test_unit_ready(&ccb->csio, 0, sadone,
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
- &softc->device_stats);
+ softc->device_stats);
QFRLS(ccb);
if (error == ENXIO) {
softc->flags &= ~SA_FLAG_TAPE_MOUNTED;
scsi_test_unit_ready(&ccb->csio, 0, sadone,
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
- &softc->device_stats);
+ softc->device_stats);
QFRLS(ccb);
} else if (error) {
/*
@@ -1843,7 +1843,7 @@ samount(struct cam_periph *periph, int oflags, dev_t dev)
scsi_test_unit_ready(&ccb->csio, 0, sadone,
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
- &softc->device_stats);
+ softc->device_stats);
QFRLS(ccb);
}
@@ -1866,7 +1866,7 @@ samount(struct cam_periph *periph, int oflags, dev_t dev)
scsi_load_unload(&ccb->csio, 2, sadone, MSG_SIMPLE_Q_TAG, FALSE,
FALSE, FALSE, 1, SSD_FULL_SIZE, REWIND_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
- &softc->device_stats);
+ softc->device_stats);
QFRLS(ccb);
/*
@@ -1876,7 +1876,7 @@ samount(struct cam_periph *periph, int oflags, dev_t dev)
scsi_rewind(&ccb->csio, 2, sadone, MSG_SIMPLE_Q_TAG,
FALSE, SSD_FULL_SIZE, REWIND_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
- &softc->device_stats);
+ softc->device_stats);
QFRLS(ccb);
}
if (error) {
@@ -1907,13 +1907,13 @@ samount(struct cam_periph *periph, int oflags, dev_t dev)
(void *) rblim, 8192, SSD_FULL_SIZE,
IO_TIMEOUT);
(void) cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
- &softc->device_stats);
+ softc->device_stats);
QFRLS(ccb);
scsi_rewind(&ccb->csio, 1, sadone, MSG_SIMPLE_Q_TAG,
FALSE, SSD_FULL_SIZE, REWIND_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, CAM_RETRY_SELTO,
SF_NO_PRINT | SF_RETRY_UA,
- &softc->device_stats);
+ softc->device_stats);
QFRLS(ccb);
if (error) {
xpt_print_path(ccb->ccb_h.path);
@@ -1930,7 +1930,7 @@ samount(struct cam_periph *periph, int oflags, dev_t dev)
rblim, SSD_FULL_SIZE, SCSIOP_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, CAM_RETRY_SELTO,
- SF_NO_PRINT | SF_RETRY_UA, &softc->device_stats);
+ SF_NO_PRINT | SF_RETRY_UA, softc->device_stats);
QFRLS(ccb);
xpt_release_ccb(ccb);
@@ -2528,7 +2528,7 @@ retry:
SSD_FULL_SIZE, SCSIOP_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
- &softc->device_stats);
+ softc->device_stats);
QFRLS(ccb);
status = ccb->ccb_h.status & CAM_STATUS_MASK;
@@ -2592,7 +2592,7 @@ retry:
SCSIOP_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
- &softc->device_stats);
+ softc->device_stats);
QFRLS(ccb);
if (error != 0)
@@ -2886,7 +2886,7 @@ retry:
FALSE, mode_buffer, mode_buffer_len, SSD_FULL_SIZE, SCSIOP_TIMEOUT);
error = cam_periph_runccb(ccb, saerror, 0,
- sense_flags, &softc->device_stats);
+ sense_flags, softc->device_stats);
QFRLS(ccb);
if (CAM_DEBUGGED(periph->path, CAM_DEBUG_INFO)) {
@@ -2944,7 +2944,7 @@ retry:
*/
ccb->ccb_h.retry_count = 1;
cam_periph_runccb(ccb, saerror, 0, sense_flags,
- &softc->device_stats);
+ softc->device_stats);
QFRLS(ccb);
}
@@ -3002,7 +3002,7 @@ saprevent(struct cam_periph *periph, int action)
scsi_prevent(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG, action,
SSD_FULL_SIZE, SCSIOP_TIMEOUT);
- error = cam_periph_runccb(ccb, saerror, 0, sf, &softc->device_stats);
+ error = cam_periph_runccb(ccb, saerror, 0, sf, softc->device_stats);
QFRLS(ccb);
if (error == 0) {
if (action == PR_ALLOW)
@@ -3030,7 +3030,7 @@ sarewind(struct cam_periph *periph)
SSD_FULL_SIZE, REWIND_TIMEOUT);
softc->dsreg = MTIO_DSREG_REW;
- error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats);
+ error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
softc->dsreg = MTIO_DSREG_REST;
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
@@ -3066,7 +3066,7 @@ saspace(struct cam_periph *periph, int count, scsi_space_code code)
softc->last_ctl_resid = 0;
softc->dsreg = (count < 0)? MTIO_DSREG_REV : MTIO_DSREG_FWD;
- error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats);
+ error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
softc->dsreg = MTIO_DSREG_REST;
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
@@ -3139,7 +3139,7 @@ sawritefilemarks(struct cam_periph *periph, int nmarks, int setmarks)
softc->dsreg = MTIO_DSREG_REST;
- error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats);
+ error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE);
@@ -3192,7 +3192,7 @@ sardpos(struct cam_periph *periph, int hard, u_int32_t *blkptr)
scsi_read_position(&ccb->csio, 1, sadone, MSG_SIMPLE_Q_TAG,
hard, &loc, SSD_FULL_SIZE, SCSIOP_TIMEOUT);
softc->dsreg = MTIO_DSREG_RBSY;
- error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats);
+ error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
softc->dsreg = MTIO_DSREG_REST;
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, 0);
@@ -3233,7 +3233,7 @@ sasetpos(struct cam_periph *periph, int hard, u_int32_t *blkptr)
softc->dsreg = MTIO_DSREG_POS;
- error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats);
+ error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
softc->dsreg = MTIO_DSREG_REST;
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, 0);
@@ -3261,7 +3261,7 @@ saretension(struct cam_periph *periph)
FALSE, TRUE, TRUE, SSD_FULL_SIZE, ERASE_TIMEOUT);
softc->dsreg = MTIO_DSREG_TEN;
- error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats);
+ error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
softc->dsreg = MTIO_DSREG_REST;
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
@@ -3289,7 +3289,7 @@ sareservereleaseunit(struct cam_periph *periph, int reserve)
FALSE, 0, SSD_FULL_SIZE, SCSIOP_TIMEOUT, reserve);
softc->dsreg = MTIO_DSREG_RBSY;
error = cam_periph_runccb(ccb, saerror, 0,
- SF_RETRY_UA | SF_NO_PRINT, &softc->device_stats);
+ SF_RETRY_UA | SF_NO_PRINT, softc->device_stats);
softc->dsreg = MTIO_DSREG_REST;
QFRLS(ccb);
xpt_release_ccb(ccb);
@@ -3321,7 +3321,7 @@ saloadunload(struct cam_periph *periph, int load)
FALSE, FALSE, load, SSD_FULL_SIZE, REWIND_TIMEOUT);
softc->dsreg = (load)? MTIO_DSREG_LD : MTIO_DSREG_UNL;
- error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats);
+ error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
softc->dsreg = MTIO_DSREG_REST;
QFRLS(ccb);
xpt_release_ccb(ccb);
@@ -3349,7 +3349,7 @@ saerase(struct cam_periph *periph, int longerase)
SSD_FULL_SIZE, ERASE_TIMEOUT);
softc->dsreg = MTIO_DSREG_ZER;
- error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats);
+ error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
softc->dsreg = MTIO_DSREG_REST;
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c
index 05d6ab9..8cabd0a 100644
--- a/sys/pc98/cbus/fdc.c
+++ b/sys/pc98/cbus/fdc.c
@@ -383,7 +383,7 @@ struct fd_data {
int options; /* user configurable options, see fdcio.h */
struct callout_handle toffhandle;
struct callout_handle tohandle;
- struct devstat device_stats;
+ struct devstat *device_stats;
eventhandler_tag clonetag;
dev_t masterdev;
dev_t clonedevs[NUMDENS - 1];
@@ -1728,7 +1728,7 @@ fd_attach(device_t dev)
UID_ROOT, GID_OPERATOR, 0640, "fd%d", fd->fdu);
for (i = 0; i < NUMDENS - 1; i++)
fd->clonedevs[i] = NODEV;
- devstat_add_entry(&fd->device_stats, device_get_name(dev),
+ fd->device_stats = devstat_new_entry(device_get_name(dev),
device_get_unit(dev), 0, DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
DEVSTAT_PRIORITY_FD);
@@ -1743,7 +1743,7 @@ fd_detach(device_t dev)
fd = device_get_softc(dev);
untimeout(fd_turnoff, fd, fd->toffhandle);
- devstat_remove_entry(&fd->device_stats);
+ devstat_remove_entry(fd->device_stats);
destroy_dev(fd->masterdev);
for (i = 0; i < NUMDENS - 1; i++)
if (fd->clonedevs[i] != NODEV)
@@ -2153,7 +2153,7 @@ fdstrategy(struct bio *bp)
s = splbio();
bioqdisksort(&fdc->head, bp);
untimeout(fd_turnoff, fd, fd->toffhandle); /* a good idea */
- devstat_start_transaction(&fd->device_stats);
+ devstat_start_transaction(fd->device_stats);
device_busy(fd->dev);
fdstart(fdc);
splx(s);
@@ -2911,7 +2911,7 @@ fdstate(fdc_p fdc)
bp->bio_resid = 0;
fdc->bp = NULL;
device_unbusy(fd->dev);
- biofinish(bp, &fd->device_stats, 0);
+ biofinish(bp, fd->device_stats, 0);
fdc->fd = (fd_p) 0;
fdc->fdu = -1;
fdc->state = FINDWORK;
@@ -3078,7 +3078,7 @@ retrier(struct fdc_data *fdc)
fdc->bp = NULL;
fdc->fd->skip = 0;
device_unbusy(fd->dev);
- biofinish(bp, &fdc->fd->device_stats, 0);
+ biofinish(bp, fdc->fd->device_stats, 0);
fdc->state = FINDWORK;
fdc->flags |= FDC_NEEDS_RESET;
fdc->fd = (fd_p) 0;
diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c
index 05d6ab9..8cabd0a 100644
--- a/sys/pc98/pc98/fd.c
+++ b/sys/pc98/pc98/fd.c
@@ -383,7 +383,7 @@ struct fd_data {
int options; /* user configurable options, see fdcio.h */
struct callout_handle toffhandle;
struct callout_handle tohandle;
- struct devstat device_stats;
+ struct devstat *device_stats;
eventhandler_tag clonetag;
dev_t masterdev;
dev_t clonedevs[NUMDENS - 1];
@@ -1728,7 +1728,7 @@ fd_attach(device_t dev)
UID_ROOT, GID_OPERATOR, 0640, "fd%d", fd->fdu);
for (i = 0; i < NUMDENS - 1; i++)
fd->clonedevs[i] = NODEV;
- devstat_add_entry(&fd->device_stats, device_get_name(dev),
+ fd->device_stats = devstat_new_entry(device_get_name(dev),
device_get_unit(dev), 0, DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
DEVSTAT_PRIORITY_FD);
@@ -1743,7 +1743,7 @@ fd_detach(device_t dev)
fd = device_get_softc(dev);
untimeout(fd_turnoff, fd, fd->toffhandle);
- devstat_remove_entry(&fd->device_stats);
+ devstat_remove_entry(fd->device_stats);
destroy_dev(fd->masterdev);
for (i = 0; i < NUMDENS - 1; i++)
if (fd->clonedevs[i] != NODEV)
@@ -2153,7 +2153,7 @@ fdstrategy(struct bio *bp)
s = splbio();
bioqdisksort(&fdc->head, bp);
untimeout(fd_turnoff, fd, fd->toffhandle); /* a good idea */
- devstat_start_transaction(&fd->device_stats);
+ devstat_start_transaction(fd->device_stats);
device_busy(fd->dev);
fdstart(fdc);
splx(s);
@@ -2911,7 +2911,7 @@ fdstate(fdc_p fdc)
bp->bio_resid = 0;
fdc->bp = NULL;
device_unbusy(fd->dev);
- biofinish(bp, &fd->device_stats, 0);
+ biofinish(bp, fd->device_stats, 0);
fdc->fd = (fd_p) 0;
fdc->fdu = -1;
fdc->state = FINDWORK;
@@ -3078,7 +3078,7 @@ retrier(struct fdc_data *fdc)
fdc->bp = NULL;
fdc->fd->skip = 0;
device_unbusy(fd->dev);
- biofinish(bp, &fdc->fd->device_stats, 0);
+ biofinish(bp, fdc->fd->device_stats, 0);
fdc->state = FINDWORK;
fdc->flags |= FDC_NEEDS_RESET;
fdc->fd = (fd_p) 0;
diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c
index c784acd..21ce10e 100644
--- a/sys/pc98/pc98/wd_cd.c
+++ b/sys/pc98/pc98/wd_cd.c
@@ -77,7 +77,7 @@ static struct acd *acdtab[NUNIT];
static int acdnlun = 0; /* Number of configured drives */
int acdattach(struct atapi *, int, struct atapi_params *, int);
-static struct acd *acd_init_lun(struct atapi *, int, struct atapi_params *, int,
+static struct acd *acd_init_lun(struct atapi *, int, struct atapi_params *, int);
struct devstat *);
static void acd_start(struct acd *);
static void acd_done(struct acd *, struct bio *, int, struct atapires);
@@ -97,8 +97,7 @@ static void atapi_dump(int ctrlr, int lun, char *label, void *data, int len);
static void atapi_error(struct atapi *ata, int unit, struct atapires result);
struct acd *
-acd_init_lun(struct atapi *ata, int unit, struct atapi_params *ap, int lun,
- struct devstat *device_stats)
+acd_init_lun(struct atapi *ata, int unit, struct atapi_params *ap, int lun)
{
struct acd *ptr;
dev_t pdev;
@@ -116,13 +115,6 @@ acd_init_lun(struct atapi *ata, int unit, struct atapi_params *ap, int lun,
ptr->refcnt = 0;
ptr->slot = -1;
ptr->changer_info = NULL;
- if (device_stats == NULL) {
- if (!(ptr->device_stats = malloc(sizeof(struct devstat),
- M_TEMP, M_NOWAIT | M_ZERO)))
- return NULL;
- }
- else
- ptr->device_stats = device_stats;
pdev = make_dev(&acd_cdevsw, dkmakeminor(lun, 0, 0),
UID_ROOT, GID_OPERATOR, 0640, "wcd%da", lun);
@@ -219,8 +211,7 @@ acdattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug)
chp->table_length = htons(chp->table_length);
for (i = 0; i < chp->slots && acdnlun < NUNIT; i++) {
if (i > 0) {
- tmpcdp = acd_init_lun(ata, unit, ap, acdnlun,
- cdp->device_stats);
+ tmpcdp = acd_init_lun(ata, unit, ap, acdnlun);
if (!tmpcdp) {
printf("wcd: out of memory\n");
return 0;
@@ -238,14 +229,14 @@ acdattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug)
}
}
sprintf(string, "wcd%d-", cdp->lun);
- devstat_add_entry(cdp->device_stats, string, tmpcdp->lun, DEV_BSIZE,
+ cdp->device_stats = devstat_new_entry(string, tmpcdp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_CD);
}
else {
acdnlun++;
- devstat_add_entry(cdp->device_stats, "wcd", cdp->lun, DEV_BSIZE,
+ cdp->device_stats = devstat_new_entry("wcd", cdp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_CD);
OpenPOWER on IntegriCloud