Skip to content

Commit

Permalink
Convert call sites to the proper method for initializing the time sta…
Browse files Browse the repository at this point in the history
…mping label.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
  • Loading branch information
richardcochran committed Mar 4, 2020
1 parent b802e3b commit a8df585
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
12 changes: 1 addition & 11 deletions clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)) {
Expand Down
4 changes: 1 addition & 3 deletions nsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 1 addition & 3 deletions pmc_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit a8df585

Please sign in to comment.