On Sat, Aug 29, 2020 at 12:53:32PM -0700, Richard Cochran wrote:
> On Tue, Aug 18, 2020 at 02:19:32AM +0300, Vladimir Oltean wrote:
> > Eliminate the ad-hoc use of global variables in the ts2phc program by
> > introducing one data structure that incorporates them. This might make
> > the code more understandable to people coming from a kernel background,
> > since it resembles the type of data organization used there. It is also
> > now closer to the data organization of phc2sys, a similar program in
> > both purpose and implementation.
> 
> Is this change needed for the further parts of the patch series?  If
> so, then it helps to state that in the change log explicitly.
> 

Yes, I am using "priv->" quite extensively in the next patches. It isn't
just refactoring for the sake of refactoring.
In principle, the problem has to do with the PPS master polymorphism.
Not all PPS masters will expose a clock, only the PHC kind will. So I
need to violate object encapsulation a little bit, because the main
ts2phc.c needs to synchronize a list of clocks, list which is populated
by the slaves and the masters which are capable of being synchronized.
Instead of messing around with exported global variables as such, I made
struct ts2phc_private the common working space for the entire program,
which is a paradigm that felt quite natural to me. So now, there is a
bit less object encapsulation (which was a goal for me, you may not like
it though) in the fact that the slaves and the masters populate their
private struct clock into the priv list of clocks.

Thanks,
-Vladimir


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to