From 0aff268a4e023cdbeddc0e9ac75d4c5297f3070e Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 15 Aug 2015 14:29:04 +0200 Subject: [PATCH] config: convert 'kernel_leap' 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 c64fdaa..1d5e2b6 100644 --- a/clock.c +++ b/clock.c @@ -827,7 +827,7 @@ struct clock *clock_create(struct config *config, int phc_index, 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 = config_get_int(config, NULL, "gmCapable"); - c->kernel_leap = dds->kernel_leap; + c->kernel_leap = config_get_int(config, NULL, "kernel_leap"); c->utc_offset = CURRENT_UTC_OFFSET; c->time_source = dds->time_source; c->desc = dds->clock_desc; diff --git a/config.c b/config.c index f97cd2d..3ad052f 100644 --- a/config.c +++ b/config.c @@ -104,6 +104,7 @@ struct config_item config_tab[] = { PORT_ITEM_INT("freq_est_interval", 1, 0, INT_MAX), GLOB_ITEM_INT("gmCapable", 1, 0, 1), PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX), + GLOB_ITEM_INT("kernel_leap", 1, 0, 1), PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX), PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX), PORT_ITEM_INT("logMinPdelayReqInterval", 0, INT8_MIN, INT8_MAX), @@ -553,12 +554,6 @@ static enum parser_result parse_global_setting(const char *option, for (i = 0; i < OUI_LEN; i++) cfg->dds.clock_desc.manufacturerIdentity[i] = oui[i]; - } else if (!strcmp(option, "kernel_leap")) { - r = get_ranged_int(value, &val, 0, 1); - if (r != PARSED_OK) - return r; - cfg->dds.kernel_leap = val; - } else if (!strcmp(option, "timeSource")) { r = get_ranged_int(value, &val, 0x10, 0xfe); if (r != PARSED_OK) diff --git a/ds.h b/ds.h index b2802cf..1f48cc1 100644 --- a/ds.h +++ b/ds.h @@ -52,7 +52,6 @@ struct clock_description { struct default_ds { struct defaultDS dds; - int kernel_leap; int sanity_freq_limit; int time_source; struct clock_description clock_desc; diff --git a/ptp4l.c b/ptp4l.c index 30c43a9..43a5523 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -52,7 +52,6 @@ static struct config cfg_settings = { .priority2 = 128, .domainNumber = 0, }, - .kernel_leap = 1, .sanity_freq_limit = 200000000, .time_source = INTERNAL_OSCILLATOR, .clock_desc = { @@ -246,7 +245,7 @@ int main(int argc, char *argv[]) ds->clockQuality.clockClass = 255; } if (cfg_settings.clock_servo == CLOCK_SERVO_NTPSHM) { - cfg_settings.dds.kernel_leap = 0; + config_set_int(cfg, "kernel_leap", 0); cfg_settings.dds.sanity_freq_limit = 0; }