Change the rtnl_get_ts_label() function to accept the name of the master
interface and the buffer for the slave interface directly instead of the
struct interface from config.h.

Also, rename the function to rtnl_get_ts_device().

Signed-off-by: Miroslav Lichvar <mlich...@redhat.com>
---
 clock.c |  2 +-
 nsm.c   |  2 +-
 rtnl.c  | 10 +++++-----
 rtnl.h  | 13 +++++++------
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/clock.c b/clock.c
index 8e7af0d..9bf2ac8 100644
--- a/clock.c
+++ b/clock.c
@@ -945,7 +945,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
        c->timestamping = timestamping;
        required_modes = clock_required_modes(c);
        STAILQ_FOREACH(iface, &config->interfaces, list) {
-               rtnl_get_ts_label(iface);
+               rtnl_get_ts_device(iface->name, iface->ts_label);
                ensure_ts_label(iface);
                sk_get_ts_info(iface->ts_label, &iface->ts_info);
                if (iface->ts_info.valid &&
diff --git a/nsm.c b/nsm.c
index fb87b3a..d8e3c20 100644
--- a/nsm.c
+++ b/nsm.c
@@ -267,7 +267,7 @@ static int nsm_open(struct nsm *nsm, struct config *cfg)
        int count = 0;
 
        STAILQ_FOREACH(iface, &cfg->interfaces, list) {
-               rtnl_get_ts_label(iface);
+               rtnl_get_ts_device(iface->name, iface->ts_label);
                if (iface->ts_label[0] == '\0') {
                        strncpy(iface->ts_label, iface->name, MAX_IFNAME_SIZE);
                }
diff --git a/rtnl.c b/rtnl.c
index cea936b..f9a572b 100644
--- a/rtnl.c
+++ b/rtnl.c
@@ -43,13 +43,13 @@ int rtnl_close(int fd)
        return close(fd);
 }
 
-static void rtnl_get_ts_label_callback(void *ctx, int linkup, int ts_index)
+static void rtnl_get_ts_device_callback(void *ctx, int linkup, int ts_index)
 {
        int *dst = ctx;
        *dst = ts_index;
 }
 
-int rtnl_get_ts_label(struct interface *iface)
+int rtnl_get_ts_device(char *device, char *ts_device)
 {
        int err, fd;
        int ts_index = -1;
@@ -58,13 +58,13 @@ int rtnl_get_ts_label(struct interface *iface)
        if (fd < 0)
                return fd;
 
-       err = rtnl_link_query(fd, iface->name);
+       err = rtnl_link_query(fd, device);
        if (err) {
                goto no_info;
        }
 
-       rtnl_link_status(fd, iface->name, rtnl_get_ts_label_callback, 
&ts_index);
-       if (ts_index > 0 && if_indextoname(ts_index, iface->ts_label))
+       rtnl_link_status(fd, device, rtnl_get_ts_device_callback, &ts_index);
+       if (ts_index > 0 && if_indextoname(ts_index, ts_device))
                err = 0;
        else
                err = -1;
diff --git a/rtnl.h b/rtnl.h
index 2906d74..f877cd2 100644
--- a/rtnl.h
+++ b/rtnl.h
@@ -20,8 +20,6 @@
 #ifndef HAVE_RTNL_H
 #define HAVE_RTNL_H
 
-#include "config.h"
-
 typedef void (*rtnl_callback)(void *ctx, int linkup, int ts_index);
 
 /**
@@ -32,11 +30,14 @@ typedef void (*rtnl_callback)(void *ctx, int linkup, int 
ts_index);
 int rtnl_close(int fd);
 
 /**
- * Get interface ts_label information
- * @param iface  struct interface.
- * @return       Zero on success, or -1 on error.
+ * Get name of the slave interface which timestamps packets going through
+ * a master interface (e.g. bond0)
+ * @param device    Name of the master interface.
+ * @param ts_device Buffer for the name of the slave interface, which must be
+ *                  at least IF_NAMESIZE bytes long.
+ * @return          Zero on success, or -1 on error.
  */
-int rtnl_get_ts_label(struct interface *iface);
+int rtnl_get_ts_device(char *device, char *ts_device);
 
 /**
  * Request the link status from the kernel.
-- 
2.14.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to