related: change for lost 'PROCPS_' enumerator prefixes

With this patch we've completed a progression toward a
standard approach to naming conventions which follows:

* Only functions will begin with that 'procps_' prefix
. ........................................... examples
. procps_vmstat_get ()
. procps_diskstats_select ()
- ----------------------------------------------------

* Exposed structures begin with the module/header name
. ........................................... examples
. struct pids_info
. struct stat_reaped
- ----------------------------------------------------

* Item enumerators begin like structs, but capitalized
. ........................................... examples
. VMSTAT_COMPACT_FAIL
. MEMINFO_DELTA_ACTIVE

[ slabinfo varies slightly due to some item variants ]
. SLABINFO_extra
. SLABS_SIZE_ACTIVE
. SLABNODE_OBJS_PER_SLAB
[ could cure with a prefix of SLABINFO, but too long ]
- ----------------------------------------------------

* Other enumerators work exactly like item enumerators
. ........................................... examples
. PIDS_SORT_ASCEND
. STAT_REAP_CPUS_AND_NODES
- ----------------------------------------------------

* Macros and constants begin just like the enumerators
. ........................................... examples
. #define SLABINFO_GET
. #define DISKSTATS_TYPE_DISK
- ----------------------------------------------------

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 c4d097c709
commit 612f36189e
15 changed files with 599 additions and 600 deletions

22
skill.c
View File

@ -70,12 +70,12 @@ thing##s[thing##_count++] = addme; \
}while(0)
enum pids_item items[] = {
PROCPS_PIDS_ID_PID,
PROCPS_PIDS_ID_EUID,
PROCPS_PIDS_ID_EUSER,
PROCPS_PIDS_TTY,
PROCPS_PIDS_TTY_NAME,
PROCPS_PIDS_CMD};
PIDS_ID_PID,
PIDS_ID_EUID,
PIDS_ID_EUSER,
PIDS_TTY,
PIDS_TTY_NAME,
PIDS_CMD};
enum rel_items {
EU_PID, EU_EUID, EU_EUSER, EU_TTY, EU_TTYNAME, EU_CMD};
@ -164,8 +164,8 @@ static int match_ns(const int pid)
static int ask_user(struct pids_stack *stack)
{
#define PIDS_GETINT(e) PROCPS_PIDS_VAL(EU_ ## e, s_int, stack)
#define PIDS_GETSTR(e) PROCPS_PIDS_VAL(EU_ ## e, str, stack)
#define PIDS_GETINT(e) PIDS_VAL(EU_ ## e, s_int, stack)
#define PIDS_GETSTR(e) PIDS_VAL(EU_ ## e, str, stack)
char *buf=NULL;
size_t len=0;
@ -262,8 +262,8 @@ static void show_lists(void)
static void scan_procs(struct run_time_conf_t *run_time)
{
#define PIDS_GETINT(e) PROCPS_PIDS_VAL(EU_ ## e, s_int, reap->stacks[i])
#define PIDS_GETSTR(e) PROCPS_PIDS_VAL(EU_ ## e, str, reap->stacks[i])
#define PIDS_GETINT(e) PIDS_VAL(EU_ ## e, s_int, reap->stacks[i])
#define PIDS_GETSTR(e) PIDS_VAL(EU_ ## e, str, reap->stacks[i])
struct pids_info *info=NULL;
struct pids_fetch *reap;
int i, total_procs;
@ -271,7 +271,7 @@ static void scan_procs(struct run_time_conf_t *run_time)
if (procps_pids_new(&info, items, 6) < 0)
xerrx(EXIT_FAILURE,
_("Unable to create pid info structure"));
if ((reap = procps_pids_reap(info, PROCPS_FETCH_TASKS_ONLY)) == NULL)
if ((reap = procps_pids_reap(info, PIDS_FETCH_TASKS_ONLY)) == NULL)
xerrx(EXIT_FAILURE,
_("Unable to load process information"));