On 2/11/2020 6:03 AM, Richard Cochran wrote: > Many of the users only require a read only reference to the interface name. > This patch adds an appropriate method. >
Right. > Signed-off-by: Richard Cochran <richardcoch...@gmail.com> --- > interface.c | 12 ++++++++++++ > interface.h | 7 +++++++ > makefile | 8 ++++---- > 3 files changed, 23 insertions(+), 4 deletions(-) > create mode 100644 interface.c > > diff --git a/interface.c b/interface.c > new file mode 100644 > index 0000000..1231db9 > --- /dev/null > +++ b/interface.c > @@ -0,0 +1,12 @@ > +/** > + * @file interface.c > + * @brief Implements network interface data structures. > + * @note Copyright (C) 2020 Richard Cochran <richardcoch...@gmail.com> > + * @note SPDX-License-Identifier: GPL-2.0+ > + */ > +#include "interface.h" > + > +const char *interface_name(struct interface *iface) > +{ > + return iface->name; > +} > diff --git a/interface.h b/interface.h > index 61d53a2..94d5b8f 100644 > --- a/interface.h > +++ b/interface.h > @@ -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 > > diff --git a/makefile b/makefile > index d58d13a..e1e0e99 100644 > --- a/makefile > +++ b/makefile > @@ -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 > So the interface.o isn't being added to something like $(CONFIG)? > OBJECTS = $(OBJ) hwstamp_ctl.o nsm.o phc2sys.o phc_ctl.o pmc.o > pmc_common.o \ > sysoff.o timemaster.o > _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel