]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
cmdmon: rename status constants
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 8 Sep 2020 09:17:48 +0000 (11:17 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 10 Sep 2020 07:36:35 +0000 (09:36 +0200)
Change the naming of reported selection status in the sources report to
better match the internal status.

candm.h
client.c
cmdmon.c
reports.h
sources.c

diff --git a/candm.h b/candm.h
index 34354e3e0bb16754aaa541a29ee1684d8aae6810..2390302abdfcb03da339989ffaa081a0aef01b84 100644 (file)
--- a/candm.h
+++ b/candm.h
@@ -553,12 +553,12 @@ typedef struct {
 #define RPY_SD_MD_PEER   1
 #define RPY_SD_MD_REF    2
 
-#define RPY_SD_ST_SYNC 0
-#define RPY_SD_ST_UNREACH 1
+#define RPY_SD_ST_SELECTED 0
+#define RPY_SD_ST_NONSELECTABLE 1
 #define RPY_SD_ST_FALSETICKER 2
 #define RPY_SD_ST_JITTERY 3
-#define RPY_SD_ST_CANDIDATE 4
-#define RPY_SD_ST_OUTLIER 5
+#define RPY_SD_ST_UNSELECTED 4
+#define RPY_SD_ST_SELECTABLE 5
 
 typedef struct {
   IPAddr ip_addr;
index 35ad83ebaf65addc9fd03a436f21a651ebc15215..03b72c15b765059f1e9884c400028028d383c8f9 100644 (file)
--- a/client.c
+++ b/client.c
@@ -2189,10 +2189,10 @@ process_cmd_sources(char *line)
     }
 
     switch (ntohs(reply.data.source_data.state)) {
-      case RPY_SD_ST_SYNC:
+      case RPY_SD_ST_SELECTED:
         state_ch = '*';
         break;
-      case RPY_SD_ST_UNREACH:
+      case RPY_SD_ST_NONSELECTABLE:
         state_ch = '?';
         break;
       case RPY_SD_ST_FALSETICKER:
@@ -2201,10 +2201,10 @@ process_cmd_sources(char *line)
       case RPY_SD_ST_JITTERY:
         state_ch = '~';
         break;
-      case RPY_SD_ST_CANDIDATE:
+      case RPY_SD_ST_UNSELECTED:
         state_ch = '+';
         break;
-      case RPY_SD_ST_OUTLIER:
+      case RPY_SD_ST_SELECTABLE:
         state_ch = '-';
         break;
       default:
index 171f6fe510f364bb84707c46482eab8dfa423361..08027c9031cb56f71d17b1ef85bf739335cbf717 100644 (file)
--- a/cmdmon.c
+++ b/cmdmon.c
@@ -578,11 +578,8 @@ handle_source_data(CMD_Request *rx_message, CMD_Reply *tx_message)
     tx_message->data.source_data.stratum = htons(report.stratum);
     tx_message->data.source_data.poll    = htons(report.poll);
     switch (report.state) {
-      case RPT_SYNC:
-        tx_message->data.source_data.state   = htons(RPY_SD_ST_SYNC);
-        break;
-      case RPT_UNREACH:
-        tx_message->data.source_data.state   = htons(RPY_SD_ST_UNREACH);
+      case RPT_NONSELECTABLE:
+        tx_message->data.source_data.state   = htons(RPY_SD_ST_NONSELECTABLE);
         break;
       case RPT_FALSETICKER:
         tx_message->data.source_data.state   = htons(RPY_SD_ST_FALSETICKER);
@@ -590,11 +587,14 @@ handle_source_data(CMD_Request *rx_message, CMD_Reply *tx_message)
       case RPT_JITTERY:
         tx_message->data.source_data.state   = htons(RPY_SD_ST_JITTERY);
         break;
-      case RPT_CANDIDATE:
-        tx_message->data.source_data.state   = htons(RPY_SD_ST_CANDIDATE);
+      case RPT_SELECTABLE:
+        tx_message->data.source_data.state   = htons(RPY_SD_ST_SELECTABLE);
+        break;
+      case RPT_UNSELECTED:
+        tx_message->data.source_data.state   = htons(RPY_SD_ST_UNSELECTED);
         break;
-      case RPT_OUTLIER:
-        tx_message->data.source_data.state   = htons(RPY_SD_ST_OUTLIER);
+      case RPT_SELECTED:
+        tx_message->data.source_data.state   = htons(RPY_SD_ST_SELECTED);
         break;
     }
     switch (report.mode) {
index b4a6dfa7d7eb2c6befd402bafe8e8d6409c274c1..9776974f56b90dbeb46ee403f9c61e387aeea300 100644 (file)
--- a/reports.h
+++ b/reports.h
@@ -36,7 +36,14 @@ typedef struct {
   int stratum;
   int poll;
   enum {RPT_NTP_CLIENT, RPT_NTP_PEER, RPT_LOCAL_REFERENCE} mode;
-  enum {RPT_SYNC, RPT_UNREACH, RPT_FALSETICKER, RPT_JITTERY, RPT_CANDIDATE, RPT_OUTLIER} state;
+  enum {
+    RPT_NONSELECTABLE,
+    RPT_FALSETICKER,
+    RPT_JITTERY,
+    RPT_SELECTABLE,
+    RPT_UNSELECTED,
+    RPT_SELECTED,
+  } state;
 
   int reachability;
   unsigned long latest_meas_ago; /* seconds */
index 817aadd99ade205c45fc9c129a7388480dbfcdb9..2ec5a9a02f51d7535cb37f87c94e31701cbf8b61 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -1504,16 +1504,16 @@ SRC_ReportSource(int index, RPT_SourceReport *report, struct timespec *now)
       case SRC_WAITS_UPDATE:
       case SRC_DISTANT:
       case SRC_OUTLIER:
-        report->state = RPT_OUTLIER;
+        report->state = RPT_SELECTABLE;
         break;
       case SRC_UNSELECTED:
-        report->state = RPT_CANDIDATE;
+        report->state = RPT_UNSELECTED;
         break;
       case SRC_SELECTED:
-        report->state = RPT_SYNC;
+        report->state = RPT_SELECTED;
         break;
       default:
-        report->state = RPT_UNREACH;
+        report->state = RPT_NONSELECTABLE;
         break;
     }