Convert call sites to the proper method for initializing the time stamping label.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
master
Richard Cochran 2020-02-09 13:50:53 -08:00
parent b802e3b784
commit a8df585e04
3 changed files with 3 additions and 17 deletions

12
clock.c
View File

@ -842,16 +842,6 @@ int clock_required_modes(struct clock *c)
return required_modes;
}
/*
* If we do not have a slave or the rtnl query failed, then use our
* own interface name as the time stamping interface name.
*/
static void ensure_ts_label(struct interface *iface)
{
if (iface->ts_label[0] == '\0')
strncpy(iface->ts_label, interface_name(iface), MAX_IFNAME_SIZE);
}
struct clock *clock_create(enum clock_type type, struct config *config,
const char *phc_device)
{
@ -961,7 +951,7 @@ struct clock *clock_create(enum clock_type type, struct config *config,
required_modes = clock_required_modes(c);
STAILQ_FOREACH(iface, &config->interfaces, list) {
rtnl_get_ts_device(interface_name(iface), iface->ts_label);
ensure_ts_label(iface);
interface_ensure_tslabel(iface);
interface_get_tsinfo(iface);
if (iface->ts_info.valid &&
((iface->ts_info.so_timestamping & required_modes) != required_modes)) {

4
nsm.c
View File

@ -269,9 +269,7 @@ static int nsm_open(struct nsm *nsm, struct config *cfg)
STAILQ_FOREACH(iface, &cfg->interfaces, list) {
ifname = interface_name(iface);
rtnl_get_ts_device(ifname, iface->ts_label);
if (iface->ts_label[0] == '\0') {
strncpy(iface->ts_label, ifname, MAX_IFNAME_SIZE);
}
interface_ensure_tslabel(iface);
count++;
}
if (count != 1) {

View File

@ -351,9 +351,7 @@ struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type,
}
strncpy(iface.name, iface_name, MAX_IFNAME_SIZE);
if (iface.ts_label[0] == '\0') {
strncpy(iface.ts_label, interface_name(&iface), MAX_IFNAME_SIZE);
}
interface_ensure_tslabel(&iface);
if (transport_open(pmc->transport, &iface,
&pmc->fdarray, TS_SOFTWARE)) {