[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] Trying to refactor ntpshm.c
From: |
Eric S. Raymond |
Subject: |
[gpsd-dev] Trying to refactor ntpshm.c |
Date: |
Mon, 28 Oct 2013 08:25:07 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Gary, I'm trying to refactor ntpshm.c, for three reasons:
1) I want to use the PPS-monitoring loop in gpsmon.c so that it can
show PPS notifications in the packet window. This means that the
pps-monitoring-thread machinery needs to be separated from the code for
reporting to ntpd and chrony, which gpsmon won't use.
2) Cleanup. That module is very tangled. By breaking it in two -
moving the thread management to a separate ppsthread.c - I think we
can increase the readability and maintainability of the code
substantially.
3) Easier pluggability for other PPS reporting methods.
The relevant commits are:
Begin the painful process of factoring the thread processing.
Attempting to disentangle the thread monitor from ntpd and chrony reporting.
More factoring out of chrony code.
Move some code and remove unneeded deoendency.
More code rearrangement. No logic changes.
Comment polishing.
Please review these changes and test chrony operation. If I broke
anything, it was probably in "Attempting to disentangle...".
For the next steo, I need to know: will it break the intended
semantics if I replace
(void)ntpshm_pps(session, &tv);
with
(void)ntpshm_pps(session, &edge_tv);
?
The reason I'm asking is that I want to factor this section of code
TSTOTV( &tv, &ts );
if (session->ship_to_ntpd) {
log1 = "accepted";
if ( 0 <= session->chronyfd ) {
log1 = "accepted chrony sock";
chrony_send(session, &edge_tv, edge_offset);
}
(void)ntpshm_pps(session, &tv);
} else {
log1 = "skipped ship_to_ntp=0";
}
into a hook function. I'm confused by the way tv and edge_tv are
managed; I can't tell whether they're reptesenting the same thing
or not. (edge_tv used to be the tv component of sample.)
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
- [gpsd-dev] Trying to refactor ntpshm.c,
Eric S. Raymond <=