library: normalize the readstat context structure name

The new library meminfo & vmstat modules use structure
names for their context which exactly mirror the names
of the very /proc/ files whose particulars they yield.

The one exception to this rule was the readstat module
whose struct was named statinfo yet the file was stat.

This commit simply renames that structure (only) so as
to hopefully establish such a naming convention as our
standard going forward. And, it's makes good symmetry.

[ this module's name itself is just perfect as it is ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2015-06-30 00:00:00 -05:00 committed by Craig Small
parent faf6d4dc93
commit e88b11f176
5 changed files with 35 additions and 35 deletions

View File

@ -27,7 +27,7 @@ struct procps_jiffs_private {
// future additions go here, please // future additions go here, please
}; };
struct procps_statinfo { struct procps_stat {
int refcount; int refcount;
int stat_fd; int stat_fd;
struct stat_data data; struct stat_data data;
@ -49,10 +49,10 @@ struct procps_statinfo {
* Returns: a new stat info container * Returns: a new stat info container
*/ */
PROCPS_EXPORT int procps_stat_new ( PROCPS_EXPORT int procps_stat_new (
struct procps_statinfo **info) struct procps_stat **info)
{ {
struct procps_statinfo *v; struct procps_stat *v;
v = calloc(1, sizeof(struct procps_statinfo)); v = calloc(1, sizeof(struct procps_stat));
if (!v) if (!v)
return -ENOMEM; return -ENOMEM;
@ -73,7 +73,7 @@ PROCPS_EXPORT int procps_stat_new (
* If CPU stats only needed, set cpu_only to non-zero * If CPU stats only needed, set cpu_only to non-zero
*/ */
PROCPS_EXPORT int procps_stat_read ( PROCPS_EXPORT int procps_stat_read (
struct procps_statinfo *info, struct procps_stat *info,
const int cpu_only) const int cpu_only)
{ {
char buf[8192]; char buf[8192];
@ -153,7 +153,7 @@ PROCPS_EXPORT int procps_stat_read (
} }
PROCPS_EXPORT int procps_stat_ref ( PROCPS_EXPORT int procps_stat_ref (
struct procps_statinfo *info) struct procps_stat *info)
{ {
if (info == NULL) if (info == NULL)
return -EINVAL; return -EINVAL;
@ -162,7 +162,7 @@ PROCPS_EXPORT int procps_stat_ref (
} }
PROCPS_EXPORT int procps_stat_unref ( PROCPS_EXPORT int procps_stat_unref (
struct procps_statinfo **info) struct procps_stat **info)
{ {
if (info == NULL || *info == NULL) if (info == NULL || *info == NULL)
return -EINVAL; return -EINVAL;
@ -178,7 +178,7 @@ PROCPS_EXPORT int procps_stat_unref (
} }
PROCPS_EXPORT jiff procps_stat_get_cpu ( PROCPS_EXPORT jiff procps_stat_get_cpu (
struct procps_statinfo *info, struct procps_stat *info,
enum procps_cpu_item item) enum procps_cpu_item item)
{ {
switch (item) { switch (item) {
@ -207,7 +207,7 @@ PROCPS_EXPORT jiff procps_stat_get_cpu (
} }
PROCPS_EXPORT int procps_get_cpu_chain ( PROCPS_EXPORT int procps_get_cpu_chain (
struct procps_statinfo *info, struct procps_stat *info,
struct procps_cpu_result *item) struct procps_cpu_result *item)
{ {
if (item == NULL) if (item == NULL)
@ -255,7 +255,7 @@ PROCPS_EXPORT int procps_get_cpu_chain (
} }
PROCPS_EXPORT unsigned int procps_stat_get_sys ( PROCPS_EXPORT unsigned int procps_stat_get_sys (
struct procps_statinfo *info, struct procps_stat *info,
enum procps_stat_item item) enum procps_stat_item item)
{ {
switch (item) { switch (item) {
@ -276,7 +276,7 @@ PROCPS_EXPORT unsigned int procps_stat_get_sys (
} }
PROCPS_EXPORT int procps_stat_get_sys_chain ( PROCPS_EXPORT int procps_stat_get_sys_chain (
struct procps_statinfo *info, struct procps_stat *info,
struct procps_sys_result *item) struct procps_sys_result *item)
{ {
if (item == NULL) if (item == NULL)
@ -324,7 +324,7 @@ PROCPS_EXPORT int procps_stat_get_sys_chain (
* supplied structures upon request. * supplied structures upon request.
*/ */
PROCPS_EXPORT int procps_stat_read_jiffs ( PROCPS_EXPORT int procps_stat_read_jiffs (
struct procps_statinfo *info) struct procps_stat *info)
{ {
#define ALLOCincr 32 #define ALLOCincr 32
struct procps_jiffs_private *sum_ptr, *cpu_ptr; struct procps_jiffs_private *sum_ptr, *cpu_ptr;
@ -413,7 +413,7 @@ reap_em_again:
* This function deals only with the 'current' jiffs counts. * This function deals only with the 'current' jiffs counts.
*/ */
PROCPS_EXPORT int procps_stat_get_jiffs ( PROCPS_EXPORT int procps_stat_get_jiffs (
struct procps_statinfo *info, struct procps_stat *info,
struct procps_jiffs *item, struct procps_jiffs *item,
int which) int which)
{ {
@ -451,7 +451,7 @@ PROCPS_EXPORT int procps_stat_get_jiffs (
* This function deals only with the 'current' jiffs counts. * This function deals only with the 'current' jiffs counts.
*/ */
PROCPS_EXPORT int procps_stat_get_jiffs_all ( PROCPS_EXPORT int procps_stat_get_jiffs_all (
struct procps_statinfo *info, struct procps_stat *info,
struct procps_jiffs *item, struct procps_jiffs *item,
int numitems) int numitems)
{ {
@ -477,7 +477,7 @@ PROCPS_EXPORT int procps_stat_get_jiffs_all (
* This function provides both 'new' and 'old' jiffs counts. * This function provides both 'new' and 'old' jiffs counts.
*/ */
PROCPS_EXPORT int procps_stat_get_jiffs_hist ( PROCPS_EXPORT int procps_stat_get_jiffs_hist (
struct procps_statinfo *info, struct procps_stat *info,
struct procps_jiffs_hist *item, struct procps_jiffs_hist *item,
int which) int which)
{ {
@ -513,7 +513,7 @@ PROCPS_EXPORT int procps_stat_get_jiffs_hist (
* This function provides both 'new' and 'old' jiffs counts. * This function provides both 'new' and 'old' jiffs counts.
*/ */
PROCPS_EXPORT int procps_stat_get_jiffs_hist_all ( PROCPS_EXPORT int procps_stat_get_jiffs_hist_all (
struct procps_statinfo *info, struct procps_stat *info,
struct procps_jiffs_hist *item, struct procps_jiffs_hist *item,
int numitems) int numitems)
{ {

View File

@ -68,24 +68,24 @@ struct procps_sys_result {
struct procps_sys_result *next; struct procps_sys_result *next;
}; };
struct procps_statinfo; struct procps_stat;
int procps_stat_new (struct procps_statinfo **info); int procps_stat_new (struct procps_stat **info);
int procps_stat_read (struct procps_statinfo *info, const int cpu_only); int procps_stat_read (struct procps_stat *info, const int cpu_only);
int procps_stat_read_jiffs (struct procps_statinfo *info); int procps_stat_read_jiffs (struct procps_stat *info);
int procps_stat_ref (struct procps_statinfo *info); int procps_stat_ref (struct procps_stat *info);
int procps_stat_unref (struct procps_statinfo **info); int procps_stat_unref (struct procps_stat **info);
jiff procps_stat_get_cpu (struct procps_statinfo *info, enum procps_cpu_item item); jiff procps_stat_get_cpu (struct procps_stat *info, enum procps_cpu_item item);
int procps_stat_get_cpu_chain (struct procps_statinfo *info, struct procps_cpu_result *item); int procps_stat_get_cpu_chain (struct procps_stat *info, struct procps_cpu_result *item);
int procps_stat_get_jiffs (struct procps_statinfo *info, struct procps_jiffs *item, int which); int procps_stat_get_jiffs (struct procps_stat *info, struct procps_jiffs *item, int which);
int procps_stat_get_jiffs_all (struct procps_statinfo *info, struct procps_jiffs *item, int numitems); int procps_stat_get_jiffs_all (struct procps_stat *info, struct procps_jiffs *item, int numitems);
int procps_stat_get_jiffs_hist (struct procps_statinfo *info, struct procps_jiffs_hist *item, int which); int procps_stat_get_jiffs_hist (struct procps_stat *info, struct procps_jiffs_hist *item, int which);
int procps_stat_get_jiffs_hist_all (struct procps_statinfo *info, struct procps_jiffs_hist *item, int numitems); int procps_stat_get_jiffs_hist_all (struct procps_stat *info, struct procps_jiffs_hist *item, int numitems);
unsigned int procps_stat_get_sys (struct procps_statinfo *info, enum procps_stat_item item); unsigned int procps_stat_get_sys (struct procps_stat *info, enum procps_stat_item item);
int procps_stat_get_sys_chain (struct procps_statinfo *info, struct procps_sys_result *item); int procps_stat_get_sys_chain (struct procps_stat *info, struct procps_sys_result *item);
__END_DECLS __END_DECLS
#endif #endif

View File

@ -98,7 +98,7 @@ extern long Hertz;
static void get_boot_time(void) static void get_boot_time(void)
{ {
struct procps_statinfo *sys_info; struct procps_stat *sys_info;
if (procps_stat_new(&sys_info) < 0) if (procps_stat_new(&sys_info) < 0)
xerrx(EXIT_FAILURE, xerrx(EXIT_FAILURE,
_("Unable to create system stat structure")); _("Unable to create system stat structure"));

View File

@ -269,7 +269,7 @@ enum mem_enums {
}; };
#define MEM_VAL(e) mem_chain[e].result #define MEM_VAL(e) mem_chain[e].result
static struct procps_statinfo *sys_info; static struct procps_stat *sys_info;
static struct procps_jiffs_hist *Cpu_jiffs; static struct procps_jiffs_hist *Cpu_jiffs;
/*###### Sort callbacks ################################################*/ /*###### Sort callbacks ################################################*/

View File

@ -298,7 +298,7 @@ static void new_format(void)
time_t the_time; time_t the_time;
char timebuf[32]; char timebuf[32];
struct procps_vmstat *vm_info; struct procps_vmstat *vm_info;
struct procps_statinfo *sys_info; struct procps_stat *sys_info;
struct procps_meminfo *mem_info; struct procps_meminfo *mem_info;
sleep_half = (sleep_time / 2); sleep_half = (sleep_time / 2);
@ -837,7 +837,7 @@ static void disksum_format(void)
static void sum_format(void) static void sum_format(void)
{ {
struct procps_statinfo *sys_info; struct procps_stat *sys_info;
struct procps_vmstat *vm_info; struct procps_vmstat *vm_info;
struct procps_meminfo *mem_info; struct procps_meminfo *mem_info;
@ -896,7 +896,7 @@ static void sum_format(void)
static void fork_format(void) static void fork_format(void)
{ {
struct procps_statinfo *sys_info; struct procps_stat *sys_info;
if (procps_stat_new(&sys_info) < 0) if (procps_stat_new(&sys_info) < 0)
xerrx(EXIT_FAILURE, xerrx(EXIT_FAILURE,