Convert call sites to the proper method for setting the time stamping label.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
5f9d36c76a
commit
e43a76cbe6
6
clock.c
6
clock.c
|
@ -846,6 +846,7 @@ struct clock *clock_create(enum clock_type type, struct config *config,
|
|||
const char *phc_device)
|
||||
{
|
||||
enum servo_type servo = config_get_int(config, NULL, "clock_servo");
|
||||
char ts_label[IF_NAMESIZE], phc[32], *tmp;
|
||||
enum timestamp_type timestamping;
|
||||
int fadj = 0, max_adj = 0, sw_ts;
|
||||
int phc_index, required_modes = 0;
|
||||
|
@ -853,7 +854,6 @@ struct clock *clock_create(enum clock_type type, struct config *config,
|
|||
const char *uds_ifname;
|
||||
struct port *p;
|
||||
unsigned char oui[OUI_LEN];
|
||||
char phc[32], *tmp;
|
||||
struct interface *iface, *udsif = &c->uds_interface;
|
||||
struct timespec ts;
|
||||
int sfl;
|
||||
|
@ -951,7 +951,9 @@ struct clock *clock_create(enum clock_type type, struct config *config,
|
|||
c->timestamping = timestamping;
|
||||
required_modes = clock_required_modes(c);
|
||||
STAILQ_FOREACH(iface, &config->interfaces, list) {
|
||||
rtnl_get_ts_device(interface_name(iface), iface->ts_label);
|
||||
memset(ts_label, 0, sizeof(ts_label));
|
||||
rtnl_get_ts_device(interface_name(iface), ts_label);
|
||||
interface_set_label(iface, ts_label);
|
||||
interface_ensure_tslabel(iface);
|
||||
interface_get_tsinfo(iface);
|
||||
if (iface->ts_info.valid &&
|
||||
|
|
5
nsm.c
5
nsm.c
|
@ -262,13 +262,16 @@ static void nsm_help(FILE *fp)
|
|||
static int nsm_open(struct nsm *nsm, struct config *cfg)
|
||||
{
|
||||
enum transport_type transport;
|
||||
char ts_label[IF_NAMESIZE];
|
||||
const char *ifname, *name;
|
||||
struct interface *iface;
|
||||
int count = 0;
|
||||
|
||||
STAILQ_FOREACH(iface, &cfg->interfaces, list) {
|
||||
ifname = interface_name(iface);
|
||||
rtnl_get_ts_device(ifname, iface->ts_label);
|
||||
memset(ts_label, 0, sizeof(ts_label));
|
||||
rtnl_get_ts_device(ifname, ts_label);
|
||||
interface_set_label(iface, ts_label);
|
||||
interface_ensure_tslabel(iface);
|
||||
count++;
|
||||
}
|
||||
|
|
2
port.c
2
port.c
|
@ -2500,7 +2500,7 @@ void port_link_status(void *ctx, int linkup, int ts_index)
|
|||
/* ts_label changed */
|
||||
old_ts_label = interface_label(p->iface);
|
||||
if (if_indextoname(ts_index, ts_label) && strcmp(old_ts_label, ts_label)) {
|
||||
strncpy(p->iface->ts_label, ts_label, MAX_IFNAME_SIZE);
|
||||
interface_set_label(p->iface, ts_label);
|
||||
p->link_status |= TS_LABEL_CHANGED;
|
||||
pr_notice("port %hu: ts label changed to %s", portnum(p), ts_label);
|
||||
}
|
||||
|
|
2
rtnl.c
2
rtnl.c
|
@ -87,7 +87,7 @@ static void rtnl_get_ts_device_callback(void *ctx, int linkup, int ts_index)
|
|||
*dst = ts_index;
|
||||
}
|
||||
|
||||
int rtnl_get_ts_device(const char *device, char *ts_device)
|
||||
int rtnl_get_ts_device(const char *device, char ts_device[IF_NAMESIZE])
|
||||
{
|
||||
int err, fd;
|
||||
int ts_index = -1;
|
||||
|
|
4
rtnl.h
4
rtnl.h
|
@ -20,6 +20,8 @@
|
|||
#ifndef HAVE_RTNL_H
|
||||
#define HAVE_RTNL_H
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
typedef void (*rtnl_callback)(void *ctx, int linkup, int ts_index);
|
||||
|
||||
/**
|
||||
|
@ -37,7 +39,7 @@ int rtnl_close(int fd);
|
|||
* at least IF_NAMESIZE bytes long.
|
||||
* @return Zero on success, or -1 on error.
|
||||
*/
|
||||
int rtnl_get_ts_device(const char *device, char *ts_device);
|
||||
int rtnl_get_ts_device(const char *device, char ts_device[IF_NAMESIZE]);
|
||||
|
||||
/**
|
||||
* Request the link status from the kernel.
|
||||
|
|
Loading…
Reference in New Issue