statistics: cleanups
Subsystems (3)
RFC PATCH 2/4 statistics: cleanups
Statistics code cleanups. Would not have been needed for the following changes - just done along the way.
- make function void
- found more handy names for a few identifiers
Signed-off-by Martin Peschke <[email protected]>
---
drivers/s390/scsi/zfcp_def.h | 4 include/linux/statistic.h | 27 +++--- lib/statistic.c | 177 ++++++++++++++++++++----------------------- 3 files changed, 100 insertions(+), 108 deletions(-)
include/linux/statistic.h +13 -14
@@ -36,7 +36,7 @@* * Exploiters must setup an array of struct statistic_info for a * corresponding array of struct statistic, which are then pointed to -* by struct statistic_interface. +* by struct statistic_ui. * * Struct statistic_info and all members and addressed strings must stay for * the lifetime of corresponding statistics created with statistic_create().
@@ -108,7 +108,7 @@ struct statistic { };/** -* struct statistic_interface - collection of statistics for an entity +* struct statistic_ui - collection of statistics for an entity * @stat: a struct statistic array * @info: a struct statistic_info array describing the struct statistic array * @number: number of entries in both arrays
@@ -116,29 +116,29 @@ struct statistic {* @label: an optional function retrieving a label for each statistics entry * @private: optional data pointer reserved for use by clients * -* Exploiters must setup a struct statistic_interface prior to calling +* Exploiters must setup a struct statistic_ui prior to calling * statistic_create(). */ -struct statistic_interface { +struct statistic_ui {/* private: */ struct list_head list; -void *debugfs_dir; -void *data_file; -void *def_file; +void *dir; +void *data; +void *def;/* public: */ struct statistic *stat;struct statistic_info *info;int number; -int (*pull)(struct statistic_interface *interface); -void (*label)(struct statistic_interface *interface, +void (*pull)(struct statistic_ui *ui); +void (*label)(struct statistic_ui *ui,int i,void *key,char *buf,int size);void *private; };#ifdef CONFIG_STATISTICS -extern int statistic_create (struct statistic_interface *,const char *); -extern int statistic_remove (struct statistic_interface *); +extern int statistic_create (struct statistic_ui *,const char *); +extern int statistic_remove (struct statistic_ui *);extern void statistic_set (struct statistic *,int ,s64 ,u64 );extern void statistic_set_key (struct statistic *,int ,void *,u64 );
@@ -313,13 +313,12 @@ static inline void statistic_add_as_key(#else /* !CONFIG_STATISTICS */ /* These NOP functions unburden clients from handling !CONFIG_STATISTICS. */ -static inline int statistic_create (struct statistic_interface *interface, -const char *name) +static inline int statistic_create (struct statistic_ui *ui,const char *name) {return 0 ; } -static inline int statistic_remove (struct statistic_interface *interface) +static inline int statistic_remove (struct statistic_ui *ui) {return 0 ; }
lib/statistic.c +85 -92
416 lines not on this page · raw message
drivers/s390/scsi/zfcp_def.h +2 -2
@@ -942,7 +942,7 @@ struct zfcp_adapter {struct fc_host_statistics *fc_stats;struct fsf_qtcb_bottom_port *stats_reset_data;unsigned long stats_reset; -struct statistic_interface stat_if; +struct statistic_ui stat_if;struct statistic stat[_ZFCP_STAT_A_NUMBER]; };
@@ -1006,7 +1006,7 @@ struct zfcp_unit {all scsi_scan_target requests have been completed. */ -struct statistic_interface stat_if; +struct statistic_ui stat_if;struct statistic stat[_ZFCP_STAT_U_NUMBER]; };