aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2007-09-12 08:57:09 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:18 -0400
commita050c33f4a4d5babaf94a8ba6ae7a200135240b3 (patch)
treed47e7be9cb38e277e767601926e11a432dd86c39 /include
parentabf07acbb9f122218095d0d221e0f949160ccc37 (diff)
[NETNS]: Fix bad macro definition.
The macro definition is bad. When calling next_net_device with parameter name "dev", the resulting code is: struct net_device *dev = dev and that leads to an unexpected behavior. Especially when llc_core is compiled in, the kernel panics at boot time. The patchset change macro definition with static inline functions as they were defined before. Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/netdevice.h35
1 files changed, 17 insertions, 18 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 407658c64fb6..625240ce27f1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -41,7 +41,8 @@
41#include <linux/dmaengine.h> 41#include <linux/dmaengine.h>
42#include <linux/workqueue.h> 42#include <linux/workqueue.h>
43 43
44struct net; 44#include <net/net_namespace.h>
45
45struct vlan_group; 46struct vlan_group;
46struct ethtool_ops; 47struct ethtool_ops;
47struct netpoll_info; 48struct netpoll_info;
@@ -753,23 +754,21 @@ extern rwlock_t dev_base_lock; /* Device list lock */
753 list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) 754 list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
754#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) 755#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
755 756
756#define next_net_device(d) \ 757static inline struct net_device *next_net_device(struct net_device *dev)
757({ \ 758{
758 struct net_device *dev = d; \ 759 struct list_head *lh;
759 struct list_head *lh; \ 760 struct net *net;
760 struct net *net; \ 761
761 \ 762 net = dev->nd_net;
762 net = dev->nd_net; \ 763 lh = dev->dev_list.next;
763 lh = dev->dev_list.next; \ 764 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
764 lh == &net->dev_base_head ? NULL : net_device_entry(lh); \ 765}
765}) 766
766 767static inline struct net_device *first_net_device(struct net *net)
767#define first_net_device(N) \ 768{
768({ \ 769 return list_empty(&net->dev_base_head) ? NULL :
769 struct net *NET = (N); \ 770 net_device_entry(net->dev_base_head.next);
770 list_empty(&NET->dev_base_head) ? NULL : \ 771}
771 net_device_entry(NET->dev_base_head.next); \
772})
773 772
774extern int netdev_boot_setup_check(struct net_device *dev); 773extern int netdev_boot_setup_check(struct net_device *dev);
775extern unsigned long netdev_boot_base(const char *prefix, int unit); 774extern unsigned long netdev_boot_base(const char *prefix, int unit);