From 5eeea1365227b8bfb94bf78d5a5727f3b1216078 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 15 Aug 2015 14:11:17 +0200 Subject: [PATCH] config: convert 'free_running' to the new scheme. Signed-off-by: Richard Cochran --- clock.c | 2 +- config.c | 7 +------ ds.h | 1 - ptp4l.c | 3 +-- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/clock.c b/clock.c index 73cf016..8c20d64 100644 --- a/clock.c +++ b/clock.c @@ -824,7 +824,7 @@ struct clock *clock_create(struct config *config, int phc_index, } c->config = config; - c->free_running = dds->free_running; + c->free_running = config_get_int(config, NULL, "free_running"); c->freq_est_interval = config_get_int(config, NULL, "freq_est_interval"); c->grand_master_capable = dds->grand_master_capable; c->kernel_leap = dds->kernel_leap; diff --git a/config.c b/config.c index d0451e3..8049045 100644 --- a/config.c +++ b/config.c @@ -100,6 +100,7 @@ struct config_item config_tab[] = { PORT_ITEM_INT("egressLatency", 0, INT_MIN, INT_MAX), GLOB_ITEM_DBL("first_step_threshold", 0.00002, 0.0, DBL_MAX), PORT_ITEM_INT("follow_up_info", 0, 0, 1), + GLOB_ITEM_INT("free_running", 0, 0, 1), PORT_ITEM_INT("freq_est_interval", 1, 0, INT_MAX), PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX), PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX), @@ -454,12 +455,6 @@ static enum parser_result parse_global_setting(const char *option, return r; dds->clockQuality.offsetScaledLogVariance = uval; - } else if (!strcmp(option, "free_running")) { - r = get_ranged_int(value, &val, 0, 1); - if (r != PARSED_OK) - return r; - cfg->dds.free_running = val; - } else if (!strcmp(option, "sanity_freq_limit")) { r = get_ranged_int(value, &val, 0, INT_MAX); if (r != PARSED_OK) diff --git a/ds.h b/ds.h index b252f39..963a033 100644 --- a/ds.h +++ b/ds.h @@ -52,7 +52,6 @@ struct clock_description { struct default_ds { struct defaultDS dds; - int free_running; int grand_master_capable; /*802.1AS only*/ int stats_interval; /*log seconds*/ int kernel_leap; diff --git a/ptp4l.c b/ptp4l.c index 0da5b1a..b6cd815 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -52,7 +52,6 @@ static struct config cfg_settings = { .priority2 = 128, .domainNumber = 0, }, - .free_running = 0, .grand_master_capable = 1, .stats_interval = 0, .kernel_leap = 1, @@ -313,7 +312,7 @@ int main(int argc, char *argv[]) /* determine PHC Clock index */ iface = STAILQ_FIRST(&cfg_settings.interfaces); - if (cfg_settings.dds.free_running) { + if (config_get_int(cfg, NULL, "free_running")) { phc_index = -1; } else if (*timestamping == TS_SOFTWARE || *timestamping == TS_LEGACY_HW) { phc_index = -1;