library: standardize all the 'context' structure names

This patch attempts to standardize the naming of those
most important (declared not defined) context structs.

The present practice represents a hodge podge of names
only some of which reflect the source /proc file name.
And 2 of those file names embed a literal 'info' which
is likely the origin of that required parm identifier.

Now we'll append a universal '_info' to such structure
names, while including the names of those /proc pseudo
files where possible. In any case, that context struct
will *always* begin with the actual module/header file
name. And only the following two sound a little weird!

---------> 'meminfo_info' + 'slabinfo_info' <---------

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-07-21 00:00:00 -05:00 committed by Craig Small
parent 69557ac9dc
commit 82d5661603
12 changed files with 155 additions and 155 deletions

View File

@ -96,7 +96,7 @@ struct fetch_support {
struct diskstats_reap results; // count + stacks for return to caller
};
struct procps_diskstats {
struct diskstats_info {
int refcount;
FILE *diskstats_fp;
time_t old_stamp; /* previous read seconds */
@ -266,7 +266,7 @@ enum diskstats_item PROCPS_DISKSTATS_logical_end = PROCPS_DISKSTATS_DELTA_IO_WTI
// --- dev_node specific support ----------------------------------------------
static struct dev_node *node_add (
struct procps_diskstats *info,
struct diskstats_info *info,
struct dev_node *this)
{
struct dev_node *prev, *walk;
@ -330,7 +330,7 @@ static void node_classify (
static struct dev_node *node_cut (
struct procps_diskstats *info,
struct diskstats_info *info,
struct dev_node *this)
{
struct dev_node *node = info->nodes;
@ -353,7 +353,7 @@ static struct dev_node *node_cut (
static struct dev_node *node_get (
struct procps_diskstats *info,
struct diskstats_info *info,
const char *name)
{
struct dev_node *node = info->nodes;
@ -378,7 +378,7 @@ static struct dev_node *node_get (
static int node_update (
struct procps_diskstats *info,
struct diskstats_info *info,
struct dev_node *source)
{
struct dev_node *target = node_get(info, source->name);
@ -537,7 +537,7 @@ static inline int items_check_failed (
* Returns: 0 on success, negative on error
*/
static int read_diskstats_failed (
struct procps_diskstats *info)
struct diskstats_info *info)
{
static const char *fmtstr = "%d %d %" STRINGIFY(DISKSTATS_NAME_LEN) \
"s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu";
@ -640,7 +640,7 @@ static struct stacks_extent *stacks_alloc (
static int stacks_fetch (
struct procps_diskstats *info)
struct diskstats_info *info)
{
#define n_alloc info->fetch.n_alloc
#define n_inuse info->fetch.n_inuse
@ -738,15 +738,15 @@ static int stacks_reconfig_maybe (
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_diskstats_new (
struct procps_diskstats **info)
struct diskstats_info **info)
{
struct procps_diskstats *p;
struct diskstats_info *p;
int rc;
if (info == NULL)
return -EINVAL;
if (!(p = calloc(1, sizeof(struct procps_diskstats))))
if (!(p = calloc(1, sizeof(struct diskstats_info))))
return -ENOMEM;
p->refcount = 1;
@ -765,7 +765,7 @@ PROCPS_EXPORT int procps_diskstats_new (
PROCPS_EXPORT int procps_diskstats_ref (
struct procps_diskstats *info)
struct diskstats_info *info)
{
if (info == NULL)
return -EINVAL;
@ -776,7 +776,7 @@ PROCPS_EXPORT int procps_diskstats_ref (
PROCPS_EXPORT int procps_diskstats_unref (
struct procps_diskstats **info)
struct diskstats_info **info)
{
struct dev_node *node;
@ -822,7 +822,7 @@ PROCPS_EXPORT int procps_diskstats_unref (
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct diskstats_result *procps_diskstats_get (
struct procps_diskstats *info,
struct diskstats_info *info,
const char *name,
enum diskstats_item item)
{
@ -863,7 +863,7 @@ PROCPS_EXPORT struct diskstats_result *procps_diskstats_get (
* Returns: pointer to a diskstats_reap struct on success, NULL on error.
*/
PROCPS_EXPORT struct diskstats_reap *procps_diskstats_reap (
struct procps_diskstats *info,
struct diskstats_info *info,
enum diskstats_item *items,
int numitems)
{
@ -893,7 +893,7 @@ PROCPS_EXPORT struct diskstats_reap *procps_diskstats_reap (
* Returns: pointer to a diskstats_stack struct on success, NULL on error.
*/
PROCPS_EXPORT struct diskstats_stack *procps_diskstats_select (
struct procps_diskstats *info,
struct diskstats_info *info,
const char *name,
enum diskstats_item *items,
int numitems)
@ -936,7 +936,7 @@ PROCPS_EXPORT struct diskstats_stack *procps_diskstats_select (
* Note: all of the stacks must be homogeneous (of equal length and content).
*/
PROCPS_EXPORT struct diskstats_stack **procps_diskstats_sort (
struct procps_diskstats *info,
struct diskstats_info *info,
struct diskstats_stack *stacks[],
int numstacked,
enum diskstats_item sortitem,

View File

@ -89,37 +89,37 @@ struct diskstats_reap {
#define PROCPS_DISKSTATS_TYPE_DISK -11111
#define PROCPS_DISKSTATS_TYPE_PARTITION -22222
#define PROCPS_DISKSTATS_GET( diskstats, actual_enum, type ) \
procps_diskstats_get( diskstats, actual_enum ) -> result . type
#define PROCPS_DISKSTATS_GET( info, actual_enum, type ) \
procps_diskstats_get( info, actual_enum ) -> result . type
#define PROCPS_DISKSTATS_VAL( relative_enum, type, stack) \
stack -> head [ relative_enum ] . result . type
struct procps_diskstats;
struct diskstats_info;
int procps_diskstats_new (struct procps_diskstats **info);
int procps_diskstats_ref (struct procps_diskstats *info);
int procps_diskstats_unref (struct procps_diskstats **info);
int procps_diskstats_new (struct diskstats_info **info);
int procps_diskstats_ref (struct diskstats_info *info);
int procps_diskstats_unref (struct diskstats_info **info);
struct diskstats_result *procps_diskstats_get (
struct procps_diskstats *info,
struct diskstats_info *info,
const char *name,
enum diskstats_item item);
struct diskstats_reap *procps_diskstats_reap (
struct procps_diskstats *info,
struct diskstats_info *info,
enum diskstats_item *items,
int numitems);
struct diskstats_stack *procps_diskstats_select (
struct procps_diskstats *info,
struct diskstats_info *info,
const char *name,
enum diskstats_item *items,
int numitems);
struct diskstats_stack **procps_diskstats_sort (
struct procps_diskstats *info,
struct diskstats_info *info,
struct diskstats_stack *stacks[],
int numstacked,
enum diskstats_item sortitem,

View File

@ -104,7 +104,7 @@ struct stacks_extent {
struct meminfo_stack **stacks;
};
struct procps_meminfo {
struct meminfo_info {
int refcount;
int meminfo_fd;
int meminfo_was_read;
@ -384,7 +384,7 @@ static inline void cleanup_stack (
static inline void cleanup_stacks_all (
struct procps_meminfo *info)
struct meminfo_info *info)
{
struct stacks_extent *ext = info->extents;
int i;
@ -399,7 +399,7 @@ static inline void cleanup_stacks_all (
static void extents_free_all (
struct procps_meminfo *info)
struct meminfo_info *info)
{
while (info->extents) {
struct stacks_extent *p = info->extents;
@ -457,7 +457,7 @@ static inline int items_check_failed (
static int make_hash_failed (
struct procps_meminfo *info)
struct meminfo_info *info)
{
#define htVAL(f) e.key = STRINGIFY(f) ":"; e.data = &info->hist.new. f; \
if (!hsearch_r(e, ENTER, &ep, &info->hashtab)) return -errno;
@ -535,7 +535,7 @@ static int make_hash_failed (
* into the supplied info structure
*/
static int read_meminfo_failed (
struct procps_meminfo *info)
struct meminfo_info *info)
{
/* a 'memory history reference' macro for readability,
so we can focus the field names ... */
@ -649,7 +649,7 @@ static int read_meminfo_failed (
* Returns a stacks_extent struct anchoring the 'heads' of each new stack.
*/
static struct stacks_extent *stacks_alloc (
struct procps_meminfo *info,
struct meminfo_info *info,
int maxstacks)
{
struct stacks_extent *p_blob;
@ -714,14 +714,14 @@ static struct stacks_extent *stacks_alloc (
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_meminfo_new (
struct procps_meminfo **info)
struct meminfo_info **info)
{
struct procps_meminfo *p;
struct meminfo_info *p;
int rc;
if (info == NULL || *info != NULL)
return -EINVAL;
if (!(p = calloc(1, sizeof(struct procps_meminfo))))
if (!(p = calloc(1, sizeof(struct meminfo_info))))
return -ENOMEM;
p->refcount = 1;
@ -738,7 +738,7 @@ PROCPS_EXPORT int procps_meminfo_new (
PROCPS_EXPORT int procps_meminfo_ref (
struct procps_meminfo *info)
struct meminfo_info *info)
{
if (info == NULL)
return -EINVAL;
@ -749,7 +749,7 @@ PROCPS_EXPORT int procps_meminfo_ref (
PROCPS_EXPORT int procps_meminfo_unref (
struct procps_meminfo **info)
struct meminfo_info **info)
{
if (info == NULL || *info == NULL)
return -EINVAL;
@ -772,7 +772,7 @@ PROCPS_EXPORT int procps_meminfo_unref (
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct meminfo_result *procps_meminfo_get (
struct procps_meminfo *info,
struct meminfo_info *info,
enum meminfo_item item)
{
static time_t sav_secs;
@ -810,7 +810,7 @@ PROCPS_EXPORT struct meminfo_result *procps_meminfo_get (
* Returns: pointer to a meminfo_stack struct on success, NULL on error.
*/
PROCPS_EXPORT struct meminfo_stack *procps_meminfo_select (
struct procps_meminfo *info,
struct meminfo_info *info,
enum meminfo_item *items,
int numitems)
{

View File

@ -135,25 +135,25 @@ struct meminfo_stack {
};
#define PROCPS_MEMINFO_GET( meminfo, actual_enum, type ) \
procps_meminfo_get( meminfo, actual_enum ) -> result . type
#define PROCPS_MEMINFO_GET( info, actual_enum, type ) \
procps_meminfo_get( info, actual_enum ) -> result . type
#define PROCPS_MEMINFO_VAL( relative_enum, type, stack) \
stack -> head [ relative_enum ] . result . type
struct procps_meminfo;
struct meminfo_info;
int procps_meminfo_new (struct procps_meminfo **info);
int procps_meminfo_ref (struct procps_meminfo *info);
int procps_meminfo_unref (struct procps_meminfo **info);
int procps_meminfo_new (struct meminfo_info **info);
int procps_meminfo_ref (struct meminfo_info *info);
int procps_meminfo_unref (struct meminfo_info **info);
struct meminfo_result *procps_meminfo_get (
struct procps_meminfo *info,
struct meminfo_info *info,
enum meminfo_item item);
struct meminfo_stack *procps_meminfo_select (
struct procps_meminfo *info,
struct meminfo_info *info,
enum meminfo_item *items,
int numitems);

View File

@ -66,7 +66,7 @@ struct fetch_support {
struct pids_counts counts; // actual counts pointed to by 'results'
};
struct procps_pidsinfo {
struct pids_info {
int refcount;
int maxitems; // includes 'logical_end' delimiter
int curitems; // includes 'logical_end' delimiter
@ -111,7 +111,7 @@ static char** vectorize_this (const char* src) {
#define setNAME(e) set_results_ ## e
#define setDECL(e) static void setNAME(e) \
(struct procps_pidsinfo *I, struct pids_result *R, proc_t *P)
(struct pids_info *I, struct pids_result *R, proc_t *P)
/* convert pages to kib */
#define CVT_set(e,t,x) setDECL(e) { \
@ -360,7 +360,7 @@ srtDECL(noop) {
#define x_ouser PROC_FILLSTATUS | PROC_FILLUSR
#define x_supgrp PROC_FILLSTATUS | PROC_FILLSUPGRP
typedef void (*SET_t)(struct procps_pidsinfo *, struct pids_result *, proc_t *);
typedef void (*SET_t)(struct pids_info *, struct pids_result *, proc_t *);
typedef void (*FRE_t)(struct pids_result *);
typedef int (*QSR_t)(const void *, const void *, void *);
@ -569,7 +569,7 @@ struct history_info {
static void config_history (
struct procps_pidsinfo *info)
struct pids_info *info)
{
int i;
@ -583,7 +583,7 @@ static void config_history (
static inline HST_t *histget (
struct procps_pidsinfo *info,
struct pids_info *info,
int pid)
{
int V = Hr(PHash_sav[_HASH_PID_(pid)]);
@ -598,7 +598,7 @@ static inline HST_t *histget (
static inline void histput (
struct procps_pidsinfo *info,
struct pids_info *info,
unsigned this)
{
int V = _HASH_PID_(Hr(PHist_new[this].pid));
@ -611,7 +611,7 @@ static inline void histput (
static int make_hist (
struct procps_pidsinfo *info,
struct pids_info *info,
proc_t *p)
{
#define nSLOT info->hist->num_tasks
@ -646,7 +646,7 @@ static int make_hist (
static inline void toggle_history (
struct procps_pidsinfo *info)
struct pids_info *info)
{
void *v;
@ -665,7 +665,7 @@ static inline void toggle_history (
#ifdef UNREF_RPTHASH
static void unref_rpthash (
struct procps_pidsinfo *info)
struct pids_info *info)
{
int i, j, pop, total_occupied, maxdepth, maxdepth_sav, numdepth
, cross_foot, sz = HHASH_SIZE * (int)sizeof(int)
@ -755,7 +755,7 @@ static void unref_rpthash (
// ___ Standard Private Functions |||||||||||||||||||||||||||||||||||||||||||||
static inline void assign_results (
struct procps_pidsinfo *info,
struct pids_info *info,
struct pids_stack *stack,
proc_t *p)
{
@ -790,7 +790,7 @@ static inline void cleanup_stack (
static inline void cleanup_stacks_all (
struct procps_pidsinfo *info)
struct pids_info *info)
{
struct stacks_extent *ext = info->extents;
int i;
@ -809,7 +809,7 @@ static inline void cleanup_stacks_all (
* 'static' or 'invarient' results stacks. By unsplicing an extent
* from the info anchor it will be isolated from future reset/free. */
static struct stacks_extent *extent_cut (
struct procps_pidsinfo *info,
struct pids_info *info,
struct stacks_extent *ext)
{
struct stacks_extent *p = info->extents;
@ -832,7 +832,7 @@ static struct stacks_extent *extent_cut (
static void extents_free_all (
struct procps_pidsinfo *info)
struct pids_info *info)
{
while (info->extents) {
struct stacks_extent *p = info->extents;
@ -860,7 +860,7 @@ static inline struct pids_result *itemize_stack (
static void itemize_stacks_all (
struct procps_pidsinfo *info)
struct pids_info *info)
{
struct stacks_extent *ext = info->extents;
@ -904,7 +904,7 @@ static inline int items_check_failed (
static inline void libflags_set (
struct procps_pidsinfo *info)
struct pids_info *info)
{
enum pids_item e;
int i;
@ -957,7 +957,7 @@ static inline int oldproc_open (
static inline int proc_tally (
struct procps_pidsinfo *info,
struct pids_info *info,
struct pids_counts *counts,
proc_t *p)
{
@ -998,7 +998,7 @@ static inline int proc_tally (
* Returns an array of pointers representing the 'heads' of each new stack.
*/
static struct stacks_extent *stacks_alloc (
struct procps_pidsinfo *info,
struct pids_info *info,
int maxstacks)
{
struct stacks_extent *p_blob;
@ -1048,7 +1048,7 @@ static struct stacks_extent *stacks_alloc (
static int stacks_fetch (
struct procps_pidsinfo *info)
struct pids_info *info)
{
#define n_alloc info->fetch.n_alloc
#define n_inuse info->fetch.n_inuse
@ -1121,18 +1121,18 @@ static int stacks_fetch (
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_pids_new (
struct procps_pidsinfo **info,
struct pids_info **info,
enum pids_item *items,
int numitems)
{
struct procps_pidsinfo *p;
struct pids_info *p;
double uptime_secs;
int pgsz;
if (info == NULL || *info != NULL)
return -EINVAL;
if (!(p = calloc(1, sizeof(struct procps_pidsinfo))))
if (!(p = calloc(1, sizeof(struct pids_info))))
return -ENOMEM;
/* if we're without items or numitems, a later call to
@ -1177,7 +1177,7 @@ PROCPS_EXPORT int procps_pids_new (
PROCPS_EXPORT int procps_pids_ref (
struct procps_pidsinfo *info)
struct pids_info *info)
{
if (info == NULL)
return -EINVAL;
@ -1188,7 +1188,7 @@ PROCPS_EXPORT int procps_pids_ref (
PROCPS_EXPORT int procps_pids_unref (
struct procps_pidsinfo **info)
struct pids_info **info)
{
if (info == NULL || *info == NULL)
return -EINVAL;
@ -1239,14 +1239,14 @@ PROCPS_EXPORT int procps_pids_unref (
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct pids_stack *fatal_proc_unmounted (
struct procps_pidsinfo *info,
struct pids_info *info,
int return_self)
{
static proc_t self;
struct stacks_extent *ext;
/* this is very likely the *only* newlib function where the
context (procps_pidsinfo) of NULL will ever be permitted */
context (pids_info) of NULL will ever be permitted */
look_up_our_self(&self);
if (!return_self)
return NULL;
@ -1273,7 +1273,7 @@ PROCPS_EXPORT struct pids_stack *fatal_proc_unmounted (
PROCPS_EXPORT struct pids_stack *procps_pids_get (
struct procps_pidsinfo *info,
struct pids_info *info,
enum pids_fetch_type which)
{
static proc_t task; // static for initial zeroes + later dynamic free(s)
@ -1326,7 +1326,7 @@ fresh_start:
* Returns: pointer to a pids_fetch struct on success, NULL on error.
*/
PROCPS_EXPORT struct pids_fetch *procps_pids_reap (
struct procps_pidsinfo *info,
struct pids_info *info,
enum pids_fetch_type which)
{
int rc;
@ -1353,7 +1353,7 @@ PROCPS_EXPORT struct pids_fetch *procps_pids_reap (
PROCPS_EXPORT int procps_pids_reset (
struct procps_pidsinfo *info,
struct pids_info *info,
enum pids_item *newitems,
int newnumitems)
{
@ -1401,7 +1401,7 @@ PROCPS_EXPORT int procps_pids_reset (
* Returns: pointer to a pids_fetch struct on success, NULL on error.
*/
PROCPS_EXPORT struct pids_fetch *procps_pids_select (
struct procps_pidsinfo *info,
struct pids_info *info,
unsigned *these,
int numthese,
enum pids_select_type which)
@ -1447,7 +1447,7 @@ PROCPS_EXPORT struct pids_fetch *procps_pids_select (
* Note: all of the stacks must be homogeneous (of equal length and content).
*/
PROCPS_EXPORT struct pids_stack **procps_pids_sort (
struct procps_pidsinfo *info,
struct pids_info *info,
struct pids_stack *stacks[],
int numstacked,
enum pids_item sortitem,

View File

@ -195,37 +195,37 @@ struct pids_fetch {
stack -> head [ relative_enum ] . result . type
struct procps_pidsinfo;
struct pids_info;
int procps_pids_new (struct procps_pidsinfo **info, enum pids_item *items, int numitems);
int procps_pids_ref (struct procps_pidsinfo *info);
int procps_pids_unref (struct procps_pidsinfo **info);
int procps_pids_new (struct pids_info **info, enum pids_item *items, int numitems);
int procps_pids_ref (struct pids_info *info);
int procps_pids_unref (struct pids_info **info);
struct pids_stack *fatal_proc_unmounted (
struct procps_pidsinfo *info,
struct pids_info *info,
int return_self);
struct pids_stack *procps_pids_get (
struct procps_pidsinfo *info,
struct pids_info *info,
enum pids_fetch_type which);
struct pids_fetch *procps_pids_reap (
struct procps_pidsinfo *info,
struct pids_info *info,
enum pids_fetch_type which);
int procps_pids_reset (
struct procps_pidsinfo *info,
struct pids_info *info,
enum pids_item *newitems,
int newnumitems);
struct pids_fetch *procps_pids_select (
struct procps_pidsinfo *info,
struct pids_info *info,
unsigned *these,
int numthese,
enum pids_select_type which);
struct pids_stack **procps_pids_sort (
struct procps_pidsinfo *info,
struct pids_info *info,
struct pids_stack *stacks[],
int numstacked,
enum pids_item sortitem,

View File

@ -118,7 +118,7 @@ struct fetch_support {
struct slabinfo_reap results; // count + stacks for return to caller
};
struct procps_slabinfo {
struct slabinfo_info {
int refcount;
FILE *slabinfo_fp;
int slabinfo_was_read;
@ -311,7 +311,7 @@ enum slabinfo_item PROCPS_SLABINFO_logical_end = PROCPS_SLABNODE_SIZE + 1;
/* Alloc up more slabnode memory, if required
*/
static int alloc_slabnodes (
struct procps_slabinfo *info)
struct slabinfo_info *info)
{
struct slabs_node *new_nodes;
int new_count;
@ -339,7 +339,7 @@ static int alloc_slabnodes (
* constant.
*/
static int get_slabnode (
struct procps_slabinfo *info,
struct slabinfo_info *info,
struct slabs_node **node)
{
int retval;
@ -386,7 +386,7 @@ static int get_slabnode (
* : cpustat <allochit> <allocmiss> <freehit> <freemiss>
*/
static int parse_slabinfo20 (
struct procps_slabinfo *info)
struct slabinfo_info *info)
{
struct slabs_node *node;
char buffer[SLABINFO_LINE_LEN];
@ -459,7 +459,7 @@ static int parse_slabinfo20 (
* Returns: 0 on success, negative on error
*/
static int read_slabinfo_failed (
struct procps_slabinfo *info)
struct slabinfo_info *info)
{
char line[SLABINFO_LINE_LEN];
int retval, major, minor;
@ -682,7 +682,7 @@ static struct stacks_extent *stacks_alloc (
static int stacks_fetch (
struct procps_slabinfo *info)
struct slabinfo_info *info)
{
#define n_alloc info->fetch.n_alloc
#define n_inuse info->fetch.n_inuse
@ -777,15 +777,15 @@ static int stacks_reconfig_maybe (
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_slabinfo_new (
struct procps_slabinfo **info)
struct slabinfo_info **info)
{
struct procps_slabinfo *p;
struct slabinfo_info *p;
int rc;
if (info == NULL)
return -EINVAL;
if (!(p = calloc(1, sizeof(struct procps_slabinfo))))
if (!(p = calloc(1, sizeof(struct slabinfo_info))))
return -ENOMEM;
#ifdef ENFORCE_LOGICAL
@ -811,7 +811,7 @@ PROCPS_EXPORT int procps_slabinfo_new (
PROCPS_EXPORT int procps_slabinfo_ref (
struct procps_slabinfo *info)
struct slabinfo_info *info)
{
if (info == NULL)
return -EINVAL;
@ -822,7 +822,7 @@ PROCPS_EXPORT int procps_slabinfo_ref (
PROCPS_EXPORT int procps_slabinfo_unref (
struct procps_slabinfo **info)
struct slabinfo_info **info)
{
if (info == NULL || *info == NULL)
return -EINVAL;
@ -862,7 +862,7 @@ PROCPS_EXPORT int procps_slabinfo_unref (
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct slabinfo_result *procps_slabinfo_get (
struct procps_slabinfo *info,
struct slabinfo_info *info,
enum slabinfo_item item)
{
static time_t sav_secs;
@ -900,7 +900,7 @@ PROCPS_EXPORT struct slabinfo_result *procps_slabinfo_get (
* Returns: pointer to a slabinfo_reap struct on success, NULL on error.
*/
PROCPS_EXPORT struct slabinfo_reap *procps_slabinfo_reap (
struct procps_slabinfo *info,
struct slabinfo_info *info,
enum slabinfo_item *items,
int numitems)
{
@ -930,7 +930,7 @@ PROCPS_EXPORT struct slabinfo_reap *procps_slabinfo_reap (
* Returns: pointer to a slabinfo_stack struct on success, NULL on error.
*/
PROCPS_EXPORT struct slabinfo_stack *procps_slabinfo_select (
struct procps_slabinfo *info,
struct slabinfo_info *info,
enum slabinfo_item *items,
int numitems)
{
@ -967,7 +967,7 @@ PROCPS_EXPORT struct slabinfo_stack *procps_slabinfo_select (
* Note: all of the stacks must be homogeneous (of equal length and content).
*/
PROCPS_EXPORT struct slabinfo_stack **procps_slabinfo_sort (
struct procps_slabinfo *info,
struct slabinfo_info *info,
struct slabinfo_stack *stacks[],
int numstacked,
enum slabinfo_item sortitem,

View File

@ -95,35 +95,35 @@ struct slabinfo_reap {
};
#define PROCPS_SLABINFO_GET( slabinfo, actual_enum, type ) \
procps_slabinfo_get( slabinfo, actual_enum ) -> result . type
#define PROCPS_SLABINFO_GET( info, actual_enum, type ) \
procps_slabinfo_get( info, actual_enum ) -> result . type
#define PROCPS_SLABINFO_VAL( relative_enum, type, stack ) \
stack -> head [ relative_enum ] . result . type
struct procps_slabinfo;
struct slabinfo_info;
int procps_slabinfo_new (struct procps_slabinfo **info);
int procps_slabinfo_ref (struct procps_slabinfo *info);
int procps_slabinfo_unref (struct procps_slabinfo **info);
int procps_slabinfo_new (struct slabinfo_info **info);
int procps_slabinfo_ref (struct slabinfo_info *info);
int procps_slabinfo_unref (struct slabinfo_info **info);
struct slabinfo_result *procps_slabinfo_get (
struct procps_slabinfo *info,
struct slabinfo_info *info,
enum slabinfo_item item);
struct slabinfo_reap *procps_slabinfo_reap (
struct procps_slabinfo *info,
struct slabinfo_info *info,
enum slabinfo_item *items,
int numitems);
struct slabinfo_stack *procps_slabinfo_select (
struct procps_slabinfo *info,
struct slabinfo_info *info,
enum slabinfo_item *items,
int numitems);
struct slabinfo_stack **procps_slabinfo_sort (
struct procps_slabinfo *info,
struct slabinfo_info *info,
struct slabinfo_stack *stacks[],
int numstacked,
enum slabinfo_item sortitem,

View File

@ -111,7 +111,7 @@ struct reap_support {
struct stat_reap result; // summary + stacks returned to caller
};
struct procps_statinfo {
struct stat_info {
int refcount;
int stat_fd;
int stat_was_read; // is stat file history valid?
@ -382,7 +382,7 @@ static inline int items_check_failed (
static int make_numa_hist (
struct procps_statinfo *info)
struct stat_info *info)
{
#ifndef NUMA_DISABLE
struct hist_tic *cpu_ptr, *nod_ptr;
@ -449,7 +449,7 @@ static int make_numa_hist (
static int read_stat_failed (
struct procps_statinfo *info)
struct stat_info *info)
{
struct hist_tic *sum_ptr, *cpu_ptr;
char buf[8192], *bp, *b;
@ -647,7 +647,7 @@ static struct stacks_extent *stacks_alloc (
static int stacks_fetch_tics (
struct procps_statinfo *info,
struct stat_info *info,
struct reap_support *this)
{
#define n_alloc this->n_alloc
@ -735,7 +735,7 @@ static int stacks_reconfig_maybe (
static struct stat_stack *update_single_stack (
struct procps_statinfo *info,
struct stat_info *info,
struct ext_support *this)
{
if (!this->extents
@ -773,13 +773,13 @@ static struct stat_stack *update_single_stack (
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_stat_new (
struct procps_statinfo **info)
struct stat_info **info)
{
struct procps_statinfo *p;
struct stat_info *p;
if (info == NULL || *info != NULL)
return -EINVAL;
if (!(p = calloc(1, sizeof(struct procps_statinfo))))
if (!(p = calloc(1, sizeof(struct stat_info))))
return -ENOMEM;
p->refcount = 1;
@ -823,7 +823,7 @@ PROCPS_EXPORT int procps_stat_new (
PROCPS_EXPORT int procps_stat_ref (
struct procps_statinfo *info)
struct stat_info *info)
{
if (info == NULL)
return -EINVAL;
@ -834,7 +834,7 @@ PROCPS_EXPORT int procps_stat_ref (
PROCPS_EXPORT int procps_stat_unref (
struct procps_statinfo **info)
struct stat_info **info)
{
if (info == NULL || *info == NULL)
return -EINVAL;
@ -887,7 +887,7 @@ PROCPS_EXPORT int procps_stat_unref (
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct stat_result *procps_stat_get (
struct procps_statinfo *info,
struct stat_info *info,
enum stat_item item)
{
static time_t sav_secs;
@ -925,7 +925,7 @@ PROCPS_EXPORT struct stat_result *procps_stat_get (
* Returns: pointer to a stat_reaped struct on success, NULL on error.
*/
PROCPS_EXPORT struct stat_reaped *procps_stat_reap (
struct procps_statinfo *info,
struct stat_info *info,
enum stat_reap_type what,
enum stat_item *items,
int numitems)
@ -1001,7 +1001,7 @@ PROCPS_EXPORT struct stat_reaped *procps_stat_reap (
* Returns: pointer to a stat_stack struct on success, NULL on error.
*/
PROCPS_EXPORT struct stat_stack *procps_stat_select (
struct procps_statinfo *info,
struct stat_info *info,
enum stat_item *items,
int numitems)
{

View File

@ -97,31 +97,31 @@ struct stat_reaped {
#define PROCPS_STAT_SUMMARY_ID -11111
#define PROCPS_STAT_NODE_INVALID -22222
#define PROCPS_STAT_GET( statinfo, actual_enum, type ) \
procps_stat_get( statinfo, actual_enum ) -> result . type
#define PROCPS_STAT_GET( info, actual_enum, type ) \
procps_stat_get( info, actual_enum ) -> result . type
#define PROCPS_STAT_VAL( relative_enum, type, stack ) \
stack -> head [ relative_enum ] . result . type
struct procps_statinfo;
struct stat_info;
int procps_stat_new (struct procps_statinfo **info);
int procps_stat_ref (struct procps_statinfo *info);
int procps_stat_unref (struct procps_statinfo **info);
int procps_stat_new (struct stat_info **info);
int procps_stat_ref (struct stat_info *info);
int procps_stat_unref (struct stat_info **info);
struct stat_result *procps_stat_get (
struct procps_statinfo *info,
struct stat_info *info,
enum stat_item item);
struct stat_reaped *procps_stat_reap (
struct procps_statinfo *info,
struct stat_info *info,
enum stat_reap_type what,
enum stat_item *items,
int numitems);
struct stat_stack *procps_stat_select (
struct procps_statinfo *info,
struct stat_info *info,
enum stat_item *items,
int numitems);

View File

@ -178,7 +178,7 @@ struct stacks_extent {
struct vmstat_stack **stacks;
};
struct procps_vmstat {
struct vmstat_info {
int refcount;
int vmstat_fd;
int vmstat_was_read;
@ -749,7 +749,7 @@ static inline void cleanup_stack (
static inline void cleanup_stacks_all (
struct procps_vmstat *info)
struct vmstat_info *info)
{
struct stacks_extent *ext = info->extents;
int i;
@ -764,7 +764,7 @@ static inline void cleanup_stacks_all (
static void extents_free_all (
struct procps_vmstat *info)
struct vmstat_info *info)
{
while (info->extents) {
struct stacks_extent *p = info->extents;
@ -822,7 +822,7 @@ static inline int items_check_failed (
static int make_hash_failed (
struct procps_vmstat *info)
struct vmstat_info *info)
{
#define htVAL(f) e.key = STRINGIFY(f); e.data = &info->hist.new. f; \
if (!hsearch_r(e, ENTER, &ep, &info->hashtab)) return -errno;
@ -964,7 +964,7 @@ static int make_hash_failed (
* into the supplied info structure
*/
static int read_vmstat_failed (
struct procps_vmstat *info)
struct vmstat_info *info)
{
char buf[8192];
char *head, *tail;
@ -1045,7 +1045,7 @@ static int read_vmstat_failed (
* Returns a stacks_extent struct anchoring the 'heads' of each new stack.
*/
static struct stacks_extent *stacks_alloc (
struct procps_vmstat *info,
struct vmstat_info *info,
int maxstacks)
{
struct stacks_extent *p_blob;
@ -1110,14 +1110,14 @@ static struct stacks_extent *stacks_alloc (
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_vmstat_new (
struct procps_vmstat **info)
struct vmstat_info **info)
{
struct procps_vmstat *p;
struct vmstat_info *p;
int rc;
if (info == NULL || *info != NULL)
return -EINVAL;
if (!(p = calloc(1, sizeof(struct procps_vmstat))))
if (!(p = calloc(1, sizeof(struct vmstat_info))))
return -ENOMEM;
p->refcount = 1;
@ -1134,7 +1134,7 @@ PROCPS_EXPORT int procps_vmstat_new (
PROCPS_EXPORT int procps_vmstat_ref (
struct procps_vmstat *info)
struct vmstat_info *info)
{
if (info == NULL)
return -EINVAL;
@ -1145,7 +1145,7 @@ PROCPS_EXPORT int procps_vmstat_ref (
PROCPS_EXPORT int procps_vmstat_unref (
struct procps_vmstat **info)
struct vmstat_info **info)
{
if (info == NULL || *info == NULL)
return -EINVAL;
@ -1168,7 +1168,7 @@ PROCPS_EXPORT int procps_vmstat_unref (
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct vmstat_result *procps_vmstat_get (
struct procps_vmstat *info,
struct vmstat_info *info,
enum vmstat_item item)
{
static time_t sav_secs;
@ -1206,7 +1206,7 @@ PROCPS_EXPORT struct vmstat_result *procps_vmstat_get (
* Returns: pointer to a vmstat_stack struct on success, NULL on error.
*/
PROCPS_EXPORT struct vmstat_stack *procps_vmstat_select (
struct procps_vmstat *info,
struct vmstat_info *info,
enum vmstat_item *items,
int numitems)
{

View File

@ -285,25 +285,25 @@ struct vmstat_stack {
};
#define PROCPS_VMSTAT_GET( vmstat, actual_enum, type ) \
procps_vmstat_get( vmstat, actual_enum ) -> result . type
#define PROCPS_VMSTAT_GET( info, actual_enum, type ) \
procps_vmstat_get( info, actual_enum ) -> result . type
#define PROCPS_VMSTAT_VAL( relative_enum, type, stack ) \
stack -> head [ relative_enum ] . result . type
struct procps_vmstat;
struct vmstat_info;
int procps_vmstat_new (struct procps_vmstat **info);
int procps_vmstat_ref (struct procps_vmstat *info);
int procps_vmstat_unref (struct procps_vmstat **info);
int procps_vmstat_new (struct vmstat_info **info);
int procps_vmstat_ref (struct vmstat_info *info);
int procps_vmstat_unref (struct vmstat_info **info);
struct vmstat_result *procps_vmstat_get (
struct procps_vmstat *info,
struct vmstat_info *info,
enum vmstat_item item);
struct vmstat_stack *procps_vmstat_select (
struct procps_vmstat *info,
struct vmstat_info *info,
enum vmstat_item *items,
int numitems);