config: convert 'verbose' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
f5f77b182c
commit
a7db9bad37
8
config.c
8
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))
|
||||
|
|
3
config.h
3
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);
|
||||
|
|
7
ptp4l.c
7
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"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue