Remove index2port since we don't need it now.

Signed-off-by: Hangbin Liu <liuhang...@gmail.com>
---
 clock.c | 29 -----------------------------
 1 file changed, 29 deletions(-)

diff --git a/clock.c b/clock.c
index 354f038..da15882 100644
--- a/clock.c
+++ b/clock.c
@@ -31,7 +31,6 @@
 #include "clockcheck.h"
 #include "foreign.h"
 #include "filter.h"
-#include "hash.h"
 #include "missing.h"
 #include "msg.h"
 #include "phc.h"
@@ -39,7 +38,6 @@
 #include "servo.h"
 #include "stats.h"
 #include "print.h"
-#include "sk.h"
 #include "tlv.h"
 #include "tsproc.h"
 #include "uds.h"
@@ -96,7 +94,6 @@ struct clock {
        int nports; /* does not include the UDS port */
        int last_port_number;
        int sde;
-       struct hash *index2port;
        int free_running;
        int freq_est_interval;
        int grand_master_capable; /* for 802.1AS only */
@@ -275,7 +272,6 @@ void clock_destroy(struct clock *c)
        }
        port_close(c->uds_port);
        free(c->pollfd);
-       hash_destroy(c->index2port, NULL);
        if (c->clkid != CLOCK_REALTIME) {
                phc_close(c->clkid);
        }
@@ -773,8 +769,6 @@ static int clock_add_port(struct clock *c, int phc_index,
                          struct interface *iface)
 {
        struct port *p, *piter, *lastp = NULL;
-       int fd, index;
-       char key[16];
 
        if (clock_resize_pollfd(c, c->nports + 1)) {
                return -1;
@@ -795,24 +789,6 @@ static int clock_add_port(struct clock *c, int phc_index,
        c->nports++;
        clock_fda_changed(c);
 
-       /* Remember the index to port mapping, for link status tracking. */
-       fd = sk_interface_fd();
-       if (fd < 0) {
-               return -1;
-       }
-       index = sk_interface_index(fd, iface->name);
-       if (index < 0) {
-               close(fd);
-               return -1;
-       }
-       snprintf(key, sizeof(key), "%d", index);
-       if (hash_insert(c->index2port, key, p)) {
-               pr_err("failed to add port with index %d twice!", index);
-               close(fd);
-               return -1;
-       }
-       close(fd);
-
        return 0;
 }
 
@@ -1113,11 +1089,6 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
        }
        clock_fda_changed(c);
 
-       c->index2port = hash_create();
-       if (!c->index2port) {
-               pr_err("failed create index-to-port hash table");
-               return NULL;
-       }
        /* Create the ports. */
        STAILQ_FOREACH(iface, &config->interfaces, list) {
                if (clock_add_port(c, phc_index, timestamping, iface)) {
-- 
2.5.5


------------------------------------------------------------------------------
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