config: get the time stamp information early.
There is no need to have a function to get this information as we can easily obtain it when the interface is first created. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
1b7088dea8
commit
2fc2af97d8
7
config.c
7
config.c
|
@ -534,7 +534,6 @@ int config_read(char *name, struct config *cfg)
|
||||||
current_port = config_create_interface(port, cfg);
|
current_port = config_create_interface(port, cfg);
|
||||||
if (!current_port)
|
if (!current_port)
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
config_init_interface(current_port, cfg);
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -606,15 +605,11 @@ struct interface *config_create_interface(char *name, struct config *cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(iface->name, name, MAX_IFNAME_SIZE);
|
strncpy(iface->name, name, MAX_IFNAME_SIZE);
|
||||||
|
sk_get_ts_info(iface->name, &iface->ts_info);
|
||||||
STAILQ_INSERT_TAIL(&cfg->interfaces, iface, list);
|
STAILQ_INSERT_TAIL(&cfg->interfaces, iface, list);
|
||||||
return iface;
|
return iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_init_interface(struct interface *iface, struct config *cfg)
|
|
||||||
{
|
|
||||||
sk_get_ts_info(iface->name, &iface->ts_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct config *config_create(void)
|
struct config *config_create(void)
|
||||||
{
|
{
|
||||||
char buf[CONFIG_LABEL_SIZE + 8];
|
char buf[CONFIG_LABEL_SIZE + 8];
|
||||||
|
|
1
config.h
1
config.h
|
@ -48,7 +48,6 @@ struct config {
|
||||||
|
|
||||||
int config_read(char *name, struct config *cfg);
|
int config_read(char *name, struct config *cfg);
|
||||||
struct interface *config_create_interface(char *name, struct config *cfg);
|
struct interface *config_create_interface(char *name, struct config *cfg);
|
||||||
void config_init_interface(struct interface *iface, struct config *cfg);
|
|
||||||
void config_destroy(struct config *cfg);
|
void config_destroy(struct config *cfg);
|
||||||
|
|
||||||
/* New, hash table based methods: */
|
/* New, hash table based methods: */
|
||||||
|
|
1
ptp4l.c
1
ptp4l.c
|
@ -296,7 +296,6 @@ int main(int argc, char *argv[])
|
||||||
/* Init interface configs and check whether timestamping mode is
|
/* Init interface configs and check whether timestamping mode is
|
||||||
* supported. */
|
* supported. */
|
||||||
STAILQ_FOREACH(iface, &cfg->interfaces, list) {
|
STAILQ_FOREACH(iface, &cfg->interfaces, list) {
|
||||||
config_init_interface(iface, cfg);
|
|
||||||
if (iface->ts_info.valid &&
|
if (iface->ts_info.valid &&
|
||||||
((iface->ts_info.so_timestamping & required_modes) != required_modes)) {
|
((iface->ts_info.so_timestamping & required_modes) != required_modes)) {
|
||||||
fprintf(stderr, "interface '%s' does not support "
|
fprintf(stderr, "interface '%s' does not support "
|
||||||
|
|
Loading…
Reference in New Issue