Re: [Linuxptp-devel] [PATCH RFC 06/30] interface: Introduce an access method for the name field.
On 3/4/2020 8:56 AM, Richard Cochran wrote: > On Tue, Feb 18, 2020 at 11:33:32AM -0800, Jacob Keller wrote: >> So the interface.o isn't being added to something like $(CONFIG)? > > I like the idea, but I'll leave that as a follow-on task. > > Thanks, > Richard > Yea makes sense. I don't see a reason to hold up this series due to that. ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Re: [Linuxptp-devel] [PATCH RFC 06/30] interface: Introduce an access method for the name field.
On Tue, Feb 18, 2020 at 11:33:32AM -0800, Jacob Keller wrote: > So the interface.o isn't being added to something like $(CONFIG)? I like the idea, but I'll leave that as a follow-on task. Thanks, Richard ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Re: [Linuxptp-devel] [PATCH RFC 06/30] interface: Introduce an access method for the name field.
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 --- > 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 000..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 > + * @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
[Linuxptp-devel] [PATCH RFC 06/30] interface: Introduce an access method for the name field.
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 --- 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 000..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 + * @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 OBJECTS= $(OBJ) hwstamp_ctl.o nsm.o phc2sys.o phc_ctl.o pmc.o pmc_common.o \ sysoff.o timemaster.o -- 2.20.1 ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel