This patch makes a number of subroutines into global functions in order
to share code with the TC implementations to come.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 port.c         | 28 +++++++++++++---------------
 port_private.h | 17 +++++++++++++++++
 2 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/port.c b/port.c
index fc02183..a7dbff7 100644
--- a/port.c
+++ b/port.c
@@ -49,8 +49,6 @@ enum syfu_event {
        FUP_MATCH,
 };
 
-#define portnum(p) (p->portIdentity.portNumber)
-
 static int port_capable(struct port *p);
 static int port_is_ieee8021as(struct port *p);
 static void port_nrate_initialize(struct port *p);
@@ -114,7 +112,7 @@ static int pid_eq(struct PortIdentity *a, struct 
PortIdentity *b)
        return 0 == memcmp(a, b, sizeof(*a));
 }
 
-static int source_pid_eq(struct ptp_message *m1, struct ptp_message *m2)
+int source_pid_eq(struct ptp_message *m1, struct ptp_message *m2)
 {
        return pid_eq(&m1->header.sourcePortIdentity,
                      &m2->header.sourcePortIdentity);
@@ -254,7 +252,7 @@ static void fc_prune(struct foreign_clock *fc)
        }
 }
 
-static void ts_add(struct timespec *ts, int ns)
+void ts_add(struct timespec *ts, int ns)
 {
        if (!ns) {
                return;
@@ -525,7 +523,7 @@ not_capable:
        return 0;
 }
 
-static int port_clr_tmo(int fd)
+int port_clr_tmo(int fd)
 {
        struct itimerspec tmo = {
                {0, 0}, {0, 0}
@@ -885,7 +883,7 @@ static int port_set_announce_tmo(struct port *p)
                              p->announce_span, p->logAnnounceInterval);
 }
 
-static int port_set_delay_tmo(struct port *p)
+int port_set_delay_tmo(struct port *p)
 {
        if (p->delayMechanism == DM_P2P) {
                return set_tmo_log(p->fda.fd[FD_DELAY_TIMER], 1,
@@ -918,8 +916,8 @@ static int port_set_sync_tx_tmo(struct port *p)
        return set_tmo_log(p->fda.fd[FD_SYNC_TX_TIMER], 1, p->logSyncInterval);
 }
 
-static void port_show_transition(struct port *p,
-                                enum port_state next, enum fsm_event event)
+void port_show_transition(struct port *p, enum port_state next,
+                         enum fsm_event event)
 {
        if (event == EV_FAULT_DETECTED) {
                pr_notice("port %hu: %s to %s on %s (%s)", portnum(p),
@@ -1111,7 +1109,7 @@ out:
        return -1;
 }
 
-static int port_delay_request(struct port *p)
+int port_delay_request(struct port *p)
 {
        struct ptp_message *msg;
 
@@ -1296,7 +1294,7 @@ out:
 /*
  * port initialize and disable
  */
-static int port_is_enabled(struct port *p)
+int port_is_enabled(struct port *p)
 {
        switch (p->state) {
        case PS_INITIALIZING:
@@ -1355,7 +1353,7 @@ static void port_clear_fda(struct port *p, int count)
                p->fda.fd[i] = -1;
 }
 
-static void port_disable(struct port *p)
+void port_disable(struct port *p)
 {
        int i;
 
@@ -1374,7 +1372,7 @@ static void port_disable(struct port *p)
        clock_fda_changed(p->clock);
 }
 
-static int port_initialize(struct port *p)
+int port_initialize(struct port *p)
 {
        struct config *cfg = clock_config(p->clock);
        int fd[N_TIMER_FDS], i;
@@ -1655,7 +1653,7 @@ static void process_follow_up(struct port *p, struct 
ptp_message *m)
        port_syfufsm(p, event, m);
 }
 
-static int process_pdelay_req(struct port *p, struct ptp_message *m)
+int process_pdelay_req(struct port *p, struct ptp_message *m)
 {
        struct ptp_message *rsp, *fup;
        int err;
@@ -1825,7 +1823,7 @@ calc:
        p->peer_delay_req = NULL;
 }
 
-static int process_pdelay_resp(struct port *p, struct ptp_message *m)
+int process_pdelay_resp(struct port *p, struct ptp_message *m)
 {
        if (p->peer_delay_resp) {
                if (!source_pid_eq(p->peer_delay_resp, m)) {
@@ -1869,7 +1867,7 @@ static int process_pdelay_resp(struct port *p, struct 
ptp_message *m)
        return 0;
 }
 
-static void process_pdelay_resp_fup(struct port *p, struct ptp_message *m)
+void process_pdelay_resp_fup(struct port *p, struct ptp_message *m)
 {
        if (!p->peer_delay_req)
                return;
diff --git a/port_private.h b/port_private.h
index e87d26b..6d10fb0 100644
--- a/port_private.h
+++ b/port_private.h
@@ -22,6 +22,7 @@
 #include <sys/queue.h>
 
 #include "clock.h"
+#include "fsm.h"
 #include "msg.h"
 #include "tmv.h"
 
@@ -108,4 +109,20 @@ struct port {
        LIST_HEAD(fm, foreign_clock) foreign_masters;
 };
 
+#define portnum(p) (p->portIdentity.portNumber)
+
+int port_clr_tmo(int fd);
+int port_delay_request(struct port *p);
+void port_disable(struct port *p);
+int port_initialize(struct port *p);
+int port_is_enabled(struct port *p);
+int port_set_delay_tmo(struct port *p);
+void port_show_transition(struct port *p, enum port_state next,
+                         enum fsm_event event);
+int process_pdelay_req(struct port *p, struct ptp_message *m);
+int process_pdelay_resp(struct port *p, struct ptp_message *m);
+void process_pdelay_resp_fup(struct port *p, struct ptp_message *m);
+int source_pid_eq(struct ptp_message *m1, struct ptp_message *m2);
+void ts_add(struct timespec *ts, int ns);
+
 #endif
-- 
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to