From a7db9bad3790e29689c16a5c6b5aeb6fd4e2c719 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Thu, 13 Aug 2015 22:33:23 +0200 Subject: [PATCH] config: convert 'verbose' to the new scheme. Signed-off-by: Richard Cochran --- config.c | 8 +------- config.h | 3 --- ptp4l.c | 7 ++----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/config.c b/config.c index 90d7659..b649cf0 100644 --- a/config.c +++ b/config.c @@ -100,6 +100,7 @@ struct config_item config_tab[] = { GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX), PORT_ITEM_INT("udp_ttl", 1, 1, 255), GLOB_ITEM_INT("use_syslog", 1, 0, 1), + GLOB_ITEM_INT("verbose", 0, 0, 1), }; static struct config_item *config_section_item(struct config *cfg, @@ -625,13 +626,6 @@ static enum parser_result parse_global_setting(const char *option, return OUT_OF_RANGE; strncpy(cfg->uds_address, value, MAX_IFNAME_SIZE); - } else if (!strcmp(option, "verbose")) { - r = get_ranged_int(value, &val, 0, 1); - if (r != PARSED_OK) - return r; - if (!(cfg_ignore & CFG_IGNORE_VERBOSE)) - cfg->verbose = val; - } else if (!strcmp(option, "time_stamping")) { if (!(cfg_ignore & CFG_IGNORE_TIMESTAMPING)) { if (0 == strcasecmp("hardware", value)) diff --git a/config.h b/config.h index c456ea0..db7963f 100644 --- a/config.h +++ b/config.h @@ -49,7 +49,6 @@ struct interface { #define CFG_IGNORE_TRANSPORT (1 << 1) #define CFG_IGNORE_TIMESTAMPING (1 << 2) #define CFG_IGNORE_SLAVEONLY (1 << 3) -#define CFG_IGNORE_VERBOSE (1 << 6) struct config { /* configuration override */ @@ -84,8 +83,6 @@ struct config { unsigned char *p2p_dst_mac; unsigned char *udp6_scope; char *uds_address; - - int verbose; }; int config_read(char *name, struct config *cfg); diff --git a/ptp4l.c b/ptp4l.c index 3e34079..78261a9 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -118,8 +118,6 @@ static struct config cfg_settings = { .udp6_scope = &udp6_scope, .uds_address = uds_path, - .verbose = 0, - .cfg_ignore = 0, }; @@ -244,8 +242,7 @@ int main(int argc, char *argv[]) config_set_int(cfg, "logging_level", print_level); break; case 'm': - cfg_settings.verbose = 1; - *cfg_ignore |= CFG_IGNORE_VERBOSE; + config_set_int(cfg, "verbose", 1); break; case 'q': config_set_int(cfg, "use_syslog", 0); @@ -289,7 +286,7 @@ int main(int argc, char *argv[]) } print_set_progname(progname); - print_set_verbose(cfg_settings.verbose); + print_set_verbose(config_get_int(cfg, NULL, "verbose")); print_set_syslog(config_get_int(cfg, NULL, "use_syslog")); print_set_level(config_get_int(cfg, NULL, "logging_level"));