Re: [Linuxptp-devel] [PATCH RFC 18/30] interface: Introduce a method to get the PHC index.
On 2/11/2020 6:04 AM, Richard Cochran wrote: > Signed-off-by: Richard Cochran > --- > interface.c | 5 + > interface.h | 7 +++ > 2 files changed, 12 insertions(+) > > diff --git a/interface.c b/interface.c > index d7eeb41..02f63a0 100644 > --- a/interface.c > +++ b/interface.c > @@ -28,6 +28,11 @@ const char *interface_name(struct interface *iface) > return iface->name; > } > > +int interface_phc_index(struct interface *iface) > +{ > + return iface->ts_info.phc_index; > +} In theory these "getters" could use const struct interface *iface. I'm not really sure that buys us much overall, though. Thanks, Jake > + > void interface_set_label(struct interface *iface, const char *label) > { > strncpy(iface->ts_label, label, MAX_IFNAME_SIZE); > diff --git a/interface.h b/interface.h > index f416b24..4f408d5 100644 > --- a/interface.h > +++ b/interface.h > @@ -53,6 +53,13 @@ const char *interface_label(struct interface *iface); > */ > const char *interface_name(struct interface *iface); > > +/** > + * Obtains the index of a PTP Hardware Clock device from a network interface. > + * @param iface The interface of interest. > + * @return The PHC index of the interface. > + */ > +int interface_phc_index(struct interface *iface); > + > /** > * Set the time stamping label of a given interface. > * @param iface The interface of interest. > ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Re: [Linuxptp-devel] [PATCH RFC 18/30] interface: Introduce a method to get the PHC index.
On 2/11/2020 6:04 AM, Richard Cochran wrote: > Signed-off-by: Richard Cochran Reviewed-by: Jacob Keller > --- > interface.c | 5 + > interface.h | 7 +++ > 2 files changed, 12 insertions(+) > > diff --git a/interface.c b/interface.c > index d7eeb41..02f63a0 100644 > --- a/interface.c > +++ b/interface.c > @@ -28,6 +28,11 @@ const char *interface_name(struct interface *iface) > return iface->name; > } > > +int interface_phc_index(struct interface *iface) > +{ > + return iface->ts_info.phc_index; > +} > + > void interface_set_label(struct interface *iface, const char *label) > { > strncpy(iface->ts_label, label, MAX_IFNAME_SIZE); > diff --git a/interface.h b/interface.h > index f416b24..4f408d5 100644 > --- a/interface.h > +++ b/interface.h > @@ -53,6 +53,13 @@ const char *interface_label(struct interface *iface); > */ > const char *interface_name(struct interface *iface); > > +/** > + * Obtains the index of a PTP Hardware Clock device from a network interface. > + * @param iface The interface of interest. > + * @return The PHC index of the interface. > + */ > +int interface_phc_index(struct interface *iface); > + > /** > * Set the time stamping label of a given interface. > * @param iface The interface of interest. > ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
[Linuxptp-devel] [PATCH RFC 18/30] interface: Introduce a method to get the PHC index.
Signed-off-by: Richard Cochran --- interface.c | 5 + interface.h | 7 +++ 2 files changed, 12 insertions(+) diff --git a/interface.c b/interface.c index d7eeb41..02f63a0 100644 --- a/interface.c +++ b/interface.c @@ -28,6 +28,11 @@ const char *interface_name(struct interface *iface) return iface->name; } +int interface_phc_index(struct interface *iface) +{ + return iface->ts_info.phc_index; +} + void interface_set_label(struct interface *iface, const char *label) { strncpy(iface->ts_label, label, MAX_IFNAME_SIZE); diff --git a/interface.h b/interface.h index f416b24..4f408d5 100644 --- a/interface.h +++ b/interface.h @@ -53,6 +53,13 @@ const char *interface_label(struct interface *iface); */ const char *interface_name(struct interface *iface); +/** + * Obtains the index of a PTP Hardware Clock device from a network interface. + * @param iface The interface of interest. + * @return The PHC index of the interface. + */ +int interface_phc_index(struct interface *iface); + /** * Set the time stamping label of a given interface. * @param iface The interface of interest. -- 2.20.1 ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel