Re: [Linuxptp-devel] [PATCH RFC 10/30] interface: Introduce a method to get the time stamping information.

2020-02-18 Thread Jacob Keller



On 2/11/2020 6:04 AM, Richard Cochran wrote:
> In order to prevent users from open coding this logic, this patch
> provides a method that populates the time stamping information from
> the interface label.
> 
> Signed-off-by: Richard Cochran 

Makes sense.

Reviewed-by: Jacob Keller 

> ---
>  interface.c | 5 +
>  interface.h | 7 +++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/interface.c b/interface.c
> index 7909a5e..460ceb8 100644
> --- a/interface.c
> +++ b/interface.c
> @@ -6,6 +6,11 @@
>   */
>  #include "interface.h"
>  
> +int interface_get_tsinfo(struct interface *iface)
> +{
> + return sk_get_ts_info(iface->ts_label, &iface->ts_info);
> +}
> +

Presumably callers don't need to directly access ts_info, or if they do
we can later provide an accessor function.

>  const char *interface_label(struct interface *iface)
>  {
>   return iface->ts_label;
> diff --git a/interface.h b/interface.h
> index 89f3e94..05cfb10 100644
> --- a/interface.h
> +++ b/interface.h
> @@ -24,6 +24,13 @@ struct interface {
>   struct sk_ts_info ts_info;
>  };
>  
> +/**
> + * Populate the time stamping information of a given interface.
> + * @param iface  The interface of interest.
> + * @return   zero on success, negative on failure.
> + */
> +int interface_get_tsinfo(struct interface *iface);
> +
>  /**
>   * Obtain the time stamping label of a network interface.  This can be
>   * different from the name of the interface when bonding is in effect.
> 


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


[Linuxptp-devel] [PATCH RFC 10/30] interface: Introduce a method to get the time stamping information.

2020-02-11 Thread Richard Cochran
In order to prevent users from open coding this logic, this patch
provides a method that populates the time stamping information from
the interface label.

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 7909a5e..460ceb8 100644
--- a/interface.c
+++ b/interface.c
@@ -6,6 +6,11 @@
  */
 #include "interface.h"
 
+int interface_get_tsinfo(struct interface *iface)
+{
+   return sk_get_ts_info(iface->ts_label, &iface->ts_info);
+}
+
 const char *interface_label(struct interface *iface)
 {
return iface->ts_label;
diff --git a/interface.h b/interface.h
index 89f3e94..05cfb10 100644
--- a/interface.h
+++ b/interface.h
@@ -24,6 +24,13 @@ struct interface {
struct sk_ts_info ts_info;
 };
 
+/**
+ * Populate the time stamping information of a given interface.
+ * @param iface  The interface of interest.
+ * @return   zero on success, negative on failure.
+ */
+int interface_get_tsinfo(struct interface *iface);
+
 /**
  * Obtain the time stamping label of a network interface.  This can be
  * different from the name of the interface when bonding is in effect.
-- 
2.20.1



___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel