In preparation for a new read-only UDS port, rename variables of the
current UDS port to make it clear it is read-write, as opposed to
read-only.

Signed-off-by: Miroslav Lichvar <mlich...@redhat.com>
---
 clock.c | 49 +++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/clock.c b/clock.c
index 02913f3..b90c805 100644
--- a/clock.c
+++ b/clock.c
@@ -95,7 +95,7 @@ struct clock {
        struct foreign_clock *best;
        struct ClockIdentity best_id;
        LIST_HEAD(ports_head, port) ports;
-       struct port *uds_port;
+       struct port *uds_rw_port;
        struct pollfd *pollfd;
        int pollfd_valid;
        int nports; /* does not include the UDS port */
@@ -129,7 +129,7 @@ struct clock {
        struct clock_stats stats;
        int stats_interval;
        struct clockcheck *sanity_check;
-       struct interface *udsif;
+       struct interface *uds_rw_if;
        LIST_HEAD(clock_subscribers_head, clock_subscriber) subscribers;
        struct monitor *slave_event_monitor;
 };
@@ -243,7 +243,7 @@ static void clock_prune_subscriptions(struct clock *c)
 void clock_send_notification(struct clock *c, struct ptp_message *msg,
                             enum notification event)
 {
-       struct port *uds = c->uds_port;
+       struct port *uds = c->uds_rw_port;
        struct clock_subscriber *s;
 
        LIST_FOREACH(s, &c->subscribers, list) {
@@ -265,13 +265,13 @@ void clock_destroy(struct clock *c)
 {
        struct port *p, *tmp;
 
-       interface_destroy(c->udsif);
+       interface_destroy(c->uds_rw_if);
        clock_flush_subscriptions(c);
        LIST_FOREACH_SAFE(p, &c->ports, list, tmp) {
                clock_remove_port(c, p);
        }
        monitor_destroy(c->slave_event_monitor);
-       port_close(c->uds_port);
+       port_close(c->uds_rw_port);
        free(c->pollfd);
        if (c->clkid != CLOCK_REALTIME) {
                phc_close(c->clkid);
@@ -440,7 +440,7 @@ static int clock_management_fill_response(struct clock *c, 
struct port *p,
                datalen = sizeof(*gsn);
                break;
        case TLV_SUBSCRIBE_EVENTS_NP:
-               if (p != c->uds_port) {
+               if (p != c->uds_rw_port) {
                        /* Only the UDS port allowed. */
                        break;
                }
@@ -782,7 +782,7 @@ static int forwarding(struct clock *c, struct port *p)
        default:
                break;
        }
-       if (p == c->uds_port && ps != PS_FAULTY) {
+       if (p == c->uds_rw_port && ps != PS_FAULTY) {
                return 1;
        }
        return 0;
@@ -1042,20 +1042,20 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
 
        /* Configure the UDS. */
        uds_ifname = config_get_string(config, NULL, "uds_address");
-       c->udsif = interface_create(uds_ifname);
-       if (config_set_section_int(config, interface_name(c->udsif),
+       c->uds_rw_if = interface_create(uds_ifname);
+       if (config_set_section_int(config, interface_name(c->uds_rw_if),
                                   "announceReceiptTimeout", 0)) {
                return NULL;
        }
-       if (config_set_section_int(config, interface_name(c->udsif),
+       if (config_set_section_int(config, interface_name(c->uds_rw_if),
                                    "delay_mechanism", DM_AUTO)) {
                return NULL;
        }
-       if (config_set_section_int(config, interface_name(c->udsif),
+       if (config_set_section_int(config, interface_name(c->uds_rw_if),
                                    "network_transport", TRANS_UDS)) {
                return NULL;
        }
-       if (config_set_section_int(config, interface_name(c->udsif),
+       if (config_set_section_int(config, interface_name(c->uds_rw_if),
                                   "delay_filter_length", 1)) {
                return NULL;
        }
@@ -1179,14 +1179,15 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
        }
 
        /* Create the UDS interface. */
-       c->uds_port = port_open(phc_device, phc_index, timestamping, 0, 
c->udsif, c);
-       if (!c->uds_port) {
+       c->uds_rw_port = port_open(phc_device, phc_index, timestamping, 0,
+                                  c->uds_rw_if, c);
+       if (!c->uds_rw_port) {
                pr_err("failed to open the UDS port");
                return NULL;
        }
        clock_fda_changed(c);
 
-       c->slave_event_monitor = monitor_create(config, c->uds_port);
+       c->slave_event_monitor = monitor_create(config, c->uds_rw_port);
        if (!c->slave_event_monitor) {
                pr_err("failed to create slave event monitor");
                return NULL;
@@ -1205,7 +1206,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
        LIST_FOREACH(p, &c->ports, list) {
                port_dispatch(p, EV_INITIALIZE, 0);
        }
-       port_dispatch(c->uds_port, EV_INITIALIZE, 0);
+       port_dispatch(c->uds_rw_port, EV_INITIALIZE, 0);
 
        return c;
 }
@@ -1313,7 +1314,7 @@ static void clock_check_pollfd(struct clock *c)
                clock_fill_pollfd(dest, p);
                dest += N_CLOCK_PFD;
        }
-       clock_fill_pollfd(dest, c->uds_port);
+       clock_fill_pollfd(dest, c->uds_rw_port);
        c->pollfd_valid = 1;
 }
 
@@ -1330,7 +1331,7 @@ static int clock_do_forward_mgmt(struct clock *c,
                return 0;
 
        /* Don't forward any requests to the UDS port. */
-       if (out == c->uds_port) {
+       if (out == c->uds_rw_port) {
                switch (management_action(msg)) {
                case GET:
                case SET:
@@ -1361,7 +1362,7 @@ static void clock_forward_mgmt_msg(struct clock *c, 
struct port *p, struct ptp_m
                                pr_err("%s: management forward failed",
                                       port_log_name(piter));
                }
-               if (clock_do_forward_mgmt(c, p, c->uds_port, msg, &msg_ready))
+               if (clock_do_forward_mgmt(c, p, c->uds_rw_port, msg, 
&msg_ready))
                        pr_err("uds port: management forward failed");
                if (msg_ready) {
                        msg_post_recv(msg, pdulen);
@@ -1413,7 +1414,7 @@ int clock_manage(struct clock *c, struct port *p, struct 
ptp_message *msg)
                        clock_management_send_error(p, msg, TLV_WRONG_LENGTH);
                        return changed;
                }
-               if (p != c->uds_port) {
+               if (p != c->uds_rw_port) {
                        /* Sorry, only allowed on the UDS port. */
                        clock_management_send_error(p, msg, TLV_NOT_SUPPORTED);
                        return changed;
@@ -1422,7 +1423,7 @@ int clock_manage(struct clock *c, struct port *p, struct 
ptp_message *msg)
                        return changed;
                break;
        case COMMAND:
-               if (p != c->uds_port) {
+               if (p != c->uds_rw_port) {
                        /* Sorry, only allowed on the UDS port. */
                        clock_management_send_error(p, msg, TLV_NOT_SUPPORTED);
                        return changed;
@@ -1434,7 +1435,7 @@ int clock_manage(struct clock *c, struct port *p, struct 
ptp_message *msg)
 
        switch (mgt->id) {
        case TLV_PORT_PROPERTIES_NP:
-               if (p != c->uds_port) {
+               if (p != c->uds_rw_port) {
                        /* Only the UDS port allowed. */
                        clock_management_send_error(p, msg, TLV_NOT_SUPPORTED);
                        return 0;
@@ -1499,7 +1500,7 @@ int clock_manage(struct clock *c, struct port *p, struct 
ptp_message *msg)
 
 void clock_notify_event(struct clock *c, enum notification event)
 {
-       struct port *uds = c->uds_port;
+       struct port *uds = c->uds_rw_port;
        struct PortIdentity pid = port_identity(uds);
        struct ptp_message *msg;
        int id;
@@ -1605,7 +1606,7 @@ int clock_poll(struct clock *c)
        /* Check the UDS port. */
        for (i = 0; i < N_POLLFD; i++) {
                if (cur[i].revents & (POLLIN|POLLPRI)) {
-                       event = port_event(c->uds_port, i);
+                       event = port_event(c->uds_rw_port, i);
                        if (EV_STATE_DECISION_EVENT == event) {
                                c->sde = 1;
                        }
-- 
2.26.2



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

Reply via email to