Skip to content

Commit

Permalink
interface: Introduce an access method for the name field.
Browse files Browse the repository at this point in the history
Many of the users only require a read only reference to the interface name.
This patch adds an appropriate method.

Signed-off-by: Richard Cochran <[email protected]>
  • Loading branch information
richardcochran committed Mar 4, 2020
1 parent c5b9ab9 commit 380ee34
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
12 changes: 12 additions & 0 deletions interface.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @file interface.c
* @brief Implements network interface data structures.
* @note Copyright (C) 2020 Richard Cochran <[email protected]>
* @note SPDX-License-Identifier: GPL-2.0+
*/
#include "interface.h"

const char *interface_name(struct interface *iface)
{
return iface->name;
}
7 changes: 7 additions & 0 deletions interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,12 @@ struct interface {
struct sk_ts_info ts_info;
};

/**
* Obtains the name of a network interface.
* @param iface The interface of interest.
* @return The device name of the network interface.
*/
const char *interface_name(struct interface *iface);

#endif

8 changes: 4 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ FILTERS = filter.o mave.o mmedian.o
SERVOS = linreg.o ntpshm.o nullf.o pi.o servo.o
TRANSP = raw.o transport.o udp.o udp6.o uds.o
OBJ = bmc.o clock.o clockadj.o clockcheck.o config.o designated_fsm.o \
e2e_tc.o fault.o $(FILTERS) fsm.o hash.o msg.o phc.o port.o port_signaling.o \
pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o $(SERVOS) sk.o stats.o tc.o \
$(TRANSP) telecom.o tlv.o tsproc.o unicast_client.o unicast_fsm.o \
unicast_service.o util.o version.o
e2e_tc.o fault.o $(FILTERS) fsm.o hash.o interface.o msg.o phc.o port.o \
port_signaling.o pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o $(SERVOS) sk.o \
stats.o tc.o $(TRANSP) telecom.o tlv.o tsproc.o unicast_client.o \
unicast_fsm.o unicast_service.o util.o version.o

OBJECTS = $(OBJ) hwstamp_ctl.o nsm.o phc2sys.o phc_ctl.o pmc.o pmc_common.o \
sysoff.o timemaster.o
Expand Down

0 comments on commit 380ee34

Please sign in to comment.