diff --git a/clock.c b/clock.c index 9e9feba..1569108 100644 --- a/clock.c +++ b/clock.c @@ -73,6 +73,7 @@ struct clock_subscriber { }; struct clock { + struct config *config; clockid_t clkid; struct servo *servo; enum servo_type servo_type; @@ -792,9 +793,10 @@ static void clock_remove_port(struct clock *c, struct port *p) port_close(p); } -struct clock *clock_create(int phc_index, struct interfaces_head *ifaces, - enum timestamp_type timestamping, struct default_ds *dds, - enum servo_type servo) +struct clock *clock_create(struct config *config, int phc_index, + struct interfaces_head *ifaces, + enum timestamp_type timestamping, + struct default_ds *dds, enum servo_type servo) { int fadj = 0, max_adj = 0, sw_ts = timestamping == TS_SOFTWARE ? 1 : 0; struct clock *c = &the_clock; @@ -814,6 +816,7 @@ struct clock *clock_create(int phc_index, struct interfaces_head *ifaces, udsif->transport = TRANS_UDS; udsif->delay_filter_length = 1; + c->config = config; c->free_running = dds->free_running; c->freq_est_interval = dds->freq_est_interval; c->grand_master_capable = dds->grand_master_capable; diff --git a/clock.h b/clock.h index a8286dd..1e6cd98 100644 --- a/clock.h +++ b/clock.h @@ -61,6 +61,7 @@ UInteger8 clock_class(struct clock *c); * Create a clock instance. There can only be one clock in any system, * so subsequent calls will destroy the previous clock instance. * + * @param config Pointer to the configuration database. * @param phc_index PTP hardware clock device to use. * Pass -1 to select CLOCK_REALTIME. * @param ifaces A queue of network interfaces. @@ -69,9 +70,10 @@ UInteger8 clock_class(struct clock *c); * @param servo The servo that this clock will use. * @return A pointer to the single global clock instance. */ -struct clock *clock_create(int phc_index, struct interfaces_head *ifaces, - enum timestamp_type timestamping, struct default_ds *dds, - enum servo_type servo); +struct clock *clock_create(struct config *config, int phc_index, + struct interfaces_head *ifaces, + enum timestamp_type timestamping, + struct default_ds *dds, enum servo_type servo); /** * Obtains a clock's default data set. diff --git a/ptp4l.c b/ptp4l.c index 61c5854..56cb8bd 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -377,7 +377,8 @@ int main(int argc, char *argv[]) return -1; } - clock = clock_create(phc_index, &cfg_settings.interfaces, + clock = clock_create(&cfg_settings, + phc_index, &cfg_settings.interfaces, *timestamping, &cfg_settings.dds, cfg_settings.clock_servo); if (!clock) {