config: convert the 'assume_two_step' option to the new scheme.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-08-12 18:47:00 +02:00
parent d4995c6d71
commit 85bbf9d919
3 changed files with 5 additions and 8 deletions

View File

@ -77,6 +77,7 @@ struct config_item {
CONFIG_ITEM_INT(label, 1, _default, min, max) CONFIG_ITEM_INT(label, 1, _default, min, max)
struct config_item config_tab[] = { struct config_item config_tab[] = {
GLOB_ITEM_INT("assume_two_step", 0, 0, 1),
PORT_ITEM_INT("udp_ttl", 1, 1, 255), PORT_ITEM_INT("udp_ttl", 1, 1, 255),
}; };
@ -518,12 +519,6 @@ static enum parser_result parse_global_setting(const char *option,
cfg->dds.freq_est_interval = val; cfg->dds.freq_est_interval = val;
pod->freq_est_interval = val; pod->freq_est_interval = val;
} else if (!strcmp(option, "assume_two_step")) {
r = get_ranged_int(value, &val, 0, 1);
if (r != PARSED_OK)
return r;
*cfg->assume_two_step = val;
} else if (!strcmp(option, "tx_timestamp_timeout")) { } else if (!strcmp(option, "tx_timestamp_timeout")) {
r = get_ranged_int(value, &val, 1, INT_MAX); r = get_ranged_int(value, &val, 1, INT_MAX);
if (r != PARSED_OK) if (r != PARSED_OK)

View File

@ -70,7 +70,6 @@ struct config {
struct default_ds dds; struct default_ds dds;
struct port_defaults pod; struct port_defaults pod;
int *assume_two_step;
int *tx_timestamp_timeout; int *tx_timestamp_timeout;
int *check_fup_sync; int *check_fup_sync;

View File

@ -102,7 +102,6 @@ static struct config cfg_settings = {
.dm = DM_E2E, .dm = DM_E2E,
.transport = TRANS_UDP_IPV4, .transport = TRANS_UDP_IPV4,
.assume_two_step = &assume_two_step,
.tx_timestamp_timeout = &sk_tx_timeout, .tx_timestamp_timeout = &sk_tx_timeout,
.check_fup_sync = &sk_check_fupsync, .check_fup_sync = &sk_check_fupsync,
@ -176,6 +175,7 @@ int main(int argc, char *argv[])
enum transport_type *transport = &cfg_settings.transport; enum transport_type *transport = &cfg_settings.transport;
enum timestamp_type *timestamping = &cfg_settings.timestamping; enum timestamp_type *timestamping = &cfg_settings.timestamping;
struct clock *clock; struct clock *clock;
struct config *cfg = &cfg_settings;
struct defaultDS *ds = &cfg_settings.dds.dds; struct defaultDS *ds = &cfg_settings.dds.dds;
int phc_index = -1, required_modes = 0; int phc_index = -1, required_modes = 0;
@ -279,6 +279,9 @@ int main(int argc, char *argv[])
if (config && (c = config_read(config, &cfg_settings))) { if (config && (c = config_read(config, &cfg_settings))) {
return c; return c;
} }
assume_two_step = config_get_int(cfg, NULL, "assume_two_step");
if (!cfg_settings.dds.grand_master_capable && if (!cfg_settings.dds.grand_master_capable &&
ds->flags & DDS_SLAVE_ONLY) { ds->flags & DDS_SLAVE_ONLY) {
fprintf(stderr, fprintf(stderr,