From b6c7d9c345d1427f37e2ead6076b04fefc768c5f Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Thu, 23 Aug 2018 01:42:45 +0000 Subject: devstat(9): Constify function parameters that can be const No functional change. When attempting to document the changed argument types in devstat.9, I discovered the 20 year old manual page severely mismatched reality even prior to my simple change. So I took a first cut pass cleaning that up to match reality. I'm sure I've missed some things; the goal was just to leave it better than when I started. Sponsored by: Dell EMC Isilon --- sys/kern/subr_devstat.c | 12 ++++++------ sys/sys/devicestat.h | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'sys') diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index 11ef6589a2db..4a3de470280a 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -224,7 +224,7 @@ devstat_remove_entry(struct devstat *ds) * here. */ void -devstat_start_transaction(struct devstat *ds, struct bintime *now) +devstat_start_transaction(struct devstat *ds, const struct bintime *now) { mtx_assert(&devstat_mutex, MA_NOTOWNED); @@ -294,7 +294,7 @@ devstat_start_transaction_bio(struct devstat *ds, struct bio *bp) void devstat_end_transaction(struct devstat *ds, uint32_t bytes, devstat_tag_type tag_type, devstat_trans_flags flags, - struct bintime *now, struct bintime *then) + const struct bintime *now, const struct bintime *then) { struct bintime dt, lnow; @@ -303,8 +303,8 @@ devstat_end_transaction(struct devstat *ds, uint32_t bytes, return; if (now == NULL) { + binuptime(&lnow); now = &lnow; - binuptime(now); } atomic_add_acq_int(&ds->sequence1, 1); @@ -338,15 +338,15 @@ devstat_end_transaction(struct devstat *ds, uint32_t bytes, } void -devstat_end_transaction_bio(struct devstat *ds, struct bio *bp) +devstat_end_transaction_bio(struct devstat *ds, const struct bio *bp) { devstat_end_transaction_bio_bt(ds, bp, NULL); } void -devstat_end_transaction_bio_bt(struct devstat *ds, struct bio *bp, - struct bintime *now) +devstat_end_transaction_bio_bt(struct devstat *ds, const struct bio *bp, + const struct bintime *now) { devstat_trans_flags flg; diff --git a/sys/sys/devicestat.h b/sys/sys/devicestat.h index 360c5b97c463..e3059ce83a5b 100644 --- a/sys/sys/devicestat.h +++ b/sys/sys/devicestat.h @@ -194,15 +194,16 @@ struct devstat *devstat_new_entry(const void *dev_name, int unit_number, devstat_priority priority); void devstat_remove_entry(struct devstat *ds); -void devstat_start_transaction(struct devstat *ds, struct bintime *now); +void devstat_start_transaction(struct devstat *ds, const struct bintime *now); void devstat_start_transaction_bio(struct devstat *ds, struct bio *bp); void devstat_end_transaction(struct devstat *ds, u_int32_t bytes, devstat_tag_type tag_type, devstat_trans_flags flags, - struct bintime *now, struct bintime *then); -void devstat_end_transaction_bio(struct devstat *ds, struct bio *bp); -void devstat_end_transaction_bio_bt(struct devstat *ds, struct bio *bp, - struct bintime *now); + const struct bintime *now, + const struct bintime *then); +void devstat_end_transaction_bio(struct devstat *ds, const struct bio *bp); +void devstat_end_transaction_bio_bt(struct devstat *ds, const struct bio *bp, + const struct bintime *now); #endif #endif /* _DEVICESTAT_H */ -- cgit v1.2.3