clock: remove hash table index2port

Remove index2port since we don't need it now.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
master
Hangbin Liu 2017-07-10 15:39:31 +08:00 committed by Richard Cochran
parent 25ec8a3b4e
commit 7c3f9579f0
1 changed files with 0 additions and 29 deletions

29
clock.c
View File

@ -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)) {