summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-03-08 21:32:59 +0000
committerphk <phk@FreeBSD.org>2003-03-08 21:32:59 +0000
commit2dfffca0ff9a04153a17ecae4b14d41ae4001b6a (patch)
treeaa51483fba343aeeb6e1a38ed027be9f71d9d439
parent1664ca4405c0ae8ca2f173edcfe621ce8a5e3bcc (diff)
downloadFreeBSD-src-2dfffca0ff9a04153a17ecae4b14d41ae4001b6a.zip
FreeBSD-src-2dfffca0ff9a04153a17ecae4b14d41ae4001b6a.tar.gz
Allocate the devstat structure with devstat_new_entry().
-rw-r--r--sys/dev/ata/atapi-cd.c9
-rw-r--r--sys/dev/ata/atapi-tape.c8
-rw-r--r--sys/dev/ata/atapi-tape.h2
-rw-r--r--sys/dev/fdc/fdc.c12
-rw-r--r--sys/isa/fd.c12
5 files changed, 19 insertions, 24 deletions
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c
index e7d98d6..4a33b91 100644
--- a/sys/dev/ata/atapi-cd.c
+++ b/sys/dev/ata/atapi-cd.c
@@ -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;
}
diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c
index b81dd94..5aecc16 100644
--- a/sys/dev/ata/atapi-tape.c
+++ b/sys/dev/ata/atapi-tape.c
@@ -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;
}
diff --git a/sys/dev/ata/atapi-tape.h b/sys/dev/ata/atapi-tape.h
index 96ef84e..18b4449 100644
--- a/sys/dev/ata/atapi-tape.h
+++ b/sys/dev/ata/atapi-tape.h
@@ -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 */
};
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index bb2cc86..dd0609a 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -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;
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index bb2cc86..dd0609a 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -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;
OpenPOWER on IntegriCloud