library: fixed miscellaneous whitespace/comment issues

. ensure whitespace exists between the code & comments
[ changing txt slightly keeps right margin alignment ]

. strive for more consistency with some comment styles
[ don't use C '/*' style where C++ '//' style exists ]

. removed the instance of double space in 1 assignment
[ still striving for consistency in whitespace usage ]

. fixed comment relating to number of 'derived fields'
[ the <meminfo> api recently added one new such enum ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2017-09-21 00:00:00 -05:00 committed by Craig Small
parent 89775d5418
commit 28f405689c
4 changed files with 83 additions and 83 deletions

View File

@ -99,13 +99,13 @@ struct fetch_support {
struct diskstats_info {
int refcount;
FILE *diskstats_fp;
time_t old_stamp; /* previous read seconds */
time_t new_stamp; /* current read seconds */
struct dev_node *nodes; /* dev nodes anchor */
struct ext_support select_ext; /* supports concurrent select/reap */
struct ext_support fetch_ext; /* supports concurrent select/reap */
struct fetch_support fetch; /* support for procps_diskstats_reap */
struct diskstats_result get_this; /* used by procps_diskstats_get */
time_t old_stamp; // previous read seconds
time_t new_stamp; // current read seconds
struct dev_node *nodes; // dev nodes anchor
struct ext_support select_ext; // supports concurrent select/reap
struct ext_support fetch_ext; // supports concurrent select/reap
struct fetch_support fetch; // support for procps_diskstats_reap
struct diskstats_result get_this; // used by procps_diskstats_get
};

View File

@ -495,7 +495,7 @@ static int meminfo_make_hash_failed (
ENTRY e, *ep;
size_t n;
// will also include those 4 derived fields (more is better)
// will also include those derived fields (more is better)
n = sizeof(struct meminfo_data) / sizeof(unsigned long);
// we'll follow the hsearch recommendation of an extra 25%
hcreate_r(n + (n / 4), &info->hashtab);
@ -700,9 +700,9 @@ static struct stacks_extent *meminfo_stacks_alloc (
blob_size += head_size * maxstacks; // plus room for head thing |
blob_size += list_size * maxstacks; // plus room for our stacks |
/* note: all of our memory is allocated in a single blob, facilitating a later free(). |
as a minimum, it is important that the result structures themselves always be |
contiguous for every stack since they are accessed through relative position. | */
/* note: all of this memory is allocated in a single blob, facilitating a later free(). |
as a minimum, it is important that the result structures themselves always are |
contiguous within each stack since they're accessed through relative position. | */
if (NULL == (p_blob = calloc(1, blob_size)))
return NULL;

View File

@ -61,31 +61,31 @@
struct slabs_summ {
unsigned int nr_objs; /* number of objects, among all caches */
unsigned int nr_active_objs; /* number of active objects, among all caches */
unsigned int nr_pages; /* number of pages consumed by all objects */
unsigned int nr_slabs; /* number of slabs, among all caches */
unsigned int nr_active_slabs; /* number of active slabs, among all caches */
unsigned int nr_caches; /* number of caches */
unsigned int nr_active_caches; /* number of active caches */
unsigned int avg_obj_size; /* average object size */
unsigned int min_obj_size; /* size of smallest object */
unsigned int max_obj_size; /* size of largest object */
unsigned long active_size; /* size of all active objects */
unsigned long total_size; /* size of all objects */
unsigned int nr_objs; // number of objects, among all caches
unsigned int nr_active_objs; // number of active objects, among all caches
unsigned int nr_pages; // number of pages consumed by all objects
unsigned int nr_slabs; // number of slabs, among all caches
unsigned int nr_active_slabs; // number of active slabs, among all caches
unsigned int nr_caches; // number of caches
unsigned int nr_active_caches; // number of active caches
unsigned int avg_obj_size; // average object size
unsigned int min_obj_size; // size of smallest object
unsigned int max_obj_size; // size of largest object
unsigned long active_size; // size of all active objects
unsigned long total_size; // size of all objects
};
struct slabs_node {
char name[SLABINFO_NAME_LEN]; /* name of this cache */
unsigned long cache_size; /* size of entire cache */
unsigned int nr_objs; /* number of objects in this cache */
unsigned int nr_active_objs; /* number of active objects */
unsigned int obj_size; /* size of each object */
unsigned int objs_per_slab; /* number of objects per slab */
unsigned int pages_per_slab; /* number of pages per slab */
unsigned int nr_slabs; /* number of slabs in this cache */
unsigned int nr_active_slabs; /* number of active slabs */
unsigned int use; /* percent full: total / active */
char name[SLABINFO_NAME_LEN]; // name of this cache
unsigned long cache_size; // size of entire cache
unsigned int nr_objs; // number of objects in this cache
unsigned int nr_active_objs; // number of active objects
unsigned int obj_size; // size of each object
unsigned int objs_per_slab; // number of objects per slab
unsigned int pages_per_slab; // number of pages per slab
unsigned int nr_slabs; // number of slabs in this cache
unsigned int nr_active_slabs; // number of active slabs
unsigned int use; // percent full: total / active
};
struct slabs_hist {
@ -121,15 +121,15 @@ struct fetch_support {
struct slabinfo_info {
int refcount;
FILE *slabinfo_fp;
int nodes_alloc; /* nodes alloc()ed */
int nodes_used; /* nodes using alloced memory */
struct slabs_node *nodes; /* first slabnode of this list */
struct slabs_hist slabs; /* new/old slabs_summ data */
struct ext_support select_ext; /* supports concurrent select/reap */
struct ext_support fetch_ext; /* supports concurrent select/reap */
struct fetch_support fetch; /* support for procps_slabinfo_reap */
struct slabs_node nul_node; /* used by slabinfo_get/select */
struct slabinfo_result get_this; /* used by slabinfo_get */
int nodes_alloc; // nodes alloc()ed
int nodes_used; // nodes using alloced memory
struct slabs_node *nodes; // first slabnode of this list
struct slabs_hist slabs; // new/old slabs_summ data
struct ext_support select_ext; // supports concurrent select/reap
struct ext_support fetch_ext; // supports concurrent select/reap
struct fetch_support fetch; // support for procps_slabinfo_reap
struct slabs_node nul_node; // used by slabinfo_get/select
struct slabinfo_result get_this; // used by slabinfo_get
};
@ -660,15 +660,15 @@ static struct stacks_extent *slabinfo_stacks_alloc (
vect_size = sizeof(void *) * maxstacks; // size of the addr vectors |
vect_size += sizeof(void *); // plus NULL addr delimiter |
head_size = sizeof(struct slabinfo_stack); // size of that head struct |
list_size = sizeof(struct slabinfo_result)*this->numitems;// any single results stack |
list_size = sizeof(struct slabinfo_result)*this->numitems; // any single results stack |
blob_size = sizeof(struct stacks_extent); // the extent anchor itself |
blob_size += vect_size; // plus room for addr vects |
blob_size += head_size * maxstacks; // plus room for head thing |
blob_size += list_size * maxstacks; // plus room for our stacks |
/* note: all of our memory is allocated in a single blob, facilitating a later free(). |
as a minimum, it is important that the result structures themselves always be |
contiguous for every stack since they are accessed through relative position. | */
/* note: all of our memory is allocated in one single blob, facilitating a later free(). |
as a minimum, it is important that those result structures themselves always be |
contiguous within each stack since they are accessed through relative position. | */
if (NULL == (p_blob = calloc(1, blob_size)))
return NULL;