Allocate the devstat structure with devstat_new_entry().

This commit is contained in:
Poul-Henning Kamp 2003-03-08 21:32:59 +00:00
parent ae77078c25
commit 8098046099
5 changed files with 19 additions and 24 deletions

View File

@ -159,7 +159,7 @@ acdattach(struct ata_device *atadev)
tmpcdp->slot = count;
tmpcdp->changer_info = chp;
acd_make_dev(tmpcdp);
devstat_add_entry(tmpcdp->stats, "acd", tmpcdp->lun, DEV_BSIZE,
tmpcdp->stats = devstat_new_entry("acd", tmpcdp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_CD);
@ -178,7 +178,7 @@ acdattach(struct ata_device *atadev)
}
else {
acd_make_dev(cdp);
devstat_add_entry(cdp->stats, "acd", cdp->lun, DEV_BSIZE,
cdp->stats = devstat_new_entry("acd", cdp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_CD);
@ -249,11 +249,6 @@ acd_init_lun(struct ata_device *atadev)
cdp->block_size = 2048;
cdp->slot = -1;
cdp->changer_info = NULL;
if (!(cdp->stats = malloc(sizeof(struct devstat), M_ACD,
M_NOWAIT | M_ZERO))) {
free(cdp, M_ACD);
return NULL;
}
return cdp;
}

View File

@ -122,7 +122,7 @@ astattach(struct ata_device *atadev)
ast_read_position(stp, 0, &position);
}
devstat_add_entry(&stp->stats, "ast", stp->lun, DEV_BSIZE,
stp->stats = devstat_new_entry("ast", stp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_SEQUENTIAL | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_TAPE);
@ -154,7 +154,7 @@ astdetach(struct ata_device *atadev)
}
destroy_dev(stp->dev1);
destroy_dev(stp->dev2);
devstat_remove_entry(&stp->stats);
devstat_remove_entry(stp->stats);
ata_free_name(atadev);
ata_free_lun(&ast_lun_map, stp->lun);
free(stp, M_AST);
@ -477,7 +477,7 @@ ast_start(struct ata_device *atadev)
ccb[3] = blkcount>>8;
ccb[4] = blkcount;
devstat_start_transaction(&stp->stats);
devstat_start_transaction(stp->stats);
atapi_queue_cmd(stp->device, ccb, bp->bio_data, blkcount * stp->blksize,
(bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0,
@ -500,7 +500,7 @@ ast_done(struct atapi_request *request)
bp->bio_resid = bp->bio_bcount - request->donecount;
ast_total += (bp->bio_bcount - bp->bio_resid);
}
biofinish(bp, &stp->stats, 0);
biofinish(bp, stp->stats, 0);
return 0;
}

View File

@ -157,6 +157,6 @@ struct ast_softc {
struct bio_queue_head queue; /* queue of i/o requests */
struct atapi_params *param; /* drive parameters table */
struct ast_cappage cap; /* capabilities page info */
struct devstat stats; /* devstat entry */
struct devstat *stats; /* devstat entry */
dev_t dev1, dev2; /* device place holders */
};

View File

@ -313,7 +313,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];
@ -1330,7 +1330,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);
@ -1345,7 +1345,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)
@ -1724,7 +1724,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);
@ -2372,7 +2372,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;
@ -2530,7 +2530,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;

View File

@ -313,7 +313,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];
@ -1330,7 +1330,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);
@ -1345,7 +1345,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)
@ -1724,7 +1724,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);
@ -2372,7 +2372,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;
@ -2530,7 +2530,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;