On Mon, Aug 31, 2020 at 02:45:17AM +0300, Vladimir Oltean wrote:
> The code through which phc2sys sends various PTP management messages to
> ptp4l via pmc can be reused.
> 
> This patch is a trivial movement of that code to a separate translation
> module, outside of phc2sys. This makes it available to other programs
> that want to subscribe to port state change events too, such as ts2phc.
> 
> Signed-off-by: Vladimir Oltean <olte...@gmail.com>
> Reviewed-by: Jacob Keller <jacob.e.kel...@intel.com>

Applied.  I appreciate your careful work refactoring this stuff out!

At this point, the header file, pmc_common.h, is collection of two
interfaces.  I think this needs to be split into two clean modules,
with the pmc_node hiding the lower level pmc.

The 'pmc' interface comprises

    struct pmc *pmc_create(struct config *cfg, enum transport_type 
transport_type, ...);
    void pmc_destroy(struct pmc *pmc);
    int pmc_get_transport_fd(struct pmc *pmc);
    int pmc_send_get_action(struct pmc *pmc, int id);
    int pmc_send_set_action(struct pmc *pmc, int id, void *data, int datasize);
    struct ptp_message *pmc_recv(struct pmc *pmc);
    int pmc_target(struct pmc *pmc, struct PortIdentity *pid);
    void pmc_target_port(struct pmc *pmc, UInteger16 portNumber);
    void pmc_target_all(struct pmc *pmc);
    const char *pmc_action_string(int action);
    int pmc_do_command(struct pmc *pmc, char *str);

These methods are only called by the pmc program and the pmc_node
methods within pmc_common.c.  Notably, the phc2sys program calls none
of those methods.  They are completely hidden by the new pmc_node
methods.

I'm going to work on making pmc_node into its own module today.  I'll
choose a different name if I can think of one, because "node" is not
very descriptive.

I don't think this will cause much conflict with the remainder of this
ts2phc series.  If you don't mind, I'll fix that up myself as I
continue my review...

Thanks,
Richard


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

Reply via email to