Commit 5baefbaa authored by Alessandro Rubini's avatar Alessandro Rubini

general: rename flags to d_flags (they are for diagnostics only)

I'm going to introduce a "flags" field in pp_instance, so diagnostic
flags are better called d_flags. The same applies, for consistency,
to the global variable.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent d0de8bbc
......@@ -35,7 +35,7 @@
@setchapternewpage off
@set update-month July 2014
@set update-month November 2014
@set release __RELEASE_GIT_ID__
@finalout
......@@ -356,7 +356,8 @@ unfair to hide them.
We want to allow run-time modification of diagnostics flags
with a per-link granularity. Currently we have configuration-based
per-link diagnostic flags and global flags that can be changed
per-link diagnostic flags and global diagnostic
flags that can be changed
at run time (for example, arch-wrpc offers that through a shell
command). We think this feature is useful
when you run more than a pair of interfaces and have problems
......
......@@ -6,7 +6,7 @@
*/
#include <ppsi/ppsi.h>
unsigned long pp_global_flags; /* This is the only "global" file in ppsi */
unsigned long pp_global_d_flags; /* This is the only "global" file in ppsi */
/*
* This is somehow a duplicate of __pp_diag, but I still want
......@@ -17,15 +17,15 @@ static void pp_fsm_printf(struct pp_instance *ppi, char *fmt, ...)
{
va_list args;
TimeInternal t;
unsigned long oflags = pp_global_flags;
unsigned long oflags = pp_global_d_flags;
if (!pp_diag_allow(ppi, fsm, 1))
return;
/* temporarily set NOTIMELOG, as we'll print the time ourselves */
pp_global_flags |= PP_FLAG_NOTIMELOG;
pp_global_d_flags |= PP_FLAG_NOTIMELOG;
ppi->t_ops->get(ppi, &t);
pp_global_flags = oflags;
pp_global_d_flags = oflags;
pp_printf("diag-fsm-1-%s: %09d.%03d: ", ppi->port_name,
(int)t.seconds, (int)t.nanoseconds / 1000000);
......
......@@ -6,8 +6,8 @@
#define pp_error(...) pp_printf("ERROR: " __VA_ARGS__)
/*
* The "new" diagnostics is based on flags: there are per-instance flags
* and global flags.
* The "new" diagnostics is based on flags: there are per-instance d_flags
* and global d_flags.
*
* Basically, we may have just bits about what to print, but we might
* want to add extra-verbose stuff for specific cases, like looking at
......@@ -37,17 +37,17 @@ enum pp_diag_things {
/*
* Note: we may use less bits and have more things, without changing
* anything. Set's say levels are ony 0..3 -- still,I prefer to be
* able to print the active flags as %x while debugging this very
* able to print the active d_flags as %x while debugging this very
* mechanism).
*/
extern unsigned long pp_global_flags; /* Supplement ppi-specific ones */
extern unsigned long pp_global_d_flags; /* Supplement ppi-specific ones */
#define PP_FLAG_NOTIMELOG 1 /* This is for a special case, I'm sorry */
/* So, extract the level */
#define __PP_FLAGS(ppi) ((ppi ? ppi->flags : 0) | pp_global_flags)
#define __PP_FLAGS(ppi) ((ppi ? ppi->d_flags : 0) | pp_global_d_flags)
#define __PP_DIAG_ALLOW(ppi, th, level) \
((__PP_FLAGS(ppi) >> (4 * (th)) & 0xf) >= level)
......
......@@ -140,7 +140,7 @@ struct pp_instance {
int next_state, next_delay, is_new_state; /* set by state processing */
void *arch_data; /* if arch needs it */
void *ext_data; /* if protocol ext needs it */
unsigned long flags; /* ppi-specific flags (diag mainly) */
unsigned long d_flags; /* diagnostics, ppi-specific flags */
/* Pointer to global instance owning this pp_instance*/
struct pp_globals *glbs;
......
......@@ -110,7 +110,7 @@ int pp_parse_cmdline(struct pp_globals *ppg, int argc, char **argv)
case 'd':
/* Use the general flags, per-instance TBD */
a = argv[++i];
pp_global_flags = pp_diag_parse(a);
pp_global_d_flags = pp_diag_parse(a);
break;
case 'C':
if (pp_config_string(ppg, argv[++i]) != 0)
......
......@@ -112,9 +112,9 @@ static int f_diag(int lineno, struct pp_globals *ppg, union pp_cfg_arg *arg)
unsigned long level = pp_diag_parse(arg->s);
if (ppg->cfg.cur_ppi_n >= 0)
CUR_PPI(ppg)->flags = level;
CUR_PPI(ppg)->d_flags = level;
else
pp_global_flags = level;
pp_global_d_flags = level;
return 0;
}
......
......@@ -260,7 +260,7 @@ int wr_servo_update(struct pp_instance *ppi)
got_sync = 0;
if (__PP_DIAG_ALLOW_FLAGS(pp_global_flags, pp_dt_servo, 1)) {
if (__PP_DIAG_ALLOW_FLAGS(pp_global_d_flags, pp_dt_servo, 1)) {
dump_timestamp(ppi, "servo:t1", s->t1);
dump_timestamp(ppi, "servo:t2", s->t2);
dump_timestamp(ppi, "servo:t3", s->t3);
......
......@@ -19,7 +19,7 @@ static int bare_time_get(struct pp_instance *ppi, TimeInternal *t)
/* TAI = UTC + 35 */
t->seconds = tv.tv_sec + DSPRO(ppi)->currentUtcOffset;
t->nanoseconds = tv.tv_usec * 1000;
if (!(pp_global_flags & PP_FLAG_NOTIMELOG))
if (!(pp_global_d_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: %9li.%06li\n", __func__,
tv.tv_sec, tv.tv_usec);
return 0;
......
......@@ -54,7 +54,7 @@ static int sim_time_get(struct pp_instance *ppi, TimeInternal *t)
(long long)PP_NSEC_PER_SEC;
t->correct = 1;
if (!(pp_global_flags & PP_FLAG_NOTIMELOG))
if (!(pp_global_d_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: %9li.%09li\n", __func__,
(long)t->seconds, (long)t->nanoseconds);
return 0;
......
......@@ -32,7 +32,7 @@ static int unix_time_get(struct pp_instance *ppi, TimeInternal *t)
t->seconds = tp.tv_sec + DSPRO(ppi)->currentUtcOffset;
t->nanoseconds = tp.tv_nsec;
t->correct = 1;
if (!(pp_global_flags & PP_FLAG_NOTIMELOG))
if (!(pp_global_d_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: %9li.%09li\n", __func__,
tp.tv_sec, tp.tv_nsec);
return 0;
......
......@@ -18,7 +18,7 @@ static int wrpc_time_get(struct pp_instance *ppi, TimeInternal *t)
t->seconds = sec;
t->nanoseconds = nsec;
if (!(pp_global_flags & PP_FLAG_NOTIMELOG))
if (!(pp_global_d_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: %9lu.%09li\n", __func__,
(long)sec, (long)nsec);
return 0;
......
......@@ -176,7 +176,7 @@ static int wrs_time_get(struct pp_instance *ppi, TimeInternal *t)
t->nanoseconds = p.current_nsec;
t->correct = p.pps_valid;
if (!(pp_global_flags & PP_FLAG_NOTIMELOG))
if (!(pp_global_d_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: (valid %x) %9li.%09li\n", __func__,
p.pps_valid,
(long)p.current_sec, (long)p.current_nsec);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment