From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Sven Eckelmann Date: Fri, 17 Apr 2015 19:15:10 +0200 Message-Id: <1429290910-27079-1-git-send-email-sven@narfation.org> In-Reply-To: <1429288461-26260-4-git-send-email-sven@narfation.org> References: <1429288461-26260-4-git-send-email-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH-nextv2 4/6] batman-adv: introduce dev_get_iflink() Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: b.a.t.m.a.n@lists.open-mesh.org From: Nicolas Dichtel The goal of this patch is to prepare the removal of the iflink field. It introduces a new ndo function, which will be implemented by virtual interfaces. There is no functional change into this patch. All readers of iflink field now call dev_get_iflink(). Signed-off-by: Nicolas Dichtel Signed-off-by: David S. Miller [sven@narfation.org: added compat code] Signed-off-by: Sven Eckelmann --- This has to be moved to linux/netdevice.h for https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2015-April/012960.html v2: - Fix the comment in the compat code which still said "3, 19, 0" v3 - use batman-adv: prefix instead of dev: compat.h | 6 ++++++ hard-interface.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compat.h b/compat.h index 45412b0..0332296 100644 --- a/compat.h +++ b/compat.h @@ -482,4 +482,10 @@ static inline bool seq_has_overflowed(struct seq_file *m) #endif /* < KERNEL_VERSION(3, 19, 0) */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) + +#define dev_get_iflink(_net_dev) ((_net_dev)->iflink) + +#endif /* < KERNEL_VERSION(4, 1, 0) */ + #endif /* _NET_BATMAN_ADV_COMPAT_H_ */ diff --git a/hard-interface.c b/hard-interface.c index fbda6b5..baf1f98 100644 --- a/hard-interface.c +++ b/hard-interface.c @@ -83,11 +83,12 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev) return true; /* no more parents..stop recursion */ - if (net_dev->iflink == 0 || net_dev->iflink == net_dev->ifindex) + if (dev_get_iflink(net_dev) == 0 || + dev_get_iflink(net_dev) == net_dev->ifindex) return false; /* recurse over the parent device */ - parent_dev = __dev_get_by_index(&init_net, net_dev->iflink); + parent_dev = __dev_get_by_index(&init_net, dev_get_iflink(net_dev)); /* if we got a NULL parent_dev there is something broken.. */ if (WARN(!parent_dev, "Cannot find parent device")) return false; -- 2.1.4